Opencv import highgui in android studio is showing error.Cannot resolve(I added the library still the error remain)

我的梦境 提交于 2019-12-05 01:09:21

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.

import org.opencv.core.*;
import org.opencv.imgcodecs; // imread, imwrite, etc
import org.opencv.videoio;   // VideoCapture

EDIT: Change img=Highgui.imread(pathtoimage); to img = Imgcodecs.imread(pathtoimage);

and Core.rectangle(img, tl, br, color); to Imgproc.rectangle(img, t1, br, color);

I will also suggest go through OpenCV 3.0 modules to resolve these errors.

Depending on the file structure it may instead be:

import org.opencv.imgcodecs.Imgcodecs;

There is no Highgui module in OpenCV 3.0+ instead you can use the same Imgcodecs module

The old one

Highgui.imread(fileName, Highgui.CV_LOAD_IMAGE_GRAYSCALE)
Highgui.imread(fileName)

The New one

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