admin管理员组文章数量:1123566
I'm trying to set up Aruco marker detection in an Android studio Java application. Currently I'm generating my markers in python using this OpenCV aruco dictionary I create:
dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50)
However I cannot then refer to a similar dictionary to then detect these markers created in my java code.
My java code is as below:
Dictionary dictionary = Dictionary.getPredefinedDictionary(Dictionary.DICT_4X4_50);
However this gives the errors:
Cannot resolve method 'getPredefinedDictionary' in 'Dictionary'
Cannot resolve symbol 'DICT_4X4_50'
It seems that I only have these methods for Dictionary, with no sign of the getPredefinedDictionary
method:
__fromPtr__(long addr)
getBitsFromByteList(Mat byteList, int markerSize)
class
getByteListFromBits(Mat bits)
Is there something wrong in how I am using OpenCV
or the dictionary?
This is how I am importing everything:
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.ArucoDetector;
import org.opencv.objdetect.Dictionary;
I'm trying to set up Aruco marker detection in an Android studio Java application. Currently I'm generating my markers in python using this OpenCV aruco dictionary I create:
dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50)
However I cannot then refer to a similar dictionary to then detect these markers created in my java code.
My java code is as below:
Dictionary dictionary = Dictionary.getPredefinedDictionary(Dictionary.DICT_4X4_50);
However this gives the errors:
Cannot resolve method 'getPredefinedDictionary' in 'Dictionary'
Cannot resolve symbol 'DICT_4X4_50'
It seems that I only have these methods for Dictionary, with no sign of the getPredefinedDictionary
method:
__fromPtr__(long addr)
getBitsFromByteList(Mat byteList, int markerSize)
class
getByteListFromBits(Mat bits)
Is there something wrong in how I am using OpenCV
or the dictionary?
This is how I am importing everything:
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.ArucoDetector;
import org.opencv.objdetect.Dictionary;
Share
Improve this question
asked 15 hours ago
OliOli
314 bronze badges
New contributor
Oli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3
|
1 Answer
Reset to default 2To resolve this I used Objdetect's getPredefinedDictionary method as shown below:
for the import:
import org.opencv.objdetect.Objdetect;
And for the usage in code:
Dictionary dictionary = Objdetect.getPredefinedDictionary(Objdetect.DICT_4X4_50);
本文标签:
版权声明:本文标题:Android StudioJava Cannot resolve symbol 'getPredefinedDictionary' when using OpenCV (4.11.0) Dictionary - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736568659a1944740.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
getPredefinedDictionary
static (or instance) method so you may need to explain your expectation. Include a reference to the docs you are using and specifically the library used. Note the Aruco class does have this static method (but that is version 3.4) and the referenced constant. – Computable Commented 15 hours agogetPredefinedDictionary
is found in theObjdetect
class - docs here. As well as the constants required. Give that a try and update and that can be added as solution. – Computable Commented 15 hours ago