Home > Net >  Method for comparing two images
Method for comparing two images

Time:11-22

I have two identical images. One was marked by an algorithm, and the other (already marked) serves as ground truth. I'm able to segment the marks from the images like in the following example.

GROUND_TRUTH

ALGORITHM

My question is what is the best way to compare the mark produced by the algorithm with the ground truth?

So far I´ve tried substracting the image marked by the algorithm from the ground truth and counting the remainig pixels to compute the success of the comparison using the equation success=1-(number of remaining pixels after substraction)/(number of pixels of the ground truth)

But I'm not convinced by this method especially in the case where the mark made by the algorithm and the ground truth are in different places. In the example the part of the mark made by the algorithm that is at the top is not accounted for in the comparison. How could I deal with this?

SUBSTRACTED

I'm using openCV and python to work with the images.

CodePudding user response:

To compare two images try Image moments. There is realization in OpenCV

CodePudding user response:

You have binary masks.

Calculate intersection over union ("IoU").

Both numpy itself and OpenCV have ways to calculate the logical and/or of two boolean arrays, and both have ways to count the number of non-zeros.

  • Related