computeECC returning strange values

asked 2019-05-27 03:39:49 -0600

Quizzy5889 gravatar image

From version 4.1.x there's the opportunity the compute the enhanced correlation coefficient between two images. It seems to me that it's not working correctly. My two images are very similar and I get an ECC=0.474. Just to test the functionality I also tried to run:

retval = cv2.computeECC(templateImage=reference, inputImage=reference)

and it returns me 0.475, while I was expecting 1.00.

Does anybody know how to solve this? Thank you for your help.

edit retag flag offensive close merge delete

Comments

1

Why do you expect 1.00?

mshabunin gravatar imagemshabunin ( 2019-05-27 06:23:12 -0600 )edit

Because just to test the functionality I used the same image (called reference in the code snippet) for both parameters templateImage and inputImage.

Quizzy5889 gravatar imageQuizzy5889 ( 2019-05-27 06:27:44 -0600 )edit
1

No, I mean mathematically, should it really be 1 for matching images? I can see, that algorithm searches for ECC maximum, but don't see clues about its range?

mshabunin gravatar imagemshabunin ( 2019-05-27 07:26:26 -0600 )edit
1

Also the operator findTransformECC provides the same output correlation coefficient. I just tried the following

cc1, warp_matrix = cv2.findTransformECC(reference, reference, warp_matrix, ...)
cc2 = cv2.computeECC(reference, reference)

I verified that warp_matrix is actually an identity matrix so no transform has been applied to the image. So far, the two output values are respectively:

cc1 = 1.0 
cc2 = 0.473
Quizzy5889 gravatar imageQuizzy5889 ( 2019-05-27 07:50:58 -0600 )edit
1

Could be a bug, could you please file an issue to the GitHub?

mshabunin gravatar imagemshabunin ( 2019-05-27 11:19:49 -0600 )edit