libcamerasrc and formats?
Florian Echtler
floe at butterbrot.org
Fri Mar 17 09:21:00 UTC 2023
Thank you - turns out it's rather hard to build libcamera on the target device,
which is a Raspberry Pi Zero. I'll test with another Raspi ASAP.
Best, Florian
On 15.03.23 19:13, Nicolas Dufresne wrote:
> Hi,
>
> Le mercredi 15 mars 2023 à 17:24 +0100, Florian Echtler via gstreamer-devel a
> écrit :
>> Hello everyone,
>>
>> I'm experimenting with a Raspberry Pi camera and would like to process the
>> frames with OpenCV. Apparently, the "modern" way of doing so is through
>> libcamera, and for OpenCV, this means using a GStreamer pipeline with libcamerasrc.
>>
>> For efficiency reasons, I'd like to get a grayscale image directly from the
>> camera to avoid unneeded conversions; so I used the following pipeline:
>>
>> libcamerasrc !
>> video/x-raw,width=(int)640,height=(int)480,framerate=(fraction)30/1,format=GRAY
>> ! appsink
>>
>> "GRAY" is listed as a supported format for the camera in the Video4Linux device,
>> but I don't get a working pipeline when I try that. If I leave out the format
>> parameter, then I'm getting NV12 (or I can pick something generic like RGB). How
>> can I see which formats I can actually get out of libcamerasrc and the sensor?
>
> Any chance you can give this patch a try ? I'll post it to the libcamera project
> if you can confirm its working. Note that libcamerasrc is entirely developed as
> part of libcamera project.
>
> ---
> commit abf017f5c0f547ceaa863e658f22af9f547a863d (HEAD -> logger-crash)
> Author: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> Date: Wed Mar 15 14:10:08 2023 -0400
>
> gstreamer: Map R8 pixel format
>
> This enables monochrome 8bit to be supported in libcamerasrc.
>
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
>
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-
> utils.cpp
> index 750ec351..f1e34b60 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -26,6 +26,9 @@ static struct {
> { GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },
> { GST_VIDEO_FORMAT_ENCODED, formats::SRGGB8 },
>
> + /* Monochrome */
> + { GST_VIDEO_FORMAT_GRAY8, formats::R8 },
> +
> /* RGB16 */
> { GST_VIDEO_FORMAT_RGB16, formats::RGB565 },
>
>
>
>
--
SENT FROM MY DEC VT50 TERMINAL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230317/b8110950/attachment.sig>
More information about the gstreamer-devel
mailing list