Reducing the number of GRAYSCALE levels (8 bits to 3 bits)

Hi,


I am trying to reduce the grayscale level on the openMV frame. Instead of having a range of grayscale going from 0 to 255, I want a level of grayscale going from 0 to 7.

Is it possible?
If yes, How can i do it ?

Hi, download the latest firmware and use the gamma_corr() method and set the contrast adjustment to be 0.03125.

https://github.com/openmv/openmv/blob/master/scripts/examples/04-Image-Filters/gamma_correction.py

Hi,

Thank you.


I got confused when trying to update the firmware.

Do I have to load a .dfu file from Tools > run bootloader?

Hi just use the firmware.bin file in the OPENMV3 folder for the M7. The H7 is the OPENMV 4 folder.

Please ,


How do you get the numbers for the gamma correction?

What is the maximum value of the contrast and the brightness?


Also I tried to print the pixels values collected using the operation below:

img = sensor.snapshot().gamma_corr(gamma = 0.03125, contrast = 1.0, brightness = 0.0)

I keep having values between 0 and 255 ; and not 0 and 8 since I should have a 3 bits grayscale.

Just in case you missed this question… Could you please help me out with this as well?

Thanks.

Yeah… so, you want to pass the 0.03125 value to contrast, not gamma. The values are passed to every pixel channel normalized to 1. E.g. a brightness of 1 makes the whole image white and maxes everything out. Contrast of 2 multiplies all pixels by 2. Gamma is different and does the standard image gamma operation.