Calculate mode in OpenCV

asked 2015-01-21 07:30:21 -0600

RiSaMa gravatar image

Hi guys, Do you know how is the best and simply way to calculate the mode of a matrix?? For example in this matrix: [1 1 2 2 3 3 3 3] The mode is 3... How can I calculate it? THANKS!!!!

edit retag flag offensive close merge delete



Do you know the maximum value? Then you could build a histogram. The index having the most values is the mode.

Guanta gravatar imageGuanta ( 2015-01-21 09:09:26 -0600 )edit