Import org.opencv.imgcodecs.Imgcodecs cannot be allowed

I installed OpenCV (opencv-3.0.0-alpha) and it works correctly, but I cannot use this 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

Import org.opencv.imgcodecs.Imgcodecs cannot be allowed

How can i solve this?

+5
source share
1 answer

OpenCV 3.0.0 uses import:

 import org.opencv.imgcodecs.Imgcodecs; 

However, the library you are using (OpenCV 2.4.1) uses a different import for the same functions:

 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 does not exist in the version you are using.

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

+5
source

All Articles