muth
Posts: 21
Joined: Sun Aug 05, 2012 3:32 pm

MMAL encodings or effects

Wed May 20, 2015 9:40 am

Hello,
I'm digging a bit the codes involved with the camera module. I'd like to get a monochrome video stream and made some trial by modifying raspivid. It is possible to get the raw YUV, even RGB. But for optimization, I wondering if it is possible get directly only one byte per pixel with camera parameters such as :
MMAL_ENCODING_MONO8 MMAL_FOURCC('Y','8','0','0')

Is some one knows which 'fourCC' codes are actually supported ?

I have some difficulties as well to find where are implemented the "effects" on the videos, such as 'oilpaint' 'negative' or 'gpen', is it accessible ?

Thanks a lot !

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5128
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: MMAL encodings or effects

Wed May 20, 2015 10:14 am

Look at https://github.com/raspberrypi/userland ... piVidYUV.c
That is selecting MMAL_ENCODING_I420 - http://www.fourcc.org/yuv.php#IYUV
They comprise an NxN Y plane followed by (N/2)x(N/2) U and V planes.
The Y (luma) plane is exactly what you want for mono. Just ignore the chroma bytes.

If you want RGB, then change the encoding to MMAL_ENCODING_[BGR24|RGB24|RGB565|RGBA|BGRA] for the various flavours of RGB.

Want to know the supported formats on any port of any component? mmal_port_parameter_get for MMAL_PARAMETER_SUPPORTED_ENCODINGS (you need to construct a parameter structure that contains sufficient array entries for the result - I thought there was a utility function that did that for you, but I can't see it)

All image effects are implemented on the closed source GPU.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

muth
Posts: 21
Joined: Sun Aug 05, 2012 3:32 pm

Re: MMAL encodings or effects

Wed May 20, 2015 1:02 pm

Wow, that was a short delay answer, thank you very much !

You're perfectly right, Luma channel is exactly the monochrome component. I asked in case we can make economy of some streamed bytes.
That is now pretty clear for the effects, I ignored it is closed source.

tl;dr :
What I'm trying to achieved is to generate on the fly a pure monochrome (1bit per pixel) image with the error diffusion Floyd–Steinberg dithering method.

Thanks again, have a nice day !

jeffthompson
Posts: 1
Joined: Mon May 21, 2018 6:49 pm

Re: MMAL encodings or effects

Mon May 21, 2018 6:50 pm

@muth – did you get that working? Strangely, I need exactly what you mentioned below re realtime dithering!

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 8 guests