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

General discussion about topics related to OpenMV.
Jivrik
Posts: 19
Joined: Thu Jan 10, 2019 9:40 pm

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

Postby Jivrik » Thu Mar 28, 2019 9:19 pm

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 ?
User avatar
kwagyeman
Posts: 3045
Joined: Sun May 24, 2015 2:10 pm

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

Postby kwagyeman » Thu Mar 28, 2019 11:24 pm

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/m ... rection.py
Nyamekye,
Jivrik
Posts: 19
Joined: Thu Jan 10, 2019 9:40 pm

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

Postby Jivrik » Fri Apr 12, 2019 8:15 pm

Hi,

Thank you.


I got confused when trying to update the firmware.

Do I have to load a .dfu file from Tools > run bootloader?
User avatar
kwagyeman
Posts: 3045
Joined: Sun May 24, 2015 2:10 pm

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

Postby kwagyeman » Fri Apr 12, 2019 8:17 pm

Hi just use the firmware.bin file in the OPENMV3 folder for the M7. The H7 is the OPENMV 4 folder.
Nyamekye,
Jivrik
Posts: 19
Joined: Thu Jan 10, 2019 9:40 pm

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

Postby Jivrik » Fri Apr 12, 2019 8:48 pm

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.
Jivrik
Posts: 19
Joined: Thu Jan 10, 2019 9:40 pm

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

Postby Jivrik » Wed Apr 17, 2019 7:12 pm

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

Thanks.
User avatar
kwagyeman
Posts: 3045
Joined: Sun May 24, 2015 2:10 pm

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

Postby kwagyeman » Thu Apr 18, 2019 1:46 am

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.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests