예제 #1
0
 public virtual void OnPictureFormatChanged(PictureFormatEventArgs e)
 {
     if (PictureFormatChanged != null)
     {
         PictureFormatChanged(this, e);
     }
 }
예제 #2
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);
        }
예제 #3
0
        //Sync methods
        /// <summary>
        /// the relevant Register of the Registerlist 0x12 will be masked and the _ouPutResolutionFormat 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 UpdateOutputFormat()
        {
            Byte ColorFormat = this.getRegisterValue(0x12).getByte();

            ColorFormat = (Byte)(ColorFormat & (Byte)0x38);
            switch (ColorFormat)
            {
            case 0:
                _outPutResolutionFormat = EnumResolutionFormat.VGA;
                _picture.ResolutionX    = 640;
                _picture.ResolutionY    = 480;
                break;

            //TODO: add other resolutions
            case 8:
                _outPutResolutionFormat = EnumResolutionFormat.QCIF;
                _picture.ResolutionX    = 176;
                _picture.ResolutionY    = 144;
                break;

            case 16:
                _outPutResolutionFormat = EnumResolutionFormat.QVGA;
                _picture.ResolutionX    = 313;
                _picture.ResolutionY    = 240;
                break;

            case 32:
                _outPutResolutionFormat = EnumResolutionFormat.CIF;
                _picture.ResolutionX    = 352;
                _picture.ResolutionY    = 288;
                break;

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

            OnPictureFormatChanged(eArgs);
        }