Hi all ,
I am getting the good output when I am using the ImageTargets Projects for detecting my logo . Now I have to display the distance in the UILabel . For calculating the distance I have used the below code in the EAGLView.mm .
QCAR::Matrix34F pose = result->getPose();
QCAR::Vec3F position(pose.data[3], pose.data[7], pose.data[11]);
float distance = sqrt(position.data[0] * position.data[0] +
position.data[1] * position.data[1] +
position.data[2] * position.data[2]);
NSLog(@"distance: %f", distance);
Kindly tell me in which class I have to add the UILabel code . And what what are the units which I am getting in the distance variable . My Target image size which I have in the database is 247 and the image size on which I have focused the camera is 800 . Please tell me . Thanks in advance .
display distance in UILabel in ImageTargets Project
If you try and add the code for the UI Label directly in RenderFrameQCAR it will not work because it gets called in a background thread.
To make it work you need to wrap the code in a method that can get called onthe main thread by using PerformSelectorOnMainThread.
display distance in UILabel in ImageTargets Project
Thank you so much . You helped me a lot . One more last question is I have uploaded the 248 pixels width image and my printed image size is 800 pixels . So If I use this method
display distance in UILabel in ImageTargets Project
Hi srinu4950,
I think David Beard explained the key points in this thread:
https://developer.vuforia.com/forum/android/i-am-getting-distance-fine-values-cm-millimeters-which-format
display distance in UILabel in ImageTargets Project
Thank you NalinS