Example usage for org.opencv.core Core normalize

List of usage examples for org.opencv.core Core normalize

Introduction

In this page you can find the example usage for org.opencv.core Core normalize.

Prototype

public static void normalize(Mat src, Mat dst) 

Source Link

Usage

From source file:gab.opencv.OpenCV.java

License:Open Source License

public Histogram findHistogram(Mat mat, int numBins, boolean normalize) {

    MatOfInt channels = new MatOfInt(0);
    MatOfInt histSize = new MatOfInt(numBins);
    float[] r = { 0f, 256f };
    MatOfFloat ranges = new MatOfFloat(r);
    Mat hist = new Mat();

    ArrayList<Mat> images = new ArrayList<Mat>();
    images.add(mat);// w  w  w  .  j  a v a  2  s  .  c  om

    Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);

    if (normalize) {
        Core.normalize(hist, hist);
    }

    return new Histogram(parent, hist);
}