- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matt,
you are right, it was an issue in IPP 5.1. We have fixed it in IPP 5.2 beta
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

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