RGBToY_JPEG

Converts an RGB image to gray scale.

Syntax

Case 1: Operation on planar data

IppStatus ippiRGBToY_JPEG_8u_P3C1R(const Ipp8u* pSrcRGB[3], int srcStep, Ipp8u* pDstY, int dstStep, IppiSize roiSize);

Case 2: Operation on pixel-order data

IppStatus ippiRGBToY_JPEG_8u_C3C1R(const Ipp8u* pSrcRGB, int srcStep, Ipp8u* pDstY, int dstStep , IppiSize roiSize);

Parameters

pSrcRGB

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

pDstY

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

roiSize

Size of the source and destination ROI in pixels.

Description

The function ippiRGBToY_JPEG is declared in the ippj.h file. It operates with ROI (see Regions of Interest in Intel IPP).

This function converts the RGB image to gray scale using the following formula:

Y = 0.299*R + 0.587*G + 0.114*B

Example “Using the function ippiRGBToY_JPEG” shows how to use the function ippiRGBToY_JPEG_8u_C3C1R.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition if any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error condition if roiSize has a field with zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep or dstStep has a zero or negative value.

Using the function ippiRGBToY_JPEG

Ipp8u srcRGB[9*3] = { 255, 0, 0, 255, 0, 0, 255, 0, 0,
                      0, 255, 0, 0, 255, 0, 0, 255, 0,
                      0, 0, 255, 0, 0, 255, 0, 0, 255};
Ipp8u dstY[3*3];
IppiSize roiSize = { 9, 3 };

		
ippiRGBToY_JPEG_8u_C3C1R ( srcRGB, 9, dstY, 9, roiSize );

		
result:
255 0   0   255 0   0   255 0   0
0   255 0   0   255 0   0   255 0        src
0   0   255 0   0   255 0   0   255
 
 76  76  76
150 150 150        dst
 29  29  29

	

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.