예제 #1
0
        public void RgbtoYuvBytes()
        {
            var yuvBytes     = MMALColor.RGBToYUVBytes(Color.Blue);
            var fromYuvBytes = MMALColor.FromYUVBytes(yuvBytes.Item1, yuvBytes.Item2, yuvBytes.Item3);

            Assert.True(fromYuvBytes.R == Color.Blue.R && fromYuvBytes.G == Color.Blue.G && fromYuvBytes.B == Color.Blue.B);
        }
예제 #2
0
        public void FromYuv()
        {
            var fromYuvBytes = MMALColor.FromYUVBytes(0, 20, 20);
            var rgbToYuv     = MMALColor.RGBToYUV(fromYuvBytes);
            var fromYuv      = MMALColor.FromYUV(rgbToYuv.Item1, rgbToYuv.Item2, rgbToYuv.Item3);

            Assert.True(fromYuv.Equals(fromYuvBytes));
        }
예제 #3
0
        /// <summary>
        /// Gets the <see cref="Color"/> structure that will be used as a background when displaying information using the annotate feature.
        /// </summary>
        /// <param name="camera">The camera component.</param>
        /// <returns>The <see cref="Color"/> structure.</returns>
        public static Color GetBackgroundColourAnnotateSettings(this MMALCameraComponent camera)
        {
            MMAL_PARAMETER_CAMERA_ANNOTATE_V3_T annotate = new MMAL_PARAMETER_CAMERA_ANNOTATE_V3_T(
                new MMAL_PARAMETER_HEADER_T(MMAL_PARAMETER_ANNOTATE, Marshal.SizeOf <MMAL_PARAMETER_CAMERA_ANNOTATE_V3_T>()),
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null);

            MMALCheck(MMALPort.mmal_port_parameter_get(camera.Control.Ptr, &annotate.Hdr), "Unable to get camera annotate settings");

            return(MMALColor.FromYUVBytes(annotate.CustomBackgroundY, annotate.CustomBackgroundU, annotate.CustomBackgroundV));
        }
예제 #4
0
        /// <summary>
        /// Gets the Colour Effects value currently being used by the camera.
        /// </summary>
        /// <param name="camera">The camera component.</param>
        /// <returns>The Colour Effects value.</returns>
        public static ColourEffects GetColourFx(this MMALCameraComponent camera)
        {
            MMAL_PARAMETER_COLOURFX_T colFx = new MMAL_PARAMETER_COLOURFX_T(
                new MMAL_PARAMETER_HEADER_T(MMAL_PARAMETER_COLOUR_EFFECT, Marshal.SizeOf <MMAL_PARAMETER_COLOURFX_T>()),
                0,
                0,
                0);

            MMALCheck(MMALPort.mmal_port_parameter_get(camera.Control.Ptr, &colFx.Hdr), "Unable to get colour fx");

            ColourEffects fx = new ColourEffects(colFx.Enable == 1, MMALColor.FromYUVBytes(0, (byte)colFx.U, (byte)colFx.V));

            return(fx);
        }
예제 #5
0
        public void SetThenGetColourFx(bool enable, byte u, byte v)
        {
            var color = MMALColor.FromYUVBytes(0, u, v);

            var colFx = new ColourEffects(enable, color);

            MMALCameraConfig.ColourFx = colFx;
            Fixture.MMALCamera.ConfigureCameraSettings();

            var uv = MMALColor.RGBToYUVBytes(Fixture.MMALCamera.Camera.GetColourFx().Color);

            Assert.True(Fixture.MMALCamera.Camera.GetColourFx().Enable == enable &&
                        uv.Item2 == u &&
                        uv.Item3 == v);
        }