AmirooR / FlannImageCompletion

Image Completion Using Statistics of Patch Offsets and Flann
9 stars 3 forks source link

A mistake in the smoothFunc #2

Open chwahaha opened 5 years ago

chwahaha commented 5 years ago

Hi , I found your code very useful for me to understand this algorithm, but I find an important mistake may lead uncomfortable result.

                    Vec3b v1_a = img_ycb.at<Vec3b>( x1_s_a.y, x1_s_a.x);
                    Vec3b v1_b = img_ycb.at<Vec3b>( x1_s_b.y, x1_s_b.x);
                    Vec3b diff1 = v1_a - v1_b;

                    retMe += diff1[0]*diff1[0] + diff1[1]*diff1[1] + diff1[2]*diff1[2];

In openCV, Vec3b is uchar, it will cause a overflow easly and mess the result. when I correct this , I get a much better and stable result.

AmirooR commented 5 years ago

Thanks @chwahaha for the investigation. Could you please send a pull request to update the code?

Best, Amir