minMaxLoc method from OpenCV300 is returning different values on different machines(Windwos).

asked 2017-10-05 08:14:25 -0600

corneliu.cincea gravatar image

updated 2017-10-05 11:35:57 -0600

LBerger gravatar image

I am using minMaxLoc method to locate an image in another one. When I run a test on my machine Windows 10 or 7(virtual machine) I have some results. And when a colleague of mine runs that test (same input(source image is a full white image and imageToLocate is a yellow one)) he has a different result more exactly different coordinates for the second image.

We switched the dlls and with mine dll he still had his results and with him dll on my machine, I had my results. Is something and runtime no at compile.

matchTemplate(sourceImage, imageToLocate, resultImage, CV_TM_SQDIFF);
minMaxLoc(resultImage, &minval, &maxval, &minloc, &maxloc);
pointX = minloc.x;
pointY = minloc.y;

On my machine I have X=0,Y=45 and the other machine I have X=0,Y=49 OR another case X=717,Y=40 and the other machine X=0, Y=14.

Do you know guys which can be the reason here, Is this a normal behavior? I don't know exactly the difference between my machine and his machine.

Thank you.

edit retag flag offensive close merge delete

Comments

Can you compare values found :

cout <<resultImage(Rect(minLoc-Point(5,5),Size(10,10)));

in virtual machine offen opencl is not available.

LBerger gravatar imageLBerger ( 2017-10-05 11:39:26 -0600 )edit

minLoc is a Point I cannot do like you said and can you explain what I should see with this line?

corneliu.cincea gravatar imagecorneliu.cincea ( 2017-10-06 06:08:39 -0600 )edit

On my machine, the resulting image with that size is a white image. But on the other machine(It has OpenCL available) I cannot apply what you gave me because the minLoc is 0,49 and you want to do minLoc - Point(5,5). Do you have any other suggestions? Thank you.

corneliu.cincea gravatar imagecorneliu.cincea ( 2017-11-06 07:20:01 -0600 )edit

cout << minloc<<" "<<maxloc&lt;&lt;"\n"; cout="" &lt;&lt;="" resultimage(rect(minloc="" -="" point(min(5,minloc.x),="" min(5,minloc.y)),="" size(10,="" 10)));<="" p="">

LBerger gravatar imageLBerger ( 2017-11-06 14:30:49 -0600 )edit

check min max :

cout << minloc << " "  <<maxloc<<"\n";
cout << resultImage(Rect(minloc - Point(min(5,minloc.x), min(5,minloc.y)), Size(10, 10)));
LBerger gravatar imageLBerger ( 2017-11-06 14:31:26 -0600 )edit