I am using Opencvsharp from shimat for building an application. Code simply opens camera, saves the image and close it using below code.
using OpenCvSharp;
VideoCapture capture;
Mat frame;
private void btn_Camera_Click(object sender, EventArgs e)
{
capture = new VideoCapture();
frame = new Mat();
capture.Open(1);
capture.Read(frame);
if (capture.Read(frame))
{
frame.SaveImage("@test.jpg");
}
capture.Release();
}
However the picture is saved at 640x480 resolution whereas the camera is capable of capturing 1280x720 resolution pictures.
I tried setting the VideoCapture properties like below
capture.Set(VideoCaptureProperties.FrameHeight, 720);
capture.Set(VideoCaptureProperties.FrameWidth, 1280);
But still the saved image is of 480p resolution. Is there a way to save it at 720p resolution, like the default windows camera app does.
Also I don't want to save it in 480p and then resize to 720p as that doesn't help in getting the details that needs to captured.
I know in opencv Python its possible. Am looking for something similar in C# with Opencvsharp4