SSARCandy / Coherent-Line-Drawing

🖼✨Automatically generates line drawing from a photograph
https://ssarcandy.tw/2017/06/26/Coherent-Line-Drawing/
MIT License
556 stars 61 forks source link

Possible bug in ETF.cpp? #12

Closed askerlee closed 6 years ago

askerlee commented 6 years ago

ETF.cpp:86 is: float w_m = computeWm(gradientMag.at<float>(y, x), gradientMag.at<float>(r, c)); However gradientMag is a 3-channel Mat (CV_32FC3). gradientMag.at(y, x) actually returns a value at some other position (I'm not sure where it actually accesses). Debugging shows that in most cases it seems to return 0, and thus in most cases computeWm() returns 0.5, effectively disabling the impact of Wm. This problem doesn't make the output image obviously wrong. Though I guess it's better to correct it. Here is the fix I propose: float w_m = computeWm( norm( gradientMag.at<Vec3f>(y, x) ), norm( gradientMag.at<float>(r, c) ) );

SSARCandy commented 6 years ago

You are right, thanks to pointing it out.