Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Matlab binding for cv.calcHist

Hi,

The Python's sample in OpenCV-2.4.7\sources\samples\python2\color_histogram.py has warking code below

h = cv2.calcHist( [hsv], [0, 1], None, [180, 256], [0, 180, 0, 256] )

What is the corresponding syntax for Matlab mex binding?

I tried different syntax such as

h = cv.calcHist({image}, [0 1], [], [180, 256], [0 180 0 256]);
h = cv.calcHist( image , [0 1], [], [180, 256], [0 180 0 256]);

And for every calls got the error

Error using calcHist cv::exception caught: ..\..\..\modules\imgproc\src\histogram.cpp:1421: 
error: (-215) nimages > 0 && dims > 0 in function cv::calcHist

Matlab binding for cv.calcHist

Hi,

The Python's sample in OpenCV-2.4.7\sources\samples\python2\color_histogram.py has warking code below

h = cv2.calcHist( [hsv], [0, 1], None, [180, 256], [0, 180, 0, 256] )

What is the corresponding syntax for Matlab mex binding?

I tried different syntax such as

h = cv.calcHist({image}, [0 1], [], [180, 256], [0 180 0 256]);
h = cv.calcHist( image , [0 1], [], [180, 256], [0 180 0 256]);

And for every calls got the error

Error using calcHist cv::exception caught: ..\..\..\modules\imgproc\src\histogram.cpp:1421: 
error: (-215) nimages > 0 && dims > 0 in function cv::calcHist

The error is reproduced under:

  1. OpenCV 3 latest sources from GitHub.
  2. Compiler=VS2010 or VS2012.
  3. Arch=x86 or x64
  4. Configuration=Release
  5. Matlab=R2013b

Matlab binding for cv.calcHist

Hi,

The Python's sample in OpenCV-2.4.7\sources\samples\python2\color_histogram.py has warking code below

h = cv2.calcHist( [hsv], [0, 1], None, [180, 256], [0, 180, 0, 256] )

What is the corresponding syntax for Matlab mex binding?

I tried different syntax such as

image = imread('coloredChips.png');
cv.imshow('main', image)
h = cv.calcHist({image}, [0 1], [], [180, 256], [0 180 0 256]);
h = cv.calcHist( image , [0 1], [], [180, 256], [0 180 0 256]);

And for every calls got the error

Error using calcHist cv::exception caught: ..\..\..\modules\imgproc\src\histogram.cpp:1421: 
error: (-215) nimages > 0 && dims > 0 in function cv::calcHist

The error is reproduced under:

  1. OpenCV 3 latest sources from GitHub.
  2. Compiler=VS2010 or VS2012.
  3. Arch=x86 or x64
  4. Configuration=Release
  5. Matlab=R2013b

Matlab binding for cv.calcHist

Hi,

The Python's sample in OpenCV-2.4.7\sources\samples\python2\color_histogram.py has warking code below

h = cv2.calcHist( [hsv], [0, 1], None, [180, 256], [0, 180, 0, 256] )

What is the corresponding syntax for Matlab mex binding?

I tried different syntax such as

image = imread('coloredChips.png');
cv.imshow('main', image)
h = cv.calcHist({image}, [0 1], [], [180, 256], [0 180 0 256]);
h = cv.calcHist( image , [0 1], [], [180, 256], [0 180 0 256]);

And for every calls calcHist call got the error

Error using calcHist cv::exception caught: ..\..\..\modules\imgproc\src\histogram.cpp:1421: 
error: (-215) nimages > 0 && dims > 0 in function cv::calcHist

The error is reproduced under:

  1. OpenCV 3 latest sources from GitHub.
  2. Compiler=VS2010 or VS2012.
  3. Arch=x86 or x64
  4. Configuration=Release
  5. Matlab=R2013b