欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

opencv 图像直方图匹配

程序员文章站 2022-04-01 08:52:29
...

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 清澈见底 阅读(...) 评论(...) 编辑 收藏