-
Notifications
You must be signed in to change notification settings - Fork 10
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not capturing an Image #1
Comments
I went so far as to loop through every possible format and resolution, but no results.
|
Hey @Krutonium, have you found a solution yet? I'm currently debating between OpenCV.Net and V4L2. I rather would use V4L2 because it has almost no dependency to anything. And OpenCV is also just using V4L2 at the end. I took this day to look into the Issue and found an explanation. The native calls mostly fail silently and are not handled. The calls are failing because the library is using invalid ioctl arguments. First of all, thanks for your library. It is exactly what I need. Let's make it work for all of us :) The VideoSettings enum that contains all arguments seem to be dependent on platform, architecture, and maybe other factors. These arguments are not constant/static! The enum is defining VIDIOC_S_FMT = -1060350459, however its -1060088315 on my system. This results in "argument invalid" errors. What you did a few lines deeper inside RawVideoSettings is a good approach, this is exactly how V4L2 is doing it. However, some structs like v4l2_buffer, v4l2_format differ from the C headers. Other structs are fine, so the approach is correct. Therefore sizeof(struct v4l2_format) in C is not equal to Marshal.SizeOf<v4l2_format>(); in C# Resulting again in wrong numbers. For a quick test I have created a stub with a fixed size of 208 (like in C)
That does seem to work, it calculates the same ioctl number like in C. By using these numbers the ioctl calls seem to exit successfully, resulting in a clear image :) I think the cleanest way to make it work is to remove the VideoSettings enum, fix all non matching v4l2 structures, use your already existing _IOR/_IORW functions to calculate the right argument values, and make more use of the capability response to check if certain calls are even possible. |
I have not. |
Okay. So this is a working example, at least for me. You can try it out. https://github.com/lmoe/v4l2.net Still WIP and requires some clean up. |
Hi, @Krutonium, I was digging down to how V4L2 works, and noticed that there is To test it out, debug through |
So to begin with, here is my code:
The problem I am having is that I cannot get it to capture an image - Writing it to disk directly with the built in writes a 0 byte file, and the MemoryStream is always empty. I know that it does at least get as far as turning on the webcam, because it does manage to do that. It just never captures an image.
Any ideas?
The text was updated successfully, but these errors were encountered: