n1amr
n1amr

Reputation: 178

The import org.opencv.highgui cannot be resolved

I installed OpenCV (opencv-3.0.0-alpha) and it works proberly but I can't use that import

import org.opencv.core.*;
import org.opencv.highgui.Highgui;

public class Main {

    public static void main(String[] args) {

//      System.loadLibrary("opencv_java244");
//      Mat m = Highgui.imread("C:/Users/raj/Desktop/sa1.png",
//              Highgui.CV_LOAD_IMAGE_COLOR);
//      new LoadImage("C:/Users/raj/Desktop/dst1.jpg", m);
    }
}

I get this error

The import org.opencv.highgui cannot be resolved

How can I solve this?

Upvotes: 6

Views: 23570

Answers (2)

Eoghan Hynes
Eoghan Hynes

Reputation: 41

import org.opencv.imgcodecs.Imgcodecs; // imread, imwrite

Not: org.opencv.imgcodecs;

Core.line, Core.Rectangle, Core.imread, Core.imwrite deprecated.

Use Imgcodecs.imread, Imgcodecs.imwrite, etc.

Upvotes: 0

berak
berak

Reputation: 39806

in opencv3.0, there is no more highgui module in java.

the functionality was split up into new videoio and imgcodecs (that's where you will find imread) modules.

since there is no gui available from java, - no need to have a highgui module anymore.

import org.opencv.core.*;
import org.opencv.imgcodecs; // imread, imwrite, etc
import org.opencv.videoio;   // VideoCapture

Upvotes: 16

Related Questions