Beispiel #1
0
 public VideoCapture(DVRLoginInfo leftDvrLoginInfo, DVRLoginInfo rightDvrLoginInfo)
 {
     if (!CHCNetSDK.NET_DVR_Init())
     {
         throw new Exception("NET_DVR_Init error!");
     }
     CamLeft = new Camera(leftDvrLoginInfo.DVRIPAddress, leftDvrLoginInfo.DVRPortNumber,
                          leftDvrLoginInfo.DVRUserName, leftDvrLoginInfo.DVRPassword);
     CamRight = new Camera(rightDvrLoginInfo.DVRIPAddress, rightDvrLoginInfo.DVRPortNumber,
                           rightDvrLoginInfo.DVRUserName, rightDvrLoginInfo.DVRPassword);
     IsPreviewing = false;
 }
Beispiel #2
0
        private ControlClass()
        {
            //读取App.config文件中的appSettings
            //所有相关组件的配置都写在appSetting中
            var reader = new AppSettingsReader();

            //初始化继电器
            string relay1ComName = (string)reader.GetValue("Relay1ComName", typeof(string));
            byte   relay1Address = (byte)(reader.GetValue("Relay1Address", typeof(byte)));

            Relay1 = new Relay(relay1ComName, relay1Address);
            Relay2 = new Relay((string)reader.GetValue("Relay2ComName", typeof(string)),
                               (byte)reader.GetValue("Relay2Address", typeof(byte)));
            //初始化控制器
            uint baudRate   = (uint)reader.GetValue("BaudRate", typeof(uint));
            uint byteSize   = (uint)reader.GetValue("ByteSize", typeof(uint));
            uint parity     = (uint)reader.GetValue("Parity", typeof(uint));
            uint stopBits   = (uint)reader.GetValue("StopBits", typeof(uint));
            uint motorCOMID = uint.Parse((string)reader.GetValue("COMID", typeof(string)));


            motorController = new MotorController(baudRate, byteSize, parity, stopBits, motorCOMID);
            //motorController.OpenCom();
            //初始化摄像头
            DVRLoginInfo leftLoginInfo = new DVRLoginInfo()
            {
                DVRIPAddress  = (string)reader.GetValue("LeftCamIP", typeof(string)),
                DVRPortNumber = (short)reader.GetValue("LeftCamPort", typeof(short)),
                DVRUserName   = (string)reader.GetValue("LeftCamUsername", typeof(string)),
                DVRPassword   = (string)reader.GetValue("LeftCamPassword", typeof(string))
            };

            DVRLoginInfo rightDvrLoginInfo = new DVRLoginInfo()
            {
                DVRIPAddress  = (string)reader.GetValue("RightCamIP", typeof(string)),
                DVRPortNumber = (short)reader.GetValue("RightCamPort", typeof(short)),
                DVRUserName   = (string)reader.GetValue("RightCamUsername", typeof(string)),
                DVRPassword   = (string)reader.GetValue("RightCamPassword", typeof(string))
            };

            videoCap = new VideoCapture(leftLoginInfo, rightDvrLoginInfo);
            videoCap.Login();
            //中心坐标
            int x = (int)reader.GetValue("X", typeof(int));
            int y = (int)reader.GetValue("Y", typeof(int));

            center = new Point(960, 540);
        }
Beispiel #3
0
 public VideoCapture(DVRLoginInfo leftDvrLoginInfo, DVRLoginInfo rightDvrLoginInfo)
 {
     if (!CHCNetSDK.NET_DVR_Init())
     {
         throw new Exception("NET_DVR_Init error!");
     }
     CamLeft = new Camera(leftDvrLoginInfo.DVRIPAddress, leftDvrLoginInfo.DVRPortNumber,
                          leftDvrLoginInfo.DVRUserName, leftDvrLoginInfo.DVRPassword);
     CamRight = new Camera(rightDvrLoginInfo.DVRIPAddress, rightDvrLoginInfo.DVRPortNumber,
                           rightDvrLoginInfo.DVRUserName, rightDvrLoginInfo.DVRPassword);
     IsPreviewing  = false;
     IsRecording   = false;
     IsPlaybacking = false;
     IsPausing     = false;
     IsDownloading = false;
     PreviewImage  = new Bitmap[2];
 }