user5617522
user5617522

Reputation:

The import org.opencv.imgcodecs.Imgcodecs cannot be resolved

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

import org.opencv.core.*;
import org.opencv.imgcodecs.Imgcodecs;

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.imgcodecs.Imgcodecs cannot be resolved

How can I solve this?

Upvotes: 7

Views: 9338

Answers (1)

Gildraths
Gildraths

Reputation: 376

OpenCV 3.0.0 is using the import:

import org.opencv.imgcodecs.Imgcodecs;

However the library you are using (OpenCV 2.4.1) is using different import for the same functionalites:

import org.opencv.highgui.Highgui;

https://fossies.org/diffs/opencv/2.4.11_vs_3.0.0-rc1/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java-diff.html

Basically you are trying to import something that doesn't exist in the version you are using.

Now you can either use Highgui or get the jar for OpenCV 3.1.x

Upvotes: 10

Related Questions