John Slaine
John Slaine

Reputation: 192

Can't resolve an Import in JavaCV

I've been trying to make a computer vision project using OpenCV/JavaCV and I want to store an image into a Mat variable using imread.

This is what I'm doing: Mat img=imread("C:/Reference/to/Pic.jpg");

It's no compiling since an import is not resolved, specifically this one.

import static org.bytedeco.javacpp.opencv_imgcodecs.imread; Its telling me that "The import org.bytedeco cannot be resolved".

All my other imports are seemingly working as intended. What's the problem here? Is this not the import for imread? Is there a problem with the installation of OpenCV/JavaCV?

Upvotes: 1

Views: 4084

Answers (3)

I know it's too late. I found this useful.In fact Javacv and org.byteco dependencies version are not compatible.So,In maven repository,If you want to use Javacv dependency You can find the compatible dependencies of org.bytedeco.op below listed as Compile dependencies(x) I hope,it can help

Upvotes: 0

Med Aziz
Med Aziz

Reputation: 33

If you want to read an image and store it into a Mat variable you can simply use Highgui.imread(). I don't see why you want to use JavaCv when Opencv gives you all what you may need.

Upvotes: 1

Emad
Emad

Reputation: 799

It seems that OpenCV/JavaCV has some dependency which is not added to your project. org.bytedeco.javacpp.opencv_imgcodecs.imread is located in javacpp-preset repository which is github repo in https://github.com/bytedeco/javacpp-presets.

First of all, I suggest to read the README.md for javaCV repository carefully to findout how to import javaCV to your project. This was clearly explained in JavaCV README.md:

Manual Installation

Simply put all the desired JAR files (opencv*.jar, ffmpeg*.jar, etc.), in addition to javacpp.jar and javacv.jar, somewhere in your class path. Here are some more specific instructions for common cases:

Upvotes: 2

Related Questions