Example usage for org.opencv.imgproc Imgproc pyrUp

List of usage examples for org.opencv.imgproc Imgproc pyrUp

Introduction

In this page you can find the example usage for org.opencv.imgproc Imgproc pyrUp.

Prototype

public static void pyrUp(Mat src, Mat dst, Size dstsize, int borderType) 

Source Link

Usage

From source file:MainPyramids.java

public static void main(String[] args) {

    try {/*  w w  w . j a  v  a 2 s .  co  m*/

        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        System.out.println("Verso OPENCV: " + Core.VERSION);

        //pyramids UP

        Mat source = Highgui.imread("D:\\teste.png", Highgui.CV_LOAD_IMAGE_COLOR);

        Mat destinationUp = new Mat(source.rows() * 2, source.cols() * 2, source.type());

        destinationUp = source;

        Imgproc.pyrUp(source, destinationUp, new Size(source.cols() * 2, source.rows() * 2),
                Imgproc.BORDER_DEFAULT);

        Highgui.imwrite("D://pyrUp.jpg", destinationUp);

        //pyramids DOWN

        source = Highgui.imread("D://teste.png", Highgui.CV_LOAD_IMAGE_COLOR);

        Mat destinationDown = new Mat(source.rows() / 2, source.cols() / 2, source.type());

        destinationDown = source;

        Imgproc.pyrDown(source, destinationDown, new Size(source.cols() / 2, source.rows() / 2));

        Highgui.imwrite("pyrDown.jpg", destinationDown);

    } catch (Exception e) {
        System.out.println("Exception: " + e.getMessage());
    }
}