Example usage for org.opencv.core MatOfInt fromArray

List of usage examples for org.opencv.core MatOfInt fromArray

Introduction

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

Prototype

public void fromArray(int... a) 

Source Link

Usage

From source file:usefull.SaveImage.java

License:LGPL

public static void main(String[] args) {

    // load the Core OpenCV library by name

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    // load an image from file (read and decode JPEG file)

    Mat inputImg = Highgui.imread("files/lena.jpg");

    // create an output object

    Mat outputImg = new Mat();

    // invert the image

    Core.bitwise_not(inputImg, outputImg);

    // write image to file (first setting up the compression quality to use)

    MatOfInt params = new MatOfInt();
    params.fromArray(new int[] { Highgui.CV_IMWRITE_JPEG_QUALITY, 75, 0 });

    System.out.println("Saving image to file ....");

    Highgui.imwrite("files/lena_inverted.jpg", outputImg, params);

}