-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Parsing any Rectangle array causes assertion #114
Comments
Easier way of testing:
It thinks that two elements with all zeroes were passed in array: [ (0, 0)/0x0, (0, 0)/0x0 ] ->>> The problem is in libcamera_parse_control_value() which splits by "," (even for values inside brackets) causing libcamera_parse_rectangle() to be called twice, one for (0 and then again for 0)/4608x2592 |
I arrived here from Octoprint (new camera stack) and was impressed as my camera was detected out of the box by camera-streamer. Recently, I started to tweak camera settings and stumbled across similar issues. Setup
What workslibcamera-still with crop and autofocus-window
And the image is indeed cropped. Interestingly, the image has full sensor resolution but the visible image is clearly cropped as desired. Regarding camera-streamer with crop ARunning the camera-stream.service and setting This is also seen in the logs: Setting anything else after this, without restarting the service, does not change anything. Only when I restart the service, I get back to the full video. What does not workcamera-streamer with crop BSetting any other pixel values in the webUI, e.g. log: camera-streamer with AfWindowsSetting this in the GUI or as If I can help sorting this out, let me know. I am willing to test drafts or provide more logs if desired. |
Why it is happening is known, see: That code simply needs to be fixed to parse correctly. |
Hmm, somehow I read this but didn't fully understand. Now I see, thank you. I am already trying to pull the repo and see if I can compile it. If yes, maybe I can come up with a fix. |
I thin I found the issue: camera-streamer/device/libcamera/options.cc Lines 427 to 430 in 54bdd9d
calls camera-streamer/device/libcamera/options.cc Lines 357 to 372 in 54bdd9d
and calls
So either Unfortunately, I cannot test it properly. While I can compile
|
It does it for other parameters that need such split. You need to kind of walk character by character and if you encounter "(" stop splitting by "," until ")" is closed (also not sure if there are multiple () inside other () allowed or not). Or alternative for that. |
Hmm, as So an easy fix would be:
But I don't know if this might have any other implications. |
I've tried out the suggestion from @maximweb. It'll parse a rectangle fine, including using the I'm not familiar with C++ grammar, but it looks like there ought to be a simple fix based on @maximweb's suggestion with a tweak or two. |
Last time I tried to test some local changes, I encountered error messages I did not understand. At least the error message looks identical to the recently merged #140 . So I might take another look in the next couple of days. @grunkyb How do you know it passed fine and how do you know windowing failed? What exactly did you test? |
@maximweb This is what I should have included in my previous post. I'm running this as part of octopi/octoprint, so I have two instances of camera-streamer running, the pre-installed version (v0.25) in Case 1: no array set in options for Output from
But using the web control interface at http://octopi.local/webcam/control gives this error in the unit output in the log:
I read the line before the service restarts as libcamera expecting an array, not getting one, then killing the process. Case 2: array set in options for This time, it doesn't recognise the rectangle and passes a single-value null array.
The result is the same, not an array, process dies.
Commenting out those options makes the camera work fine again, but without a specified set of AfWindows. The pieces seem to be in place in the code here: there's facility to parse arrays and a Rectangle template, but I haven't worked out how to get them to play nicely together. |
I retested with the latest fix in So I did the same as suggested earlier, replacing the following camera-streamer/device/libcamera/options.cc Lines 427 to 430 in 6deb9c5
with
And it seems to work when running (sorry, no time to reduce the command to the bare minimum required to test this):
The
but my video is clearly cropped. Unfortunately, I have to attend to other things for now, but here are some thoughts: |
Ok, looking at how So instead, we could construct a So the following quick-and-dirty replacement does not throw any errors:
using I have not tested, though, if it actually works as desired. PS: In the meantime I found a source providing at least some information on the |
/control web interface has an option:
which is supposed to take a single entry or array of windows (I would assume an array) of
(A,B)/ZxQ
"windows" (where A,B are raw pixel coordinates of beginning of the window, Z is width, Q is height in raw pixels).When trying to use
there camera streamer fails with assert
Not I'm not sure if I'm specifying it in wrong way or if that's a bug in parsing?
Trying to repeat similar scenario with libcamera-still it seems to work there:
(my sensor is 4608x2592 from rpi v3 camera; --autofocus-window internally recalculates that using specified 0.N coefficients and sensor size)
Testing done on:
The text was updated successfully, but these errors were encountered: