The import org.opencv.highgui cannot be resolved

匿名 (未验证) 提交于 2019-12-03 08:44:33

问题:

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?

回答1:

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 


回答2:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!