Example usage for org.opencv.core Core VERSION

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

Introduction

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

Prototype

String VERSION

To view the source code for org.opencv.core Core VERSION.

Click Source Link

Usage

From source file:Fiji_OpenCV.java

License:Creative Commons License

/**
 * @see ij.plugin.filter.PlugInFilter#run(String arg)
 *//*w  w  w  .j a  va2 s . com*/

@Override
public void run(ImageProcessor ip) {
    nu.pattern.OpenCV.loadShared();
    IJ.log("Welcome to OpenCV " + Core.VERSION);

    this.ip = ip;
    // get width and height
    width = ip.getWidth();
    height = ip.getHeight();

    process(ip);
}

From source file:MainParallelLicense.java

public static void main(String[] args) {
    System.out.println("Welcome to OpenCV " + Core.VERSION);
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    mainUI = new ParallelLicenseMainUI();
    mainUI.setSize(mainUI.getMaximumSize());
    mainUI.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    mainUI.setVisible(true);//w  w  w  . ja  v a2 s .  co  m

    //testRun();
    //mainUI.setVisible(true);

}

From source file:MainPyramids.java

public static void main(String[] args) {

    try {// ww  w  .  ja va2 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());
    }
}

From source file:ConfOpenCV_Java.ConfOpenCV_Java.java

/**
 * @param args the command line arguments
 *//*from w  w w.ja  v a  2 s. c om*/
public static void main(String[] args) {

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    System.out.println("Welcome to OpenCV " + Core.VERSION);
    String outputFile = "mivideo.avi";
    VideoCapture vc = new VideoCapture(0);
    System.out.println("fps= " + Videoio.CAP_PROP_FPS);

    //vc.set(5, 50);
    //System.out.println(vc.set(3, 1280));
    //vc.set(4, 720);
    double fps = 30;
    System.out.println(fps);

    Size frameSize = new Size((int) vc.get(Videoio.CV_CAP_PROP_FRAME_WIDTH),
            (int) vc.get(Videoio.CV_CAP_PROP_FRAME_HEIGHT));
    System.out.println(frameSize);

    VideoWriter vw = new VideoWriter(outputFile, VideoWriter.fourcc('X', '2', '6', '4'), fps, frameSize, true);
    //System.out.println(VideoWriter.fourcc('X', '2', '6', '4'));
    //System.out.println(vw.isOpened());
    Mat frame = new Mat();

    //para cargar fotos
    //Imgcodecs.imread(outputFile)
    //Imgcodecs.imwrite(outputFile, m);
    int numFramesRemaining = 5 * (int) fps;

    NewJFrame ventana = new NewJFrame();
    ventana.setVisible(true);
    g = ventana.getjPanel1().getGraphics();
    ventana.pack();
    ventana.setVisible(true);

    while (vc.read(frame) && numFramesRemaining > 0) {
        vw.write(frame);
        mostrarImagen(frame);
        numFramesRemaining--;
    }

    vw.release();
    vc.release();
    ventana.dispose();

}

From source file:gab.opencv.OpenCV.java

License:Open Source License

private void welcome() {
    System.out.println("##library.name## ##library.prettyVersion## by ##author##");
    System.out.println("Using Java OpenCV " + Core.VERSION);
}

From source file:javaapplication1.JavaApplication1.java

public static void main(String[] args) {
    // you must load the OpenCV library like this before trying to do
    // anything with OpenCV!
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    // Print OpenCV version
    System.out.println("Welcome to OpenCV " + Core.VERSION);

    // In OpenCV, the most important data type is the Matrix, Mat.
    ///*from   www . j  a  v a 2 s . c  o m*/
    // Here, we create a matrix that has 5 rows and 10 columns.  It
    // stores an 8-bit type with a single channel.  In other words, a
    // matrix of bytes.  We'll initialize every element to 0.
    Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));

    // Dump information about the matrix
    System.out.println("OpenCV Mat: " + m);

    // set row 1 to be all 1s, and then column 5 to be all 5s
    Mat mr1 = m.row(1);
    mr1.setTo(new Scalar(1));
    Mat mc5 = m.col(5);
    mc5.setTo(new Scalar(5));

    // Dump the actual matrix contents
    System.out.println("OpenCV Mat data:\n" + m.dump());

    Ocv ocv = new Ocv();
    ocv.getFilePath();

    /**
     * Find faces in an image.
     *
     * @param filter Path to the xml face finding filter to use
     * @param input Path to the input image file
     * @param output Path to the output image file
     */
    //ocv.findFaces("lbpcascade_frontalface.xml", "C:\\Users\\Wellesley\\Documents\\GitHub\\CSE398\\opencvTutorial\\JavaApplication1\\src\\javaapplication1\\lena.png", "../javaapplication1");
    ocv.setOutput("step2.png");
    ocv.findFaces("", "", "");
    ocv.setOutput("step3.png");
    ocv.cropEachFace("", "");
    ocv.setOutput("step4.png");
    ocv.resizeEachFace("", "");
    ocv.setOutput("step6.png");
    ocv.makeFacesGray("", "", "");
    ocv.setOutput("step8.png");
    ocv.blendWithGray50("", "");
    ocv.setOutput("step10.png");
    ocv.doSobel("", "");
    ocv.setOutput("step11.png");
    ocv.directManip("", "");
}

From source file:neuroimagingdataportal.EdgedetectProcessing.java

public String process(int value1, int value2) {

    this.threshold1 = value1;
    this.threshold2 = value2;
    System.out.println("Welcome to OpenCV " + Core.VERSION);
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
    System.out.println("m = " + m.dump());

    Mat src1;//from  ww  w.j av  a2s.c  o m

    //if ("null".equals(this.url)) {
    //    JOptionPane.showMessageDialog(null, "Please select image to process", "WARNING_MESSAGE", JOptionPane.WARNING_MESSAGE);
    //    return null;
    //} else {
    src1 = imread(url, CV_LOAD_IMAGE_COLOR);
    System.out.println(" read the file" + url);

    // Mat gray, edge, draw;
    gray = new Mat();
    cvtColor(src1, gray, COLOR_BGR2GRAY);

    edge = new Mat();
    draw = new Mat();
    /*
     void Canny(InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false )
     Parameters:
     image  single-channel 8-bit input image.
     edges  output edge map; it has the same size and type as image .
     threshold1  first threshold for the hysteresis procedure.
     threshold2  second threshold for the hysteresis procedure.
     apertureSize  aperture size for the Sobel() operator.
     L2gradient  a flag, indicating whether a more accurate norm. 
     */

    Canny(gray, edge, threshold1, threshold2, 3, false);
    edge.convertTo(draw, CV_8U);

    // write draw mat to the bufferedImage as I think......
    //BufferedImage drawImage = ImageIO.read( (Image) draw);

    Mat src2;

    saveUrl = currentDirectory + "\\" + count + "converted.jpg";

    boolean imwrite;

    imwrite = imwrite(saveUrl, draw);

    System.out.println(" write the image to given file path !!!");

    return saveUrl;

    //}
}

From source file:opencvtuto1.Opencvtuto1.java

/**
 * @param args the command line arguments
 *//*from  w  w  w  . j  a  va  2  s.  c o  m*/
public static void main(String[] args) {
    // TODO code application logic here

    System.out.println("hola mundo opencv version" + Core.VERSION);
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    Mat m = Mat.eye(8, 8, CvType.CV_8UC1);

    System.out.println("m=" + m.dump());

}

From source file:samples.SimpleSample.java

public static void main(String[] args) {

    System.load("C:\\opencv\\build\\java\\x64\\opencv_java310.dll");
    System.out.println(System.getProperty("java.library.path"));
    System.out.println("Welcome to OpenCV " + Core.VERSION);
    Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
    System.out.println("OpenCV Mat: " + m);
    Mat mr1 = m.row(1);//from   w  ww .  j  a v a 2 s.com
    mr1.setTo(new Scalar(1));
    Mat mc5 = m.col(5);
    mc5.setTo(new Scalar(5));
    System.out.println("OpenCV Mat data:\n" + m.dump());
}

From source file:spring2017ip.CameraDemo.java

@Override
public void start(Stage stage) throws Exception {
    this.setMainStage(stage);
    System.out.println(Core.VERSION);
    Parent root = FXMLLoader.load(getClass().getResource("CameraView.fxml"));
    stage.setTitle("OpenCV Camera Demo");

    Scene scene = new Scene(root);

    stage.setScene(scene);//w w w .  j  av a2 s .  c o m
    stage.show();
}