C#海康威视球机NET_DVR_PTZSelZoomIn_EX函数 3D云台定位框选代码实现

            NET_DVR_POINT_FRAME ptFrame;
            //int left, int top, int right, int bottom
            //这里放一个在画面框选的矩形 我这里是用了识别出来的矩形模拟
            Rectangle ec = new Rectangle();
            ec = Rectangle.FromLTRB(933, 213, 1175, 614);
            //divides the width and height to 255 proportion
            ptFrame.xTop = (int)(ec.Left * 255 / RealPlayWnd.Width);
            ptFrame.yTop = (int)(ec.Top * 255 / RealPlayWnd.Height);
            ptFrame.xBottom = (int)(ec.Right * 255 / RealPlayWnd.Width);
            ptFrame.yBottom = (int)(ec.Bottom * 255 / RealPlayWnd.Height);
            if (ec.Left < ec.Right)
            {
                if (ec.Top < ec.Bottom)
                {
                    ptFrame.bCounter = 4;
                }
                else
                {
                    ptFrame.bCounter = 2;
                }

            }
            else
            {
                if (ec.Top < ec.Bottom)
                {
                    ptFrame.bCounter = 3;
                }
                else
                {
                    ptFrame.bCounter = 1;
                }
            }
            bool bRet = CHCNetSDK.NET_DVR_PTZSelZoomIn_EX(m_lUserID, 1, ref ptFrame);
//还有之前自己写的一个,现在在这做下备份:

  

multiple=CenterX/27 #倍数
            if(CopyObjectCenterX360):   #如果大于360 就-360度
                  ShiJiX=ShiJiX-360	 
            if(CopyObjectCenterY90):   #如果大于360 就-360度
                  ShiJiY=ShiJiY-90	 
            convertT="0x"+str(ShiJiX*10)
            print("convertT:"+str(convertT));
            PP=int(convertT, 16)
            print("PP:"+str(PP));
            convertQ="0x"+str(abs(ShiJiY*10))
            TP=int(convertQ, 16)
			
            convertZ="0x"+str(abs(2*10))
            TZ=int(convertZ, 16)
            #云台参数传输到云台
            ptrPicCfgX=NET_DVR_PTZPOS()
            ptrPicCfgX.wAction=1
            ptrPicCfgX.wZoomPos=TZ
            ptrPicCfgX.wPanPos=PP
            ptrPicCfgX.wTiltPos=TP
            Objdll.NET_DVR_SetDVRConfig(lUserId,292, 1, byref(ptrPicCfgX),sys.getsizeof(NET_DVR_PTZPOS))

你可能感兴趣的:(项目知识点)