calcHist method Inavalid Arguments.

asked 2014-02-26 07:19:42 -0500

nsm gravatar image

updated 2014-02-26 09:14:30 -0500

Rui Marques gravatar image

Dear Folks,

I am trying to find histogram in the image and I am trying to use calcHist method like below

calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, &histRange, uniform, accumulate );

I am trying this example from the link http://docs.opencv.org/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.html

All the time I am getting this error and I am not able to compile the code

"Invalid arguments ' Candidates are: void calcHist(const cv::Mat *, int, const int *, const cv::_InputArray &, cv::SparseMat &, int, const int *, const float * *, bool, bool) void calcHist(const cv::Mat *, int, const int *, const cv::_InputArray &, const cv::_OutputArray &, int, const int *, const float * *, bool, bool) void calcHist(const cv::_InputArray &, const std::vector<int,std::allocator<int>> &, const cv::_InputArray &, const cv::_OutputArray &, const std::vector<int,std::allocator<int>> &, const std::vector<float,std::allocator<float>> &, bool) '"

I have configured my build c/c++ build path with the required includes image description

I am working on 32 bit system and have set up appropriate NDK for windows 32 bit system. Same code when I run on 64 bit system where the method compiles without any issue!

Really Banging my head since morning . Some one pleeeeaaase help :(:)

Edited:

Mat imagMat=cvLoadImageM("/sdcard/ImageProcessing/TestImage.png"); LOGD("Number Of Rows = %d",imagMat.rows);

  /// Separate the image in 3 places ( B, G and R )
  vector<Mat> bgr_planes;
  split( imagMat, bgr_planes );

  /// Establish the number of bins
  int histSize = 256;

  /// Set the ranges ( for B,G,R) )
  float range[] = { 0, 256 } ;
  const float* histRange = { range };

  bool uniform = true;

  bool accumulate = false;

  Mat b_hist, g_hist, r_hist;

  const int* channel=0;

  calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, &histRange, uniform, accumulate );

Thanks in Advance

NSM

edit retag flag offensive close merge delete

Comments

please edit and show he definition of the vars involved as well

berak gravatar imageberak ( 2014-02-26 07:22:49 -0500 )edit

@berak . I have edited my post! Please see! Thanks

nsm gravatar imagensm ( 2014-02-26 07:42:09 -0500 )edit

weird. vs2008 is quite happy with the 2nd overload here.

berak gravatar imageberak ( 2014-02-26 07:56:51 -0500 )edit

@berak if I run the same code in 64 bit machine , it compiles without error! I am wondering what I may be missing!

nsm gravatar imagensm ( 2014-02-26 08:10:46 -0500 )edit

it's the compiler, that complains. i don't see any connection to 64 bit (that's only relevant to the linker)

sorry, no idea atm.

berak gravatar imageberak ( 2014-02-26 08:16:08 -0500 )edit

@berak I agree. But compiler for 32 bit and compiler for 64 bit would be different right . So you mean to say the 32 bit compiler only throwing this error ? Do I need to check with different compiler combination for 32 bit ? Am I missing any configuration changes ? Please guide me!

nsm gravatar imagensm ( 2014-02-26 08:21:59 -0500 )edit
1

A little off the grid,but I guess you should use imread instead of cvLoadImageM.May be this could help.

Abhishek Kumar Annamraju gravatar imageAbhishek Kumar Annamraju ( 2014-02-26 08:55:57 -0500 )edit