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) ) );
ETF.cpp:86 is:(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(gradientMag.at<float>(y, x), gradientMag.at<float>(r, c));
However gradientMag is a 3-channel Mat (CV_32FC3). gradientMag.atfloat w_m = computeWm( norm( gradientMag.at<Vec3f>(y, x) ), norm( gradientMag.at<float>(r, c) ) );