Open rgm-22 opened 2 years ago
Hi @rgm-22
I'm glad this project helped you.
I haven't been able to work on the 3d rendering yet but I have an augmented reality project that renders 3D objects perfectly on vuforia markers here : https://github.com/RivoLink/Vuforia-Android
Regards.
Thank you very much for your answer, @RivoLink !
I have already checked out that project: pretty cool ;)
The thing is that I want to access the camera using OpenCV, which is not the case, isn't it?
Thank you again :+1:
Hi @rgm-22
Yes, Vuforia-Adroid does not use OpenCV.
I will try to rework on this application and I will let you know if I manage to set up the 3D rendering.
Regards.
Hi @RivoLink!
Thank you very much for your answer.
That would be great! :)
Sorry, I don't have any idea about 3D rendering and perhaps if you succeed placing a simple cube on an aruco origin, it would be very helpful to learn.
Thank you again!
Is 3D rendering available now? If it hasn't been implemented yet, I have something to share with you. I understand that the 3D render issue (#13) was caused by the Object3D not appearing. If my understanding is correct, there's a simple way to make the Object3D visible.
(Step 1) Select a specific ID from ids of type MatOfInt We will make Object3D appear only on a specific marker. Specify it as an integer variable (e.g., private final int SELECT_MARKER_ID = 17;). The reason for doing this part was because an error occurred because multiple IDs were recognized at once.
(Step 2) Add code to detect SELECT_MARKER_ID inside the for(int i = 0; i < ids.toArray().length; i++) statement in onCameraFrame method in MainActivity.java. For example, I added this code: if(ids.toArray()[i] == SELECT_MARKER_ID){ transformModel(tvecs.row(i), rvecs.row(i)); }
(Step 3) In transform method in Renderer3D.java, remove this code: if(!model.isVisible()) model.setVisible(true);
and make this part a separate method. For example: public void setModelVisibility(boolean visible) { if (visible) { model.setVisible(true); } else { model.setVisible(false); } }
(Step 4) Uncomment the transform code where it says / Some bugs here. /.
(Step 5) Use the setModelVisibility method in MainActivity.java. In onCameraFrame: if (corners.size() > 0) { . . . } else if (corners.size() <= 0) { renderer.setModelVisibility(false); }
In transformModel: public void run() { renderer.setModelVisibility(true);
This way, I was able to see the cube appear when marker 17 was recognized.
Hello @SoonBe
Thanks for your interest.
The main problem is not the rendering of the 3D model, it will work fine with your approach, but the problem is how to rotate/scale the 3D model to render it correctly above the marker.
For example, if the marker is tilted vertically, how to render the model with this tilt but still above the marker
Something like this Vuforia Android but with OpenCV
https://github.com/user-attachments/assets/73b46baf-3e1c-4404-aa97-5bd995a55489
Hi @RivoLink!
Thank you very much for sharing this project.
Did you figure out how to properly make the 3D rendering?
I really appreciate any help you can provide :).