Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

RGB2Gray round off?

yaddayadda22
Beginner
660 Views
Hi,

According to the image processing documentation, functional results are often "rounded to the nearest integer". I am finding this not to be the case. For example, the following code demonstrates what I'm finding.

BYTE* boo = new BYTE[ 1 * 3 ];
IppiSize boo_roi;
boo_roi.height = 1;
boo_roi.width = 3;
boo[0] = 113;
boo[1] = 134;
boo[2] = 115;

BYTE* bood = new BYTE[ 1 * 1];
ippiRGBToGray_8u_C3C1R( boo, 3, bood, 1, boo_roi);

printf("TEST RGB TO GRAY on (113,134,115) = %d yet math = %.4f ",bood[0],
0.299*113 + 0.587*134 + 0.114*115);

Output is the following :
TEST RGB TO GRAY on (113,134,115) = 125 yet math = 125.5550

So if the floating point value of one-pixel rgb image if 125.550, shouldn't the nearest integer be 126, not 125?

Thanks
Matt

0 Kudos
2 Replies
Vladimir_Dudnik
Employee
660 Views

Hi Matt,

you are right, it was an issue in IPP 5.1. We have fixed it in IPP 5.2 beta

Regards,
Vladimir

0 Kudos
Vladimir_Dudnik
Employee
660 Views

Ops, just double-check with developer, the more correct statement is that we provide +/- 1 precision in that function because of performance tradeoff. Please let us know if this is critical issue for you.

Vladimir

0 Kudos
Reply