eclipse Java OpenCV - 缺少 org.opencv.core.Core rectangle() 方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26845885/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:11:25  来源:igfitidea点击:

Java OpenCV - org.opencv.core.Core rectangle() method missing

javaeclipseopencvimport

提问by user3182445

I have openCV-3.0.0 alpha and I found a sample code on the openCV tutorials website. I used to same code and compiled it, but eclipse tells me that the rectangle()method in the org.opencv.core.Coreclass cannot be found. I checked the class myself and indeed could not find this method. Does anyone know in which class this method is now stored in? I found a similar problem with the org.opencv.highgui.Highguiclass which was discontinued in the openCV-3.0.0 and replaced by org.opencv.imgcodecs.Imgcodecs

我有 openCV-3.0.0 alpha,我在 openCV 教程网站上找到了一个示例代码。我曾经用相同的代码编译它,但是eclipse告诉我找不到类中的rectangle()方法org.opencv.core.Core。我自己查了类,确实找不到这个方法。有谁知道这个方法现在存储在哪个类中?我发现org.opencv.highgui.Highgui在 openCV-3.0.0 中停止并由org.opencv.imgcodecs.Imgcodecs

回答by Kokou Egbewatt

it is found in org.opencv.imgproc.Imgprocpackage, e.g.

它可以在org.opencv.imgproc.Imgproc包中找到,例如

Imgproc.rectangle(webcam_img, null, null, null);

回答by Nemaky

in OpenCV 3.0.0 you should change

在 OpenCV 3.0.0 你应该改变

import org.opencv.highgui.Highgui;to import org.opencv.imgcodecs.Imgcodecs;, Highgui.imread()to imgcodecs.imread(), Core.rectangle()to imgproc.rectangle(), Highgui.imwrite()to imgcodecs.imwrite()

import org.opencv.highgui.Highgui;import org.opencv.imgcodecs.Imgcodecs;Highgui.imread()imgcodecs.imread()Core.rectangle()imgproc.rectangle()Highgui.imwrite()imgcodecs.imwrite()

take a look at this link https://fossies.org/diffs/opencv/2.4.11_vs_3.0.0-rc1/samples/java/sbt/src/main/java/DetectFaceDemo.java-diff.html

看看这个链接 https://fossies.org/diffs/opencv/2.4.11_vs_3.0.0-rc1/samples/java/sbt/src/main/java/DetectFaceDemo.java-diff.html