我正在尝试在图像中找到直方图,并且正在尝试使用calcHist方法,如下所示
calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, &histRange, uniform, accumulate );
我正在尝试这个example from this link.
我一直在遇到此错误,并且无法编译代码
"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) '"
我已经使用所需的include配置了我的C / C++构建路径
我正在32位系统上工作,并为Windows 32位系统设置了适当的NDK。当我在64位系统上运行该方法编译时没有任何问题时,使用相同的代码!
自从早晨以来我真是Bang头。有人请帮忙!
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 );
提前致谢。
NSM
最佳答案
我只能建议将histSize作为一个整数数组而不是一个整数尝试。我知道您只有一架飞机,但我认为通话确实需要一个数组-每个飞机一个。尝试创建一个长度为1的数组,其中唯一的元素为256。