-
Notifications
You must be signed in to change notification settings - Fork 195
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
Can't change raw resolution in Bookworm #839
Comments
A short test program which shows the issue is the following code:
With the global flag |
That bug is still there today, after upgrading the RP3 to the latest version of Bookworm, that is, with picamera2 version 0.3.14. With
with the selected sensor format as requested, namely But with
One way to circumvent this is to start always with a new base config. In this case however, all the other parameters of a config need to be buffered externally and set again for each mode switch. There are use cases where the selected |
Hi, thanks for reporting this. Would it be possible to submit a test script in the form
as that would make it easy to see the problem and saves me from having to understand longer bits of code. I should add that there have been changes in libcamera as to how configuration happens. The way we used the raw stream to force the sensor configuration was regarded as a bit of a "bodge", and so you now have to configure the sensor directly. Picamera2 will normally figure out the sensor configuration from the raw stream that you specify, so as to maintain backward compatibility. But it's possible you're falling into a difference in the new way of doing things. As I said in the forum post, there is updated documentation coming but unfortunately that's a bit of a 1000-mile journey at the moment. I also said I'd try and post some abbreviated guidance shortly, and I am trying to get back to that. In the meantime, anything that makes test cases really easy to follow is a big help. Thanks! |
Thanks for your attention. I have prepared a small python script to highlight the problem:
Look at the output of the first configuration. Both the size of the main stream and the raw stream are correct at the resolution of 2028 x 1520 px After the second resolution change, the resolution of the main stream has changed, which is correct at 4056 x 3040 px, but the resolution of the raw stream has not changed, which remains at 2028 x 1520 px. Script output results:
In previous versions of picamera2 the resolution change worked normally. Regards |
Hi, thanks for the simple test case, that's very helpful. There have indeed been some changes in how libcamera configures the sensor, and I talk about this a bit in the release notes on the forum. Mostly I've tried to hide the change from users, but I haven't done it properly for people using the I'll fix this shortly, but for now the best workaround is to put
at the top when you start changing the configuration. Once I have fixed the code, the correct procedure will be to do
instead of
(you can do both, though setting |
Hi @davidplowman, Thank you very much for your attention and your kind response. I hope it doesn't take you too much work to modify the code. Best regards |
I have a very similar problem while trying to flip the image, and the posted workaround fixes the issue. I hope that since the solution is the same that means the necessary code changes are the same!
output:
However after capturing an image it is not flipped, even though the 'transform' member in the output would indicate otherwise. Applying the workaround in this thread and adding the line
results in a properly flipped image. I am thankful that @Manuel-Angel-Es opened this issue and that @davidplowman posted the workaround! Thanks everyone, hope this issue can be fixed soon. |
@cdcformatc There has been some stuff in libcamera to do with transforms that got broken. I think maybe this release might be the first one to pick up that broken stuff even though it happened quite some time ago? I think it might be principally the reporting that's got messed up, libcamera is confused about what rotation it reports back to us. I believe it to be fixed in mainline libcamera now, but unfortunately those fixes break Picamera2 so there's some integration work to do. Sigh. I'll look into it, but maybe let's not discuss it in this issue as it is not the same thing. Thanks! |
Back to the original problem, the proposed fix is here: #850 |
Discussed in #838
Originally posted by Manuel-Angel-Es October 29, 2023
I recently installed Raspberry Pi Os Bookworm on my RPi4.
I use picamera2 on a Super8 film scanner. With the scanner software it is possible to capture jpg and raw-dng images.
With the Bullseye version, picamera2 worked correctly, as I expected. However, with Bookworm I run into an unexpected problem:
I perform an initial configuration of the camera without problems, but when I try to change the capture resolution, only the resolution of the main stream changes, but not the resolution of the raw stream, which always remains constant. I would appreciate any suggestions to solve the problem.
This is picamera2's response after initially setting the camera to the resolution of 4056x3040 px:
2023-10-29 10:14:23 - INFO - Camera configuration has been adjusted!
[1:24:52.478260604] [71189] INFO Camera camera.cpp:1213 configuring streams: (0) 4056x3040-RGB888 (1) 4056x3040-SGRBG12_CSI2P
[1:24:52.478806762] [71204] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SGRBG12_1X12 - Selected unicam format: 4056x3040-pgCC
2023-10-29 10:14:23 - INFO - Configuration successful!
And below is picamera2's response after changing to the 2028x1520 px resolution:
2023-10-29 10:16:04 - INFO - Camera configuration has been adjusted!
[1:26:33.414200192] [71207] INFO Camera camera.cpp:1213 configuring streams: (0) 2028x1520-RGB888 (1) 4056x3040-SGRBG12_CSI2P
[1:26:33.453206976] [71204] INFO RPI vc4.cpp:549 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SGRBG12_1X12 - Selected unicam format: 4056x3040-pgCC
2023-10-29 10:16:04 - INFO - Configuration successful!
The following is the code used that worked correctly in Bullseye but does not work in Bookworm. The change in resolution is made by calling the setSize(self, idx) function. With idx = 0 2028x1520 px is selected, with idx = 1 4056x3040 px is selected:
from picamera2 import Picamera2, Metadata
from time import sleep
from logging import info
class DS8Camera():
off = 0
previewing = 1
capturing = 2
The text was updated successfully, but these errors were encountered: