Convert from RGB565 to RGB888

General discussion about topics related to OpenMV.
Ezzobeir
Posts: 4
Joined: Mon Mar 05, 2018 8:09 am

Convert from RGB565 to RGB888

Postby Ezzobeir » Tue Apr 24, 2018 10:27 am

Hello,

Is it possible to convert an RGB565 image to an RGB888 one ?

What I want to do is to convert images to RGB888 in order to increase significant figures of each pixel. I noticed that when I type for example print([img[2000]) , I get a list of 3 numbers coded in 8 bits, but I think that it is just a linear conversion of a number coded in 5 bits ( or 6 bits for the green component)

So I tested that by typing for example :

img = sensor.snapshot()

img[2000] = [ 23, 30, 23 ]
print(img[2000])


I get :

(25, 28, 25) instead of (23, 30, 23)(The values that I gave)

So I wonder if there is a way to convert to rgb888 in such a way as to increase the number of significant digits.
User avatar
kwagyeman
Posts: 2275
Joined: Sun May 24, 2015 2:10 pm

Re: Convert from RGB565 to RGB888

Postby kwagyeman » Wed Apr 25, 2018 2:06 am

Nope, we just have two images types: RGB565, and grayscale (8-bits), and we'll be adding binary very soon too.

If you want RGB888 data please set the camera mode to RAW and you'll get a bayer pattern in the frame buffer. All our image processing code work won't on a bayer pattern... but, you'll be able to save jpegs and you can manually access the pixels which are now 8-bits each using set_pixel() and get_pixel().
Nyamekye,
Ezzobeir
Posts: 4
Joined: Mon Mar 05, 2018 8:09 am

Re: Convert from RGB565 to RGB888

Postby Ezzobeir » Wed Apr 25, 2018 5:35 am

Thank you very much.

Could you just explain to me how to set the RAW mode ? Sorry I just started with OpenMV, I haven't got used to it yet.

I forgot to precise that I have the CAM M7

Thank you for your patience.
User avatar
kwagyeman
Posts: 2275
Joined: Sun May 24, 2015 2:10 pm

Re: Convert from RGB565 to RGB888

Postby kwagyeman » Thu Apr 26, 2018 3:09 am

Looks like is ins't documented right now. Give me to the next release. Also, just set the res to VGA with RGB565 and the mode internally will get set to RAW.
Nyamekye,
User avatar
iabdalkader
Posts: 542
Joined: Sun May 24, 2015 3:53 pm

Re: Convert from RGB565 to RGB888

Postby iabdalkader » Thu Apr 26, 2018 10:44 pm

Ezzobeir wrote: Could you just explain to me how to set the RAW mode ? Sorry I just started with OpenMV, I haven't got used to it yet.
Use this:

Code: Select all

sensor.set_pixformat(sensor.BAYER)

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 4 guests