在compareHist(opencv)中断言失败

时间:2014-05-19 11:47:41

标签: java opencv

我有以下代码,我试图在CV_32F中创建它,但它仍然给我这个错误:

        Mat A = Highgui.imread("letter12.jpg", Highgui.CV_LOAD_IMAGE_COLOR);
        Mat B = Highgui.imread("r3.jpg", Highgui.CV_LOAD_IMAGE_COLOR);

        Mat resizeimage = new Mat();
        Size sz = new Size(A.width(),A.height());
        Imgproc.resize( B, resizeimage, sz );


        A.convertTo(A, CvType.CV_32F);
        resizeimage.convertTo(resizeimage, CvType.CV_32F);

        double distance = Imgproc.compareHist(A, resizeimage, Imgproc.CV_COMP_CORREL);

错误:

OpenCV Error: Assertion failed (H1.type() == H2.type() && H1.type() == CV_32F) in compareHist, file Desktop/opencv-2.4.8/modules/imgproc/src/histogram.cpp, line 1985
error: cv::Exception: Desktop/opencv-2.4.8/modules/imgproc/src/histogram.cpp:1985: error: (-215) H1.type() == H2.type() && H1.type() == CV_32F in function compareHist

0 个答案:

没有答案