opencv 图像直方图匹配

  Mat img1 = Imgcodecs.imread("/sdcard/c.jpg");
        Mat img2 = Imgcodecs.imread("/sdcard/d.jpg");

        Mat hist0 = new Mat();
        Mat hist1 = new Mat();
        MatOfFloat ranges = new MatOfFloat(0f, 256f);

        MatOfInt histSize = new MatOfInt(25);

        Imgproc.calcHist(Arrays.asList(img1), new MatOfInt(0), new Mat(), hist0, histSize, ranges);
        Imgproc.calcHist(Arrays.asList(img2), new MatOfInt(0), new Mat(), hist1, histSize, ranges);

        double res = Imgproc.compareHist(hist0, hist1, Imgproc.CV_COMP_CORREL);
posted @ 2017-05-15 16:47  清澈见底  阅读(132)  评论(0编辑  收藏  举报