Converting from OpenCV 3.4 to 4.2 divide issue (different results)

asked 2020-04-04 23:17:01 -0500

AaronB gravatar image

I have two images I divide the one with the other. But I get different results in OpenCV 3.4 (expected answer) and 4.2 gives me and unexpected result using cv::divide.

I confirmed the inputs are bit for bit identical by cv::imwrite the imputs and output to files and comparing them.

Any suggestions or idea who be appreciated.

edit retag flag offensive close merge delete

Comments

1

More often thab not, the problem is in the calling code rather than OpenCV - which is why you should show the code and describe the format of the files

mvuori gravatar imagemvuori ( 2020-04-05 01:36:37 -0500 )edit

Here is the code...

    Mat resultImage = Mat::zeros(imageHeight, imageWidth, CV_32FC1);

    cv::divide(image1, image2, resultImage, 1.0);

    cv::imwrite("image1.tif", image1);
    cv::imwrite("image2.tif", image2);
    cv::imwrite("output.tif", resultImage);

Images are converted to CV_32FC1 before I do this logic.

AaronB gravatar imageAaronB ( 2020-04-05 10:05:57 -0500 )edit