I have this usb camera. I want to cature video at a high framerate. The manufacturer states that the camera is able to do 180 FSP @ resolution 640x480. I did check this and the camera indeed works (hardware is okay; check including usb and PC).
My problem is, that I can't successfully setup the camera to the needed settings. I use EmguCV.
private void FrmMain_Load(object sender, EventArgs e)
{
// Initialize the VideoCapture object for webcam (default camera index)
capture = new VideoCapture(0);
// Check if the capture object is opened successfully
if (!capture.IsOpened)
{
MessageBox.Show("Failed to open webcam!");
return;
}
//manufacturer specs.
//1280x720 MJPG @90fps -> yes I get video @90 fps
//960x540 MJPG @90fps -> no video -- I read out FPS=1
//640x480 MJPG @180fps -> no video -- I read out FPS=1
//640x360 MJPG @180fps -> no video -- I read out FPS=1
//424x240 MJPG @180fps -> no video -- I read out FPS=1
//320x240 MJPG @180fps -> yes I get video BUT @30fps
//320x180 MJPG @180fps -> yes I get video BUT @30fps
//capture.Set(CapProp.FourCC, fourcc); // is equal to => 1196444237
var fourcc = Convert.ToDouble(VideoWriter.Fourcc('M', 'J', 'P', 'G'));
capture.Set(CapProp.FrameWidth, 640);
capture.Set(CapProp.FrameHeight, 360);
capture.Set(CapProp.Fps, Convert.ToDouble(180));
capture.Set(CapProp.FourCC, fourcc);
RtxbxShow.Text += $"Camera is ready!\n";
RtxbxShow.Text += $"Set in cam FPS: {capture.Get(CapProp.Fps)}\n";
RtxbxShow.Text += $"Set in cam Width: {capture.Get(CapProp.FrameWidth)}\n";
RtxbxShow.Text += $"Set in cam Height: {capture.Get(CapProp.FrameHeight)}\n";
}
I set the propertys like this and then right after that I read out the propertys. In the comments you can see what I read out. For my desired setting of 640x480 @180 fps. I get back FPS of 1. Funny enough the 90Fps setting works. But I need 180Fps any ideas?
EDIT: I could read out the settings from the camera with ffmpeg. And I could record a video with this: .\ffmpeg.exe -f dshow -video_size 640x480 -framerate 180 -i video="USB 2M GS camera" output.mp4
SOLUTION:
I got it to work. I changed the code from original post in one line.
From:
capture = new VideoCapture(0);
To:
capture = new VideoCapture(0, VideoCapture.API.DShow);
To set the capture to a specific backend (DShow). I left it the whole time on auto. But that didn't do it.
Thx