Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
16 Views

Bug in ippimage.cpp:1387 (CIppImage::ToGray)

Hello,
The problem is in CIppImage::ToGray(CIppImage& img, const float* coeffs)
The test below will allways return, and it should not:
if( NChannels() != 3 || NChannels() != 4 )
return -1;;
I think that AND should be used instead of OR:
if( NChannels() != 3 && NChannels() != 4 )
return -1;;
Thank you.
0 Kudos
5 Replies
Highlighted
Employee
16 Views

Hi,

Just I verified picnic application with converting from RGB to Gray scale, it works fine, so coding logic should be correct.

Are you getting any error in the result of this function?

Thanks,

Naveen Gv

0 Kudos
Highlighted
Beginner
16 Views

You are wrong: the code says "if not rgb24 or not rgb32 then don't do it".
0 Kudos
Highlighted
Beginner
16 Views

I use the following IPP version:
7.0 build 205.58, [7.0.1032.205]
I used this specific function from my application and it returned -1 for color images.
The function should work if the image is rgb24 or rgb32, that is
if (!(rgb24 || rgb32))return -1;
This is equivalent to:
if (!rgb24 && !rgb32)return -1;
So the code should say"if not rgb24 AND not rgb32 then don't do it".
Thank you.
0 Kudos
Highlighted
Beginner
16 Views

Hmm, I guess you are correct. It is too early in the morning here...

For rgb24, it would look like this:

if( 3 != 3 || 3 != 4 )
return -1;

This will always return -1 !

Naveen checked in Picnic, but I cannot find any grayscale functions in Picnic.

I also searched for ToGray() references in the source code of Picnic, but I didn't find any references except the implementation.

Naveen, can you clarify?
0 Kudos
Highlighted
Employee
16 Views

I think that AND should be used instead of OR:
Hello,
if( NChannels() != 3 && NChannels() != 4 )
return -1;

That's true. We will fix it. Probably, there were assertions before with "assert(NChannels==3 || NChannels==4)". When substituting with "if", the expression must be turned inside out completely "NChannels!=3 && NChannels!=4"

Thank you,

Sergey

0 Kudos