Пример #1
0
        /// <summary>
        /// Gets the Exposure Speed value currently being used by the camera.
        /// </summary>
        /// <param name="camera">The camera component.</param>
        /// <returns>The Exposure Speed value.</returns>
        public static int GetExposureSpeed(this MMALCameraComponent camera)
        {
            MMAL_PARAMETER_CAMERA_SETTINGS_T settings = new MMAL_PARAMETER_CAMERA_SETTINGS_T(
                new MMAL_PARAMETER_HEADER_T(MMAL_PARAMETER_CAMERA_SETTINGS, Marshal.SizeOf <MMAL_PARAMETER_CAMERA_SETTINGS_T>()),
                0, new MMAL_RATIONAL_T(0, 0), new MMAL_RATIONAL_T(0, 0),
                new MMAL_RATIONAL_T(0, 0), new MMAL_RATIONAL_T(0, 0), 0);

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

            return(settings.Exposure);
        }
        /// <summary>
        /// Gets the AWB Blue Gain value currently being used by the camera.
        /// </summary>
        /// <param name="camera">The camera component.</param>
        /// <returns>The AWB Blue Gain value.</returns>
        public static double GetAwbBlueGain(this MMALCameraComponent camera)
        {
            MMAL_PARAMETER_CAMERA_SETTINGS_T settings = new MMAL_PARAMETER_CAMERA_SETTINGS_T(
                new MMAL_PARAMETER_HEADER_T(MMAL_PARAMETER_CAMERA_SETTINGS, Marshal.SizeOf <MMAL_PARAMETER_CAMERA_SETTINGS_T>()),
                0, new MMAL_RATIONAL_T(0, 0), new MMAL_RATIONAL_T(0, 0),
                new MMAL_RATIONAL_T(0, 0), new MMAL_RATIONAL_T(0, 0), 0);

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

            return(Convert.ToDouble(settings.AwbBlueGain.Num / settings.AwbBlueGain.Den));
        }