-
Notifications
You must be signed in to change notification settings - Fork 38
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
RPi Camera v2: Cropped image at low resolution #99
Comments
I don't fully understand what you want to do. If you just want to get a lower resolution from the camera, why aren't you setting that resolution via the parameters? The default selected pixel format and resolution depends on the selected stream mode. But you can change these things via ROS parameters. |
The problem is visualized in the PiCamera page: If I ask for 640x480 using the normal parameters I get a cropped image (the smallest box in the middle); I obviously want the entire picture, just scaled down. |
I see, you mean cropping within the same aspect ratio. Indeed, some stream formats will use the same sensor configuration, while other formats with the same aspect ratio will use a different sensor configuration. E.g.
while
But this is managed by the IPAs in libcamera and the ROS node has no control over this. You will get the same for the libcamera examples:
You can inspect the "raw" sensor configurations by setting the role to "raw":
So here you see that any of the stream roles formats map to one of these three (for the Camera Module 3) raw formats. I don't know how much control a user has over this. You better ask for support on this with the libcamera developers. If it is possible to further control this manually, e.g. how many pixels should be binned together, I would add this to the documentation of the repo. What you can always do, is, as you suggested, to manually downscale the larger image with the larger FoV. But I don't think this is something the camera node should do. You can write your own composable "downscaling" node or just reuse |
Thank you for the input; I will investigate a bit more; looking at the RPi software there seems to be a mode switch. (https://www.raspberrypi.com/documentation/computers/camera_software.html). I need to install Raspberry Pi OS to see how it works; the ros-humble-libcamera is old. |
you can get a hint from my repo's commits |
@Woojin-Crive great! Thank you. I expect this one to solve the problem: It does not seem like |
@christianrauch I sent the PR for review, more as an initial draft review, as documentation etc. would also have to be discussed. |
I am trying to use camera_ros to get a full FoV picture at a low resolution (640x480 or even 160x120) on Raspberry Pi 4, using the Camera Module v2, on Ubuntu 22.04/24.04.
Using the old legacy camera support then 640x480 was the default, but with libcamera (and hence camera_ros) it picks a sensor mode that leads to cropping, rather than scaling down.
Is there a way to get the sensor input for the lowest full FoV resolution (1640x1232), but then use the GPU to scale it to the desired lower resolution to avoid 'overloading' the ROS nodes having to serialize/deserialize the larger image?
Reference:
https://picamera.readthedocs.io/en/release-1.13/fov.html#sensor-modes
The text was updated successfully, but these errors were encountered: