Ganesh Ghube Ответов: 0

C#: как установить экспозицию веб-камеры в качестве автоматической после изменения настроек?


I am able to set the Exposure manually using below code(cap.Exposure = -5;) and I want to set the Exposure as an Auto from my application after below function closed/terminated. Because Exposure is reflecting for all Camera applications after closed below project. Thanks in advance.


Что я уже пробовал:

using OpenCvSharp;
public void StartCamera()
{
VideoCapture cap = new VideoCapture(0);
cap.Set(3, 1920);
cap.Set(4, 1080);
cap.Exposure = -5;
using (Mat image = new Mat())
{
    try
    {
        while (true)
        {
            cap.Read(image);
            if (image.Empty())
                break;
            var img = image.Clone();
            Bitmap bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(img);
            BitmapImage bitmapImageObjSnapShot;
            bitmapImageObjSnapShot = bitmap.ToBitmapImage();
            videoPlayerImage.Source = bitmapImageObjSnapShot;
            img.Release();
        }
    }
    catch (Exception Ex)
    {

    }
}
cap.Release();
}

0 Ответов