Comments (14)
Hi, is there a method in OpenCV to fetch the 2D points, inside the image, where the markers were detected? Background of my question is: I want to sort the detected markers, by their position from left to right.
Thank you.
The coordinates are in the corners
parameter in Aruco.detectMarkers(gray, dictionary, corners, ids, parameters)
which is a List of Mat objects . There is an item in this list for every detected marker id. So, you can try accessing them like this,
Mat coordinates = corners.get(i); //get item in List
List<Point> corners_xy = new ArrayList<>(4);
for (int r = 0; r < coordinates.rows(); r++) {
for (int c = 0; c < coordinates.cols(); c++) {
corners_xy.add(new Point((int)coordinates.get(r,c)[0], (int)coordinates.get(r,c)[1])); // x,y point
}
}
//Access the coordinates of 4 corners
Point top_left = corners_xy.get(0);
Point top_right = corners_xy.get(1);
Point bottom_right = corners_xy.get(2);
Point bottom_left = corners_xy.get(3);
And insert the above code here,
Aruco.detectMarkers(gray, dictionary, corners, ids, parameters);
if(corners.size()>0){
Aruco.drawDetectedMarkers(rgb, corners, ids);
for(int i = 0;i<ids.toArray().length;i++) {
//insert code here
from aruco-android.
It will helpful to us.
Thank You. @RivoLink
from aruco-android.
Hi,
In this file ImageActivity.java, at the line 174, you have the 4 corners 3D positions of each marker, your can use them if you want to sort the detected markers.
Tell me if that doesn't help you.
from aruco-android.
how to display xyz cordinates of the detected markers on screen and when we change the position of marker then it will get updated.
from aruco-android.
With @nitindf codes
You can do :
Point top_left = corners_xy.get(0);
int x = (int)top_left.x;
int y = (int)top_left.y;
String text = String.format("(x: %d, y: %d)", x, y);
Point text_position = new Point(
rgb.cols()/2,
rgb.rows()/2
);
int font_face = Core.FONT_HERSHEY_SIMPLEX;
double font_scale = 1.0;
Scalar font_color = new Scalar(255, 255, 0);
Imgproc.putText(rgb, text, text_position, font_face, font_scale, font_color);
from aruco-android.
How to get Z coordinate ??
from aruco-android.
For a marker, we have 2 positions :
- The position in the real world which has 3d coordinates (x,y,z), and
- The position in the screen which only has 2d coordinates (x, y)
For the 2d coordinates you can have it with above code
For the 3d coordinates, they are stored in tvec=[x,y,z]
, for more information you can refer here :
Get the distance from camera to an OpenCV ArUco Marker
from aruco-android.
Can you explain the whole project through a video??
from aruco-android.
Can you explain the whole project through a video??
+1 yes please ,it will useful to us.
from aruco-android.
Hello
I don't know how to make videos, but I will write an article to explain the project and I will share the link with you.
Thank you for your interest in this project.
from aruco-android.
@RivoLink I want to display x,y,z cordinates of tvec on the graph, So how it can be done?
from aruco-android.
Hi @meet98, sorry for delay.
I created a new branch feature/tvec-coords for your request.
Here's a gist: RivoLink/ImageActivity.java
Open an image containing a marker with the Aruco Android app to view tvec coordinates
May it help you,
You can create a new issue if you have more questions.
from aruco-android.
Hey @RivoLink Thanks for your efforts.
The thing is app is working correctly but sometimes device gets hang or app crashes and i also added another activity in project in which i plot the graph of tvec , so the problem is sometimes app works perfectly but sometimes it gets crash, so is there any specific reason for this issue? and if you have any solution then tell me so that it will helpful for me.
from aruco-android.
Hi @Meett98
Can you create a new issue for this and and I will happy to help you.
from aruco-android.
Related Issues (15)
- No Implementation Found HOT 6
- Aruco center HOT 1
- Aruco calibration board HOT 3
- 3D render HOT 4
- How to get the distance from the marker to the camera?
- Perpendicular axis is being drawn in red (which is the x-axis) and not in blue (z-axis) HOT 1
- Aruco Android HOT 12
- Fix for implemetation, Function to pass bitmap or image to see if it has a aruco marker. HOT 5
- java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.aruco.Aruco.getPredefinedDictionary_0(int) HOT 3
- OpenCVLoader.initDebug() failing on Android 11 HOT 1
- Apk HOT 3
- OpenCVLoader.initDebug() failing HOT 3
- License question HOT 6
- Wrong Detection? How to properly calibrate? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aruco-android.