Ask Your Question

Is it possible for calcHist to return a hist with NaN

asked 2013-07-20 13:03:34 -0600

zhihua gravatar image

updated 2013-07-20 20:21:41 -0600

Hi, everyone

I am currently using calcHist function to do some feature extraction processing. But I encounter a problem that the hist which is returned by calcHist may contains NaN value. I'm wondering if this situation is normal for calcHist function? And why this happens?


edit retag flag offensive close merge delete



could you (edit and) show some code ?

berak gravatar imageberak ( 2013-07-21 10:18:39 -0600 )edit

I have the same problem when I try to calculate a histogram over an image with only one color (e.g. a matrix full of CV_RGB(0,0,250)'s). I do this many times and in random instances the output histogram is full of NaN values.

jorjazo gravatar imagejorjazo ( 2013-10-31 13:30:19 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-06-17 19:47:40 -0600

waschbaer gravatar image

I don't get NaN, even the matrix includes many NaN, it seems like it will ignore NaN as a single bin. Unless, the whole matrix contains only NaN, in that case, I don't know what will happen.

edit flag offensive delete link more

Question Tools


Asked: 2013-07-20 13:03:34 -0600

Seen: 599 times

Last updated: Jun 17 '17