Ask Your Question

Floodfill gives different results on different machines

asked 2016-04-21 19:27:20 -0500

changizi gravatar image

updated 2016-04-22 13:07:04 -0500

  • OpenCV version: 3.1
  • Host OS: Mac OS X 10.11.4

Issue in imgproc -> Floodfill function

I have a method that uses floodfill function on an image. The issue is that I get different results when running the code on different machines, even with same opencv version. Has anyone else experienced this issue? I can't figure out what is causing this.

original image:

image description

Mac OS X EI Capitan, OpenCV version: 3.1:

image description

Ubuntu 14.04.4 LTS, OpenCV version: 3.1:

image description

floodFill( blurredImage, cv::Mat(), cv::Point(blurredImage.cols/2,y), cv::Vec3b(255,255,255), 0, cv::Scalar::all(1), cv::Scalar::all(1) , 8 | 255<<8 );

edit retag flag offensive close merge delete


Make a png image on first machine and duplicate this png file on both machine and try again

LBerger gravatar imageLBerger ( 2016-04-22 13:26:45 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-04-25 13:27:55 -0500

changizi gravatar image

In case anyone else has the same issue I just figured out the issue is caused by different jpeg readers on different machines.

edit flag offensive delete link more


Does it mean that with png there is no problem with flooffill?

LBerger gravatar imageLBerger ( 2016-04-25 13:52:07 -0500 )edit

If the original image is png, the result is still different. The problem is basically not with floofill, it is due to the different input image read using jpeg/png libraries. The images were read identically only if they were saved in bmp format.

changizi gravatar imagechangizi ( 2016-04-25 13:57:27 -0500 )edit

I think that with png there is no compression (or compression without lost). Problem musn't happen with png beformat (may be I'm wrong @berak)

LBerger gravatar imageLBerger ( 2016-04-25 14:32:07 -0500 )edit

as Laurent says .png shouldn't be causing problems since it is a lossless compression method.

theodore gravatar imagetheodore ( 2016-04-25 17:23:14 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-04-21 19:27:20 -0500

Seen: 174 times

Last updated: Apr 25 '16