Beispiel #1
0
        /// <summary>
        /// the relevant Register 0x12 for the color format will be masked and the _outPutColorFormat is set.
        /// Note that this function do not get refreshed data from the hardware camera. It is just an internal object update class.
        /// To be sure to get the latest status of the camera you need to read the 0x12 register from the camera
        /// </summary>
        public void updateColorFormat()
        {
            Byte ColorFormat = this.getRegisterValue(0x12).getByte();

            ColorFormat = (Byte)(ColorFormat & (Byte)0x05);
            switch (ColorFormat)
            {
            //TODO: add other color formats
            case 0:
                _outPutColorFormat     = EnumColorFormat.YUV;
                _picture.BytesPerPixel = 2;     //TODO: That is wrong, but it is set to 2 to get the Y channel of each Pixel for test Purpose
                break;

            case 1:
                _outPutColorFormat     = EnumColorFormat.BayerRaw;
                _picture.BytesPerPixel = 1;
                break;

            case 4:
                //Since there are different Formats for RGB444, we need to distinguish here more:
                var RgbFormat = this.getRegisterValue(0x40).getByte() & 0x30;    //COM15
                switch (RgbFormat)
                {
                case 16:
                    _outPutColorFormat     = EnumColorFormat.RGB565;
                    _picture.BytesPerPixel = 2;
                    break;

                case 48:
                    _outPutColorFormat     = EnumColorFormat.RGB555;
                    _picture.BytesPerPixel = 2;
                    break;

                default:
                    _outPutColorFormat     = EnumColorFormat.RGB444;
                    _picture.BytesPerPixel = 2;         //TODO: implement the correct function: 1st Pixel has G and R information, 2nd G in B information GRB4:2:2
                    break;
                }
                break;

            case 5:
                _outPutColorFormat     = EnumColorFormat.ProcessedBayerRaw;
                _picture.BytesPerPixel = 3;
                break;

            default:
                _outPutColorFormat = EnumColorFormat.NotSelected;
                break;
            }
            PictureFormatEventArgs eArgs = new PictureFormatEventArgs(_picture.ResolutionX, _picture.ResolutionY, _picture.BytesPerPixel);

            OnPictureFormatChanged(eArgs);
        }
Beispiel #2
0
 /// <summary>
 /// With this function, the colorformat can be set manually without reading the registers.
 /// Caution! This operations should be performed after the registers are read, because the
 /// register read will overwrite it.
 /// </summary>
 /// <param name="_setColorformat"></param>
 public void SetColorFormatManualy(EnumColorFormat _setColorformat)
 {
     _outPutColorFormat = _setColorformat;
 }
Beispiel #3
0
 public PictureRow(int xRes, EnumColorFormat theColorFormat)
 {
     _xRes          = xRes;
     _pixelInserted = 0;
     _myColorFormat = theColorFormat;
 }