Example usage for org.opencv.core MatOfFloat MatOfFloat

List of usage examples for org.opencv.core MatOfFloat MatOfFloat

Introduction

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

Prototype

public MatOfFloat(float... a) 

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);//from   www  .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);
}