示例#1
0
        static void Main(string[] args)
        {
#if DEBUG
            log.SetLogLevel(log4net.Core.Level.Debug);
#endif

            cam = new CameraTemplate();

            // Test all different parameter types
            // Scalar types
            TestBoolParam();
            TestByteParam();
            TestShortParam();
            TestIntParam();
            TestLongParam();
            TestFloatParam();
            TestDoubleParam();

            // List types
            TestEnumListParam();
            TestFloatListParam();

            // Range types
            TestByteRangeParam();
            TestShortRangeParam();
            TestIntRangeParam();
            TestLongRangeParam();
            TestFloatRangeParam();
            TestDoubleRangeParam();

            // Special Types
            // e.g. Point3f (WhiteBalance)
            TestPoint3fParam();
        }
示例#2
0
        static void Main(string[] args)
        {
            log.SetLogLevel(log4net.Core.Level.Debug);

            SVS cam = new SVS();

            try
            {
                cam.Connect();
            }
            catch (MetriCam2.Exceptions.ConnectionFailedException e)
            {
                log.FatalFormat("Could not connect to camera: {0}", e.Message);
                return;
            }
            log.InfoFormat("Camera connected: {0} (S/N {1})", cam.Name, cam.SerialNumber);

            //log.DebugFormat("activating software trigger (current setting: {0})", cam.AcquisitionMode);
            cam.SetParameter("AutoGain", false);
            //log.DebugFormat("activated software trigger (current setting: {0})", cam.AcquisitionMode);

            cam.SetParameter("Exposure", 5.0f * 1000f);
            log.DebugFormat("exposure: {0}", cam.Exposure);

            log.DebugFormat("activating software trigger (current setting: {0})", cam.AcquisitionMode);
            cam.AcquisitionMode = MetriCam2.Cameras.Internal.SVS.GigeApi.ACQUISITION_MODE.ACQUISITION_MODE_SOFTWARE_TRIGGER;
            log.DebugFormat("activated software trigger (current setting: {0})", cam.AcquisitionMode);

            Console.WriteLine("Press Esc to quit. Press any other key to capture a frame.");
            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key == ConsoleKey.Escape)
                {
                    break;
                }

                cam.Update();
                log.InfoFormat("Updated camera. Frame number is {0}", cam.FrameNumber);
                //cam.CalcChannel()
            }

            cam.Disconnect();
            log.Info("Camera disconnected");
        }
示例#3
0
        static void Main(string[] args)
        {
            log.SetLogLevel(log4net.Core.Level.Info);

            cam = new UEyeCamera(); // Change this type if you want to test your camera implementation.
            List <Camera.ParamDesc> allParameters;

            log.Info("Testing " + cam.Name);

            allParameters = cam.GetParameters();
            log.InfoFormat("Camera {0} has {1} parameter(s):\n{2}", cam.Name, allParameters.Count, Camera.ParamDesc.ToString(allParameters));


            // TEST: setting a writable parameter while disconnected
            if (cam is UEyeCamera)
            {
                TestSetParameterSuccess("TriggerMode", "SOFTWARE");
            }

            // TEST: setting a non-writable parameter while disconnected
            TestSetParameterDisconnected("Gain", 40);

            cam.Connect();

            log.InfoFormat("Connected {0} camera with S/N \"{1}\".", cam.Name, cam.SerialNumber);

            allParameters = cam.GetParameters();
            log.InfoFormat("Camera {0} has {1} parameter(s):\n{2}", cam.Name, allParameters.Count, Camera.ParamDesc.ToString(allParameters));

            if (cam is UEyeCamera)
            {
                // TEST: setting a list parameter to a valid value.
                TestSetParameterSuccess("TriggerMode", "HARDWARE");

                // TEST: setting a list parameter to an invalid value.
                TestSetParameterToInvalid("TriggerMode", "---");
            }

            // TEST: setting a range parameter to a valid value.
            TestSetParameterSuccess("Gain", 40);

            // TEST: setting a range parameter to an invalid value.
            TestSetParameterToInvalid("Gain", 305);

            // TEST: setting an Auto* parameter to a valid value
            TestSetParameterSuccess("AutoGain", true);

            // TEST: setting an Auto* parameter to an invalid value
            TestSetParameterToInvalid("AutoGain", 13);

            Dictionary <string, object> params1 = new Dictionary <string, object>();

            params1["Gain"]     = 40;
            params1["AutoGain"] = true;
            if (cam is UEyeCamera)
            {
                params1["TriggerMode"] = "FREERUN";
            }
            cam.SetParameters(params1);
            List <Camera.ParamDesc> allParameters1 = cam.GetParameters();

            log.InfoFormat("Camera {0} has {1} parameter(s):\n{2}", cam.Name, allParameters1.Count, Camera.ParamDesc.ToString(allParameters1));

            Dictionary <string, object> params2 = new Dictionary <string, object>();

            params2["Gain"]     = 40;
            params2["AutoGain"] = false;
            if (cam is UEyeCamera)
            {
                params2["TriggerMode"] = "FREERUN";
            }
            cam.SetParameters(params2);
            List <Camera.ParamDesc> allParameters2 = cam.GetParameters();

            log.InfoFormat("Camera {0} has {1} parameter(s):\n{2}", cam.Name, allParameters2.Count, Camera.ParamDesc.ToString(allParameters2));

            cam.Disconnect();

            log.Info("Press any key to close.");
            Console.ReadKey();
        }