コード例 #1
0
        /// <summary>Sets the downsampling of the image beng processed. A factor of 1 means there is no change in the resolution. A factor of 2 halves the resolution of the axis. This gives you a speed increase and reduces the amount of data sent. Commands like SendFrame and TrackColor will operate at this lower downsampled resolution.</summary>
        public void SetDownSampling(byte xFactor, byte yFactor)
        {
            _c.SendCommand("DS", xFactor, yFactor);
            _stateDownsampleX = xFactor;
            _stateDownsampleY = yFactor;

            VirtualWindow frame = GetVirtualWindow();

            _stateFullFrameSize = new Size(frame.Width, frame.Height);
        }
コード例 #2
0
        /// <summary>Sets the high-resolution mode of the camera. High resolution mode affects almost every coordinate system in the camera (such as tracking).</summary>
        public void SetHighResolution(bool enabled)
        {
            _c.SendCommand("HR", enabled ? 1 : 0);
            _stateHighResolution = enabled;

            ResetViewWindow();

            VirtualWindow frame = GetVirtualWindow();

            _stateFullFrameSize = new Size(frame.Width, frame.Height);
        }
コード例 #3
0
        private void ResetState()
        {
            // Protocol and Serial
            _statePollMode        = false;
            _stateSerialDelay     = 0;
            _statePacketSkipRate  = 0;
            _statePacketFiltering = false;
            _stateLineModeTrack   = 0;
            _stateLineModeMean    = 0;
            _stateLineModeDiff    = 0;
            _stateOutputMask.Clear();
            _stateFrameStreaming = false;

            // Configuration
            _stateFrameBuffer              = false;
            _statePowerMode                = PowerMode.On;
            _stateSlaveCameraType          = CameraType.OV6620;
            _stateHighResolution           = false;
            _stateFrameDifferencingChannel = Channel.Green;
            _stateFrameDifferencingHighRes = false;
            _stateNoiseFilter              = 2;
            _statePixelDifference          = false;
            _stateTrackInverted            = false;
            _stateLed1        = LedMode.Auto;
            _stateLed2        = LedMode.Auto;
            _stateDownsampleX = 1;
            _stateDownsampleY = 1;

            _stateWindow        = GetVirtualWindow();
            _stateFullFrameSize = new Size(_stateWindow.Width, _stateWindow.Height);

            _stateHistogramBins     = HistogramBinCount.Bins28;
            _stateHistogramScale    = 0;
            _stateHistogramTracking = false;

            // Servo
            _stateServoPanFar   = 16;
            _stateServoPanNear  = 8;
            _stateServoPanStep  = 5;
            _stateServoTiltFar  = 16;
            _stateServoTiltNear = 8;
            _stateServoTiltStep = 5;
            for (int i = 0; i < _stateServoHigh.Length; i++)
            {
                _stateServoHigh[i] = false;
            }


            ResetRegistersState();

            ReloadState();
        }
コード例 #4
0
        public VirtualWindow GetVirtualWindow()
        {
            String resp = _c.SendCommandGetResponse("GW");

            String[] components = resp.Split(' ');
            if (components.Length != 4)
            {
                throw new CmuCamException("Expected 4-tuple response");
            }

            Byte x  = Byte.Parse(components[0], Cult.InvariantCulture);
            Byte y  = Byte.Parse(components[1], Cult.InvariantCulture);
            Byte bx = Byte.Parse(components[2], Cult.InvariantCulture);
            Byte by = Byte.Parse(components[3], Cult.InvariantCulture);

            return(_stateWindow = new VirtualWindow(x, y, bx, by));
        }
コード例 #5
0
 /// <summary>Resets the Virtual Window size to that of the full-frame at the current resolution setting.</summary>
 public void ResetViewWindow()
 {
     _c.SendCommand("VW");
     _stateWindow = GetVirtualWindow();
 }
コード例 #6
0
 public void SetVirtualWindow(byte x, byte y, byte bx, byte by)
 {
     _c.SendCommand("VW", x, y, bx, by);
     _stateWindow = new VirtualWindow(x, y, bx, by);
 }