Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

I'm a little confused. The function RGBToGray will work for BGR format too? Or I have to do the conversion before? Thank you very much.

Paulo_César_B_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-10-2013
07:53 AM

4 Views

RGBToGray

6 Replies

Highlighted
##

andy4us

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-10-2013
08:23 AM

4 Views

If there's a version with planar input, then yes you could and just swap the R and B planes

Highlighted
##

I don't understand ... A tell about calc... I can't use BGR24 directly? First I need swap or IPP will work with BGR24 too?
T don't know how IPP convert to gray.
Thanks.

Paulo_César_B_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-10-2013
08:49 AM

4 Views

Highlighted
##

Paulo_César_B_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-10-2013
11:52 AM

4 Views

Thank you very much! So, here worked fine with BGR format too =]

Highlighted
##

Please use **full names** for IPP functions when you're describing a problem or asking a question. Thanks in advance.
**Note:** Actually this is a discussion about a set of IPP functions **ippiRGBToGray_xx_xxxxx**.
>>... So, here worked fine with BGR format too...
A very famous equation
**Y** = 0.299 * **R** + 0.587 * **G** + 0.114 * **B**
is used to do this conversion RGB to Gray. However, you need to verify that it doesn't do something like:
**Y** = 0.299 * **B** + 0.587 * **G** + 0.114 * **R**
I'm Not sure that it does not.

SKost

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-11-2013
09:42 PM

4 Views

Highlighted
##

Igor_A_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-14-2013
05:13 AM

4 Views

If Sergey are right and you see wrong coefficients for B & R - use another function, please:

/* /////////////////////////////////////////////////////////////////////////////

// Name: ippiColorToGray

// Purpose: Converts an RGB image to gray scale (custom coefficients)

// Parameters:

// pSrc Pointer to the source image , points to point(0,0)

// pDst Pointer to the destination image , points to point(0,0)

// roiSize Size of the ROI in pixels. Since the function performs point

// operations (without a border), the ROI may be the whole image.

// srcStep Step in bytes through the source image to jump on the next line

// dstStep Step in bytes through the destination image to jump on the next line

// coeffs[3] User-defined vector of coefficients.

// The sum of the coefficients should be less than or equal to 1

// Returns:

// ippStsNullPtrErr pSrc == NULL, or pDst == NULL

// ippStsSizeErr roiSize has a field with zero or negative value

// ippStsNoErr No errors

//

// The following equation is used to convert an RGB image to gray scale:

//

// Y = coeffs[0] * R + coeffs[1] * G + coeffs[2] * B;

//

//

*/

just swap coefficients from the formula above.

Regards, Igor

Highlighted
##

This is a short follow up with some technical details.
>>A very famous equation
>>
>>Y = 0.299 * R + 0.587 * G + 0.114 * B
>>
>>is used to do this conversion RGB to Grey. However, you need to verify that it doesn't do something like:
>>
>>Y = 0.299 * B + 0.587 * G + 0.114 * R
Let's say R=64, G=128, B=192, then
**Case 1**
Y = 0.299 * R + 0.587 * G + 0.114 * B
Y = 0.299 * 64 + 0.587 * 128 + 0.114 * 192 = **116.16**
**Case 2**
Y = 0.299 * B + 0.587 * G + 0.114 * R
Y = 0.299 * 192 + 0.587 * 128 + 0.114 * 64 = **139.84**
Intensity of a grey image is Not the same, as you can see. In some applications, like X-Ray imaging or MRI, incorect conversions are Not allowed.

SKost

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-22-2013
07:30 AM

4 Views

For more complete information about compiler optimizations, see our Optimization Notice.