Matlab binding for cv.calcHist [closed]

asked 2013-11-25 03:47:26 -0600

tivadj gravatar image

updated 2013-11-25 04:01:06 -0600

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 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
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-23 04:37:20.142590

Comments

I keep getting similar errors when trying to use any of the MATLAB bindings for OpenCV. Hope someone provides a solution to this!

rdasgupta gravatar imagerdasgupta ( 2014-02-28 04:35:22 -0600 )edit