Esempio n. 1
0
        /// <summary>
        /// Initializes the camera driver
        /// </summary>
        /// <param name="cameraIndex">If only one Point Grey camera is connected, then use '0'. 
        /// If more than one Point Grey cameras connected, then use between '0' and 'number of 
        /// Point Grey cameras connected - 1'</param>
        /// <param name="frameRate">The frame rate you desire</param>
        /// <param name="videoMode"></param>
        /// <param name="grayscale"></param>
        unsafe public void Initialize(int cameraIndex, PGRFlyModule.FlyCaptureFrameRate frameRate, 
            PGRFlyModule.FlyCaptureVideoMode videoMode, bool grayscale)
        {
            this.cameraIndex = cameraIndex;

            int flycapContext;
            int ret;
            // Create the context.
            ret = PGRFlyDllBridge.flycaptureCreateContext(&flycapContext);
            if (ret != 0)
                ReportError(ret, "flycaptureCreateContext");

            // Initialize the camera.
            ret = PGRFlyDllBridge.flycaptureInitialize(flycapContext, cameraIndex);
            if (ret != 0)
                ReportError(ret, "flycaptureInitialize");

            // Get the info for this camera.
            ret = PGRFlyDllBridge.flycaptureGetCameraInformation(flycapContext, ref flycapInfo);
            if (ret != 0)
                ReportError(ret, "flycaptureGetCameraInformation");

            if (flycapInfo.CameraType ==
                PGRFlyModule.FlyCaptureCameraType.FLYCAPTURE_BLACK_AND_WHITE && !grayscale)
                throw new GoblinException("This Point Grey camera is B&W, so you need to initialize " +
                    "the video capture device with grayscale");

            cameraType = flycapInfo.CameraType;
            cameraModel = flycapInfo.CameraModel;

            // Start FlyCapture.
            /*if (cameraModel == PGRFlyModule.FlyCaptureCameraModel.FLYCAPTURE_DRAGONFLY2)
                ret = PGRFlyDllBridge.flycaptureStart(flycapContext, 
                    PGRFlyModule.FlyCaptureVideoMode.FLYCAPTURE_VIDEOMODE_640x480RGB, frameRate);
            else*/
                ret = PGRFlyDllBridge.flycaptureStart(flycapContext, videoMode, frameRate);
            
            if (ret != 0)
                ReportError(ret, "flycaptureStart");

            this.flycapContext = flycapContext;
        }
Esempio n. 2
0
 unsafe public static extern int flycaptureSaveImage(int flycapContext,
     ref PGRFlyModule.FlyCaptureImage image, string filename,
     PGRFlyModule.FlyCaptureImageFileFormat fileFormat);
Esempio n. 3
0
 unsafe public static extern int flycaptureGrabImage2(int flycapContext,
     ref PGRFlyModule.FlyCaptureImage image);
Esempio n. 4
0
 public static extern int flycaptureGetCameraInformation(int flycapContext,
     ref PGRFlyModule.FlyCaptureInfo arInfo);
Esempio n. 5
0
 public static extern int flycaptureStart(int flycapcontext,
     PGRFlyModule.FlyCaptureVideoMode videoMode,
     PGRFlyModule.FlyCaptureFrameRate frameRate);
Esempio n. 6
0
 public static extern int flycaptureConvertImage(int flycapContext,
     ref PGRFlyModule.FlyCaptureImage image, ref PGRFlyModule.FlyCaptureImage imageConvert);