Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can't get correct parameter format for cv::calcHist

I'm trying to utilising calcHist with the fowllowing code.

int channels[]={0,1,2};
int histSize[]={25,25,25};
float range[]={0,256};
const float* ranges[]={range,range,range};
printf("Ranges: %4.1d\t Type name: %s\t\n",0,typeid(ranges).name());
reference=imread("/home/wxh/Desktop/Photo/reference.bmp ",IMREAD_UNCHANGED);

and the complier gives me the error message

OpenCV Error: Assertion failed (j < nimages) in histPrepareImages, file /home/wxh/opencv-3.2.0/modules/imgproc/src/histogram.cpp, line 148
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wxh/opencv-3.2.0/modules/imgproc/src/histogram.cpp:148: error: (-215) j < nimages in function histPrepareImages

Which part gone wrong?