public string GetCurrentImageFormat()
 {
     res = pCamera.getImageFormat(ref FeatureState, ref TypeListINT);
     res = pCamera.getImageFormatDescription(TypeListINT.current, ref CameraImageFormat);
     return(CameraImageFormat.sName);
 }
예제 #2
0
        /// <summary>
        /// Camera 초기화 진행함
        /// </summary>
        /// <param 카메라 번호="iCamNo"></param>
        /// <param 상위 GigE System="pSystem"></param>
        /// <returns></returns>
        public int Initialize(int iCamNo, BGAPI.System pSystem)
        {
            m_iCamID = iCamNo;
            // System 을 받아옴.
            m_CamSystem = pSystem;

            m_CamDeviceInfo = new BGAPI.BGAPIX_CameraInfo();
            m_CamImage      = new BGAPI.Image();

            // create camera
            m_iResult = m_CamSystem.createCamera(iCamNo, ref m_Camera);
            if (m_iResult != BGAPI.Result.OK)
            {
                //"System create camera failed!"
                return(GenerateErrorCode(ERR_VISION_CAMERA_CREATE_FAIL));
            }

            // get camera device information
            m_iResult = m_Camera.getDeviceInformation(ref m_CamState, ref m_CamDeviceInfo);
            m_cCameraData.m_CamDeviceInfo = m_CamDeviceInfo;
            if (m_iResult != BGAPI.Result.OK)
            {   // "Camera get Device Information failed!"
                return(GenerateErrorCode(ERR_VISION_CAMERA_GET_INFO_FAIL));
            }

            // get camera Image information
            m_iResult = m_Camera.getImageFormatDescription(1, ref m_CamImageInfo);

            if (m_iResult != BGAPI.Result.OK)
            {   // "Camera get Device Information failed!"
                return(GenerateErrorCode(ERR_VISION_CAMERA_GET_INFO_FAIL));
            }
            else
            {
                // Camera Pixel Size을 적용한다.
                m_CamPixelSize.Width  = (int)(m_CamImageInfo.iScaleRoiX * m_CamImageInfo.iSizeX);
                m_CamPixelSize.Height = (int)(m_CamImageInfo.iScaleRoiY * m_CamImageInfo.iSizeY);
            }

            // camera open
            m_iResult = m_Camera.open();
            if (m_iResult != BGAPI.Result.OK)
            {   //"Camera open failed!"
                return(GenerateErrorCode(ERR_VISION_CAMERA_CONNECT_FAIL));
            }

            // image create
            m_iResult = BGAPI.EntryPoint.createImage(ref m_CamImage);
            if (m_iResult != BGAPI.Result.OK)
            {   // Create Image failed
                return(GenerateErrorCode(ERR_VISION_CAMERA_CREATE_IMAGE_FAIL));
            }

            // camera & image connect
            m_iResult = m_Camera.setImage(ref m_CamImage);
            if (m_iResult != BGAPI.Result.OK)
            {   // Camera set Image failed!
                return(GenerateErrorCode(ERR_VISION_CAMERA_GET_IMAGE_FAIL));
            }

            // System Init 결과 저장
            m_iResult = SUCCESS;

            return(SUCCESS);
        }