martinkersner / non-maximum-suppression-cpp

MIT License
40 stars 24 forks source link

Subtraction functions with odd "+ 1" at the end #7

Open FSchmidt20 opened 11 months ago

FSchmidt20 commented 11 months ago

Hi Martin,

The nms function only returned one bounding box for me every time.

This was fixed for me by editing line 85 from: auto tmpArea = (x2[idx] - x1[idx] + 1) (y2[idx] - y1[idx] + 1); to: auto tmpArea = (x2[idx] - x1[idx]) (y2[idx] - y1[idx]);

and line 157 from: result.push_back(vec1[idx] - vec2[idx] + 1); to: result.push_back(vec1[idx] - vec2[idx]);

I am not sure if there is a reason behind adding the +1 after every subtraction, but after removing it I got great results from the nms() function.

martinkersner commented 11 months ago

Hello @FSchmidt20!

Could you please share your rectangle setup? Do you run the example.cpp?

Thank you, Martin