Beispiel #1
0
        // Zero based device index and device params and output window
        public HotTabCamera(int iDeviceNum, int iWidth, int iHeight, short iBPP, Control hControl)
        {
            DsDevice [] capDevices;

            // Get the collection of video devices
            capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

            if (iDeviceNum + 1 > capDevices.Length)
            {
                throw new Exception("No video capture devices found at that index!");
            }
            try
            {
                DsDevice dev = capDevices[iDeviceNum];

                iDeviceId = CameraDeviceIdCompare(iDeviceNum, dev.DevicePath);

                SetupGraph(dev, iWidth, iHeight, iBPP, hControl); // Set up the capture graph

                SetupProperties(dev, 0, true);                    // Camera Control

                if ((iDeviceId == (int)CameraDeviceIdList.AG3820A11_S1_3ND) || (iDeviceId == (int)CameraDeviceIdList.AV3850A22_SB_4B0) || (iDeviceId == (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_0_RT) || (iDeviceId == (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_0_RT_RIGHT) || (iDeviceId == (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_1_RT) || (iDeviceId == (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_1_RT_RIGHT))
                {
                    FangtecCameraDLL.ALC_Initialization(iDeviceNum, dev.DevicePath);
                    FangtecCameraDLL.ALC_SetDeviceIdx(iDeviceNum);
                }

                m_PictureReady = new ManualResetEvent(false); // tell the callback to ignore new images
            }
            catch
            {
                Dispose(); // throw;
            }
        }
Beispiel #2
0
 public void Flash(byte on)// 1:on, 0:off
 {
     if (on == 0)
     {
         FangtecCameraDLL.Flash(0);
     }
     else
     {
         FangtecCameraDLL.Flash(1);
     }
 }
Beispiel #3
0
        private static int CameraDeviceIdCompare(int iDeviceNum, string szDevicePatch)
        {
            int    iRet           = (int)CameraDeviceIdList.Normal;
            int    iRetTmp        = 0;
            bool   bRet           = false;
            string szStringTmp    = "";
            string sFirstVersion  = "";
            string sSecondVersion = "";
            int    iDate          = 0;

            m_pp = CheckMaxResolution(iDeviceNum);

            // GlobalVariable.DebugMessage("winmate", "max = " + m_pp.X + "x" + m_pp.Y, GlobalVariable.bDebug);

            if (szDevicePatch.IndexOf("vid_058f&pid_3821") != -1)// 2M
            {
                iRetTmp = FangtecCameraDLL.ALC_Initialization(iDeviceNum, szDevicePatch);
                bRet    = FangtecCameraDLL.ALC_SetDeviceIdx(iDeviceNum);

                bRet = FangtecCameraDLL.ALC_GetSensorSettingVersion(out szStringTmp);

                // GlobalVariable.DebugMessage("winmate", "ALC_GetSensorSettingVersion = " + szStringTmp, GlobalVariable.bDebug);// brian add

                if (szStringTmp != "")
                {
                    sFirstVersion  = szStringTmp.Substring(0, 2);
                    sSecondVersion = szStringTmp.Substring(2, 6);

                    if (sFirstVersion == "6L")
                    {
                        iDate = Convert.ToInt32(sSecondVersion);
                        if (iDate >= 121120)
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_1_RT;
                        }
                        else
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND;
                        }
                    }
                    else if (sFirstVersion == "6R")
                    {
                        iDate = Convert.ToInt32(sSecondVersion);
                        if (iDate >= 121120)
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_1_RT_RIGHT;
                        }
                        else
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND;
                        }
                    }
                }

                // bRet = FangtecCameraDLL.ALC_UnInitialization();
            }
            else if ((szDevicePatch.IndexOf("vid_058f&pid_5650") != -1) && (m_pp.X == 2592) && (m_pp.Y == 1944))// 5M
            {
                iRetTmp = FangtecCameraDLL.ALC_Initialization(iDeviceNum, szDevicePatch);
                bRet    = FangtecCameraDLL.ALC_SetDeviceIdx(iDeviceNum);

                bRet = FangtecCameraDLL.ALC_GetSensorSettingVersion(out szStringTmp);

                // GlobalVariable.DebugMessage("winmate", "ALC_GetSensorSettingVersion = " + szStringTmp, GlobalVariable.bDebug);// brian add

                iRet = (int)CameraDeviceIdList.AV3850A22_SB_4B0;

                // bRet = FangtecCameraDLL.ALC_UnInitialization();
            }
            else if (szDevicePatch.IndexOf("vid_058f&pid_5650") != -1)// 2M
            {
                iRetTmp = FangtecCameraDLL.ALC_Initialization(iDeviceNum, szDevicePatch);
                bRet    = FangtecCameraDLL.ALC_SetDeviceIdx(iDeviceNum);

                bRet = FangtecCameraDLL.ALC_GetSensorSettingVersion(out szStringTmp);

                // GlobalVariable.DebugMessage("winmate", "ALC_GetSensorSettingVersion = " + szStringTmp, GlobalVariable.bDebug);// brian add

                if (szStringTmp != "")
                {
                    sFirstVersion  = szStringTmp.Substring(0, 2);
                    sSecondVersion = szStringTmp.Substring(2, 6);

                    if (sFirstVersion == "6L")
                    {
                        iDate = Convert.ToInt32(sSecondVersion);
                        if (iDate >= 121120)
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_1_RT;
                        }
                        else
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_0_RT;
                        }
                    }
                    else if (sFirstVersion == "6R")
                    {
                        iDate = Convert.ToInt32(sSecondVersion);
                        if (iDate >= 121120)
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_1_RT_RIGHT;
                        }
                        else
                        {
                            iRet = (int)CameraDeviceIdList.AG3820A11_S1_3ND_V_1_0_RT_RIGHT;
                        }
                    }
                }

                // bRet = FangtecCameraDLL.ALC_UnInitialization();
            }
            else if (szDevicePatch.IndexOf("vid_058f&pid_3823") != -1)// 5M
            {
                iRet = (int)CameraDeviceIdList.AV5050A22_V_1_0;
            }
            else if (szDevicePatch.IndexOf("vid_1e4e&pid_0109") != -1)// 5M
            {
                iRet = (int)CameraDeviceIdList.DAP7_5M;
            }
            else if (szDevicePatch.IndexOf("vid_2084&pid_0405") != -1)// 7DAP 5M REV01
            {
                iRet = (int)CameraDeviceIdList.DAP7_2084_0405;
            }
            else if (szDevicePatch.IndexOf("vid_058f&pid_3832") != -1)
            {
                iRet = (int)CameraDeviceIdList.AH4220C2_S2_2Z7_V_1_1;
            }


            return(iRet);
        }