# RGB RAW values

**URL:** <https://forums.openmv.io/t/rgb-raw-values/1775>\
**Category:** OpenMV Boards\
**Created:** [May 27, 2020, 7:46pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775 "2020-05-27T19:46:53Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonjour](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@bonjour](https://forums.openmv.io/u/bonjour)\
**Post date:** [May 27, 2020, 7:46pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/1 "2020-05-27T19:46:53Z")

</div>

Hi,  
I would like to know if it is possible to get the RAW tuple values of a pixel after a snapshot with the “BAYER” mode. I’m am actually using the get\_pixel() function with “True” parameter to get the tuple value. However, I noticed that the “Blue” value is always the same as the “Red” one. In “RGB565” mode it works fine, but I would like to do it in “BAYER” mode to get the RAW values. I also noticed that the “BAYER” mode is on 8-bits, is it the reason why it is not working?

Finally, I just want to know if it is possible to do it and how with the IDE. My goal is simply to print each value after that.

Thanks.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 27, 2020, 8:44pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/2 "2020-05-27T20:44:38Z")

</div>

In bayer mode there’s no RGB888 tuple. The RAW bayer image is just grayscale basically with color in a bayer pattern. The concept of the RGB888 tuple doesn’t make sense:

int pixel = IMAGE\_GET\_GRAYSCALE\_PIXEL(arg\_img, arg\_x, arg\_y); // Correct!  
mp\_obj\_t pixel\_tuple[3];  
pixel\_tuple[0] = mp\_obj\_new\_int(COLOR\_RGB565\_TO\_R8(COLOR\_GRAYSCALE\_TO\_RGB565(pixel)));  
pixel\_tuple[1] = mp\_obj\_new\_int(COLOR\_RGB565\_TO\_G8(COLOR\_GRAYSCALE\_TO\_RGB565(pixel)));  
pixel\_tuple[2] = mp\_obj\_new\_int(COLOR\_RGB565\_TO\_B8(COLOR\_GRAYSCALE\_TO\_RGB565(pixel)));  
return mp\_obj\_new\_tuple(3, pixel\_tuple);

The current code doesn’t do what you want. What you’d like for it to do is to Debayer the image for that particular pixel and then return the RGB888 tuple for that pixel. And then rgbtuple is not true you’d like the grayscale pixel bayer value right?

If this is correct, please create a github issue ticket for this.

> **[Issues · openmv/openmv](https://github.com/openmv/openmv/issues)**
>
> OpenMV Camera Module. Contribute to openmv/openmv development by creating an account on GitHub.

I can create one for you also if this is difficult.

---

<div class="post-metadata">

**Author:** ![bonjour](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@bonjour](https://forums.openmv.io/u/bonjour)\
**Post date:** [May 27, 2020, 10:37pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/3 "2020-05-27T22:37:29Z")

</div>

Thanks for fast reply.  
Well, I just want to collect RAW value for each pixel. If it’s what you explained, I would be happy if you create a ticket yes.  
Thank you.

---

<div class="post-metadata">

**Author:** ![kwiley](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwiley/32/42_2.png) [@kwiley](https://forums.openmv.io/u/kwiley)\
**Post date:** [May 28, 2020, 2:34am UTC](https://forums.openmv.io/t/rgb-raw-values/1775/4 "2020-05-28T02:34:01Z")

</div>

When you say the red and blue value is always the same, do you mean for every pixel in the image (which would imply a bug that should be fixed), or for some particular pixel or set of pixels? Sounds like you’re looking at the green pixels of the Bayer matrix. When you say you want the RAW value of a pixel, do you mean as close to the original sensor pixel value as possible, which is a single value, not an RGB tuple, namely the intensity of light captured by the pixel after going through a red, green, or blue Bayer filter over that pixel? Or do you mean you want a “raw RGB” value, which isn’t really a meaningful concept, but I can see how one might think it is a thing since a lot of photo software will open a RAW image and then display it in color, giving people the impression that RAW images are color images, when, strictly speaking, they are single channel mosaics of three colors (Bayer patterns)? When RAW software displays a RAW image in color, it is deBayering the image before it displays it to you. The “real RAW” image is grayscale. Which is why, as you pointed out, the Bayer images are 8-bit images. They only contain a single value per pixel.

> **[Bayer filter](https://en.wikipedia.org/wiki/Bayer_filter)**
>
> A Bayer filter mosaic is a color filter array (CFA) for arranging RGB color filters on a square grid of photosensors. Its particular arrangement of color filters is used in most single-chip digital image sensors used in digital cameras, camcorders, and scanners to create a color image. The filter pattern is half green, one quarter red and one quarter blue, hence is also called BGGR, RGBG, GRBG, or RGGB.
> It is named after its inventor, Bryce Bayer of Eastman Kodak. Bayer is also known for his rec...

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 28, 2020, 5:54am UTC](https://forums.openmv.io/t/rgb-raw-values/1775/5 "2020-05-28T05:54:17Z")

</div>

Fixed:

> <https://github.com/openmv/openmv/pull/816>
>
> https://forums.openmv.io/viewtopic.php?p=11338&sid=71b25798a86aa1f68cc19b0b4e7c9…289#p11338

---

<div class="post-metadata">

**Author:** ![bonjour](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@bonjour](https://forums.openmv.io/u/bonjour)\
**Post date:** [May 28, 2020, 2:04pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/6 "2020-05-28T14:04:18Z")

</div>

Thank you Nyamekye.  
One last question, how do I update this file to get this modification working?

And Kwiley, I thought RAW image was simply each RGB values of one pixel without any image processing around it. I didn’t think it was grayscale. Thank you.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 28, 2020, 2:47pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/7 "2020-05-28T14:47:59Z")

</div>

What camera model do you have? I can generate the firmware binary.

---

<div class="post-metadata">

**Author:** ![bonjour](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@bonjour](https://forums.openmv.io/u/bonjour)\
**Post date:** [May 28, 2020, 4:36pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/8 "2020-05-28T16:36:55Z")

</div>

I have the OV7725-M7 and the 3.6.2 firmware version

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 28, 2020, 7:20pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/9 "2020-05-28T19:20:24Z")

</div>

M7 Firmware.  
[firmware.zip](https://forums.openmv.io/uploads/short-url/uvMYF5uec6tbaamyBZBk7f9tfRx.zip) (1.15 MB)

---

<div class="post-metadata">

**Author:** ![bonjour](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@bonjour](https://forums.openmv.io/u/bonjour)\
**Post date:** [May 28, 2020, 7:42pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/10 "2020-05-28T19:42:57Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![bonjour](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@bonjour](https://forums.openmv.io/u/bonjour)\
**Post date:** [May 29, 2020, 3:13pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/11 "2020-05-29T15:13:50Z")

</div>

Hi,  
Do I simply need to copy this new bin and replace it in the firmware folders (\OpenMV IDE\share\qtcreator\firmware\OPENMV4P) or do I also need to execute the bootloarder for this to work?  
Thanks.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 29, 2020, 3:49pm UTC](https://forums.openmv.io/t/rgb-raw-values/1775/12 "2020-05-29T15:49:31Z")

</div>

Tools-\>Run Bootloader and select the file.
