How to get distance from object by camera?

0 votes
asked Jan 29, 2020 by bigbaak (720 points)
edited Jan 29, 2020 by bigbaak
Unity3d EasyAR 4.0 C#

Scene: MotionTracking

I have QR code.  It's real size 18cm x 18cm and his pixel size is 340px x 340px on picture and i can tracking image on the picture, but i didn't know distance qr code between camera. So, how i can calculate distance or put 3d object on the QR code? Any idea?

1 Answer

0 votes
answered Jan 29, 2020 by kenn (18,790 points)
If the image target scale has been set to real size (for reference, we have set namecard and idback target to real scale in the samples), then everything in the 3D scene is in real size. The distance of two objects in the 3D scene would be the distance in the real world.

A little more: In worldRoot center condition, MotionTracking moves the camera relative to the worldRoot as if the camera moves in the real world; And ImageTracking moves ImageTarget relative to camera as if the image stay/move in the real world only if the scale is same as the object in the real world.
commented Jan 29, 2020 by bigbaak (720 points)
I understand your idea. I need generate a picture of the QR code and save into the phone’s memory, after reading real QR code.  Then I need inititliaze new ImageTarget with QR code generated and tracking it.
I thought about it in past. But, In my situation i can't do it. Because, In my QR code center have logo and another image effects *:( This is an idea from designers .

What i did? I did stabilize 3d object in the scene by math formula "Standard Deviation and Variance". It's working very well, but without parameter distance i can't put him correct place in real world.
commented Jan 30, 2020 by kenn (18,790 points)
So, if I am on the right direction, it is a problem of distance estimation of a real-world object which is not yet recognized in the tracking system, right?
But before that, I am confused with “i can tracking image on the picture”. I thought it meant you were using an image already for tracking, and the QR code is at somewhere in the image. But it now looks like the image == QR code?
And I do not understand why image tracking do not work in your situation? “logo and another image effects” would help tracking. I must have missed something.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...