-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
non-max suppression not working #2
Comments
For my own understanding while debugging I ended up re-writing the non-max suppression loop as follows:
With this I'm getting results more in line with what I'd expect, for example with the same options as the above 3 images I'm now getting: Now that (I think) it is working properly, there's too much noise with the thresholds set so low. Here's Nice clean lines and you can easily pick out the features of the eyes, so I think this is about right, however it does seem to be ~ 15-20% slower. |
Hi, great lib (and also image-js) - thanks :)
I noticed that non-max suppression doesn't seem to be working - I end up with some very thick edges. For example, here's lena:
I inserted some debugging and noticed that we're getting 5 values for dir, vs. the intended 4 (per the description of edge thinning in wikipedia).
Changing line 71 to
% 4
instead of% 5
appears to work (thins the edges to 1 pixel), but the results don't look right, so I'm dubious that my change here is correct. For example, look at the hat brim, and the vertical post to the left side, compared to the 3rd output image below.I didn't understand the math enough to know how to fix line 71, so I replaced with my own - possibly less efficient - alternative, based on the wikipedia description:
... which produces an output more in line with what I'd expect:
I'm still not convinced this is correct/ideal, as there are some stronger edges in the %4 version than in this version which would be nice to preserve too - e.g. compare the top-right of the hat, lena's cheek, and the top of lena's shoulder between the 2nd and 3rd outputs. I assume this is related to the differences in rounding between the two implementations.
btw., I timed several runs using each implementation and don't see an appreciable difference (actually mine was about 0.5% faster in this very unscientific test).
Tests above used the following options:
The text was updated successfully, but these errors were encountered: