Max pixel value always less than 255
Is it just me or anyone else have this weird problem that the maximum pixel value of an image taken by pi camera (mine is NoIR v2) is always less than 255, even though the image is clearly saturated?
Re: Max pixel value always less than 255
255 is the largest value an 8 bit byte can hold (2^8 = 256, so 0 - 255 is the full rage of those 256 possible values) so saturation is 255.
-
- Posts: 663
- Joined: Wed Oct 02, 2013 12:28 pm
Re: Max pixel value always less than 255
It also depends on the standard used. If you look for example at BT.709 under Digital representation it says white is defined as RGB=(235,235,235) and black as RGB=(16,16,16).
Re: Max pixel value always less than 255
That might be it. The largest pixel value I find is 234. How to change it?ethanol100 wrote: ↑Thu Mar 08, 2018 7:40 pmIt also depends on the standard used. If you look for example at BT.709 under Digital representation it says white is defined as RGB=(235,235,235) and black as RGB=(16,16,16).
-
- Posts: 663
- Joined: Wed Oct 02, 2013 12:28 pm
Re: Max pixel value always less than 255
I don't know if you can change it. I fear it is part of the way how the image data is processed on the ISP.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 10587
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: Max pixel value always less than 255
This is down to whether using JFIF or BT601 colour spaces. If the camera stack believes or has been told that it is in a stills use case, then it should use JFIF as required by JPEGs. If it believes or has been told that it is in a video use case, it uses BT601. Yes in theory it ought to use BT709 if HD resolutions, but the plumbing isn't there for it. An H264 stream encodes the relevant colour primaries in the headers anyway, and those should correctly reflect the colour space in use.
I know a colleague was looking at this recently and it wasn't quite right on the V2 camera with (IIRC) it always using BT601. I'm not 100% certain on the state of play now.
Use case can be specified via MMAL_PARAMETER_CAMERA_USE_CASE.
At one stage there was the hope that the colour_space field in the port format would correctly be able to switch between the ranges, but whilst it works with video_render we never got it working from the camera. video_decode etc should always reflect what is encoded in the stream headers.
I know a colleague was looking at this recently and it wasn't quite right on the V2 camera with (IIRC) it always using BT601. I'm not 100% certain on the state of play now.
Use case can be specified via MMAL_PARAMETER_CAMERA_USE_CASE.
At one stage there was the hope that the colour_space field in the port format would correctly be able to switch between the ranges, but whilst it works with video_render we never got it working from the camera. video_decode etc should always reflect what is encoded in the stream headers.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: Max pixel value always less than 255
well I am using the video port, so I guess that's just it. Thank you all for making it clear.