SSARCandy / Coherent-Line-Drawing

🖼✨Automatically generates line drawing from a photograph

Home Page:https://ssarcandy.tw/2017/06/26/Coherent-Line-Drawing/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible bug in ETF.cpp?

askerlee opened this issue · comments

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) ) );

You are right, thanks to pointing it out.