java 导入 org.opencv.highgui 无法解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25890322/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The import org.opencv.highgui cannot be resolved
提问by n1amr
I installed OpenCV (opencv-3.0.0-alpha) and it works proberly but I can't use that import
我安装了 OpenCV (opencv-3.0.0-alpha) 并且它可以正常工作,但我无法使用该导入
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?
我该如何解决这个问题?
回答by berak
in opencv3.0, there is no more highgui module in java.
在 opencv3.0 中,java 中没有更多的 highgui 模块。
the functionality was split up into new videoio and imgcodecs (that's where you will find imread) modules.
该功能被拆分为新的 videoio 和 imgcodecs(您可以在那里找到 imread)模块。
since there is no gui available from java, - no need to have a highgui module anymore.
由于java没有可用的gui,-不再需要highgui模块。
import org.opencv.core.*;
import org.opencv.imgcodecs; // imread, imwrite, etc
import org.opencv.videoio; // VideoCapture
回答by Eoghan Hynes
import org.opencv.imgcodecs.Imgcodecs; // imread, imwrite
Not: org.opencv.imgcodecs;
不是:org.opencv.imgcodecs;
Core.line
, Core.Rectangle
, Core.imread
, Core.imwrite
deprecated.
Core.line
, Core.Rectangle
, Core.imread
,Core.imwrite
已弃用。
Use Imgcodecs.imread
, Imgcodecs.imwrite
, etc.
使用Imgcodecs.imread
,Imgcodecs.imwrite
等等。