Log in or register to post comments

Getting the image used for a UserDefinedTarget

January 28, 2013 - 11:49am #1

Building on the UserDefinedTargets sample app I wish to incorporate a verification step such that when the user clicks the camera button to register a new user defined trackable I can display the image taken and request verification that this is the image they wish to use.  At the same time I would also get them to input some dimensions so that I can properly scale game objects so they match real world size against the camera background.

In the ImageTargets sample I can see the image in the material clearly assigned to the tracker game object but the user defined target does not get built in the same way.  Is there a way to get at it or do I need to grab my own screenshot at the same time the build gets launched and assume they are nearly the same?

Thanks for your time,

Sterling

Getting the image used for a UserDefinedTarget

July 31, 2013 - 1:38pm #8

My solution ended up migrating to a set of prebuilt cloud images.  Scale to real world was a must and askign the user to input the dimensions of the thing they just took a picture of was too unreliable.  You can take a screenshot in Unity basically at the same time and present that to the user to verify.  I imagine you could also use the cloud API to upload it but in most situations I would expect those results to be sub-par unless the users are very careful about how they frame the target or help do some post-processing to crop it before you upload.

First, that type of solution ends up being very reliant on the quality of image generated by the user.  If they have the camera farther away then your image contains part of the desk or floor that they had their target sitting on and if they are closer in then it does not contain the whole item.  If your app requires scale to real world to be accurate then you will probably not get the dimensions of the target correct for the cloud.  Secondly, since Vuforia currently restricts the camera quality to optimize speed and tracking your screenshot may not have the quality you want for the cloud recognition to be the best it can.

The second part you can try to dodge by having Unity call out to native ios, stop QCAR in Unity, open the camera at max quality in ios, grab a quick screenshot, and then restart QCAR.  This takes a little time but it works fast enough that you can get a high res screenshot that is in the same place especially once users get used to seeing the ios camera lens animation... they will probably hold still until it completes.

Getting the image used for a UserDefinedTarget

July 31, 2013 - 6:49am #7

Here are instructions and sample code for capturing screen shots in Unity - https://developer.vuforia.com/resources/dev-guide/unity-screenshots

Getting the image used for a UserDefinedTarget

July 31, 2013 - 3:55am #6

Hi, i'm trying to do a similar task, have you done this? 

I would get the texture2D from camera in UserDefinedTarget Example to send the image built to the cloud server (i just done this).

My problem is that i tried to acces to the render texture of TextureBufferCamera and it works on play mode on pc, but i figured out that this object has not been created on android device, also the BackgroundCamera, i can't access them to taking a sort of camera screenshot.

Can you help me?

Getting the image used for a UserDefinedTarget

May 11, 2013 - 3:15pm #5

Did grabbing the screenshot at the same time of the building of the ImageTarget work walkertuesday? I would like to use that approach as well.

Getting the image used for a UserDefinedTarget

January 29, 2013 - 8:38am #4

Hi, you cannot explicitly retrieve the source image from the built target  (as the API does not offer such feature);

however you could simply capture the current camera image (i.e. the current video frame) at the same time when building the target (i.e. you cannot get the image from the target itself, but you can get the video frame from QCAR)

see:

https://developer.vuforia.com/resources/dev-guide/unity-camera-image-access

 

So, I think the process you propose here might actually work, if coded properly.

 

 

Getting the image used for a UserDefinedTarget

January 29, 2013 - 8:30am #3

Thanks Alessandro.  Just so I am complete on the subject, is there no way after the user target has been built to get access to the image that the target is built to recognize?  I understand I cannot use an old image or send my own into the user defined target creation but could I do this:

1. User clicks the create button and a new user target is generated (from the video stream as usual), making the Unity game object tracker

2. Access the new game object to fetch the image it was built from

3. Request verification from the user and if they reject it delete the tracker game object (maybe there is also some deregister process to clean up information in the QCAR Manager about the removed tracker?)

From your response I am guessing this is also not possible but I want to make sure I check all the possibilities before going to a backup plan.

Again, thanks for your time to respond and I have been having a great experience so far with Vuforia and the Unity plugin.

Getting the image used for a UserDefinedTarget

January 29, 2013 - 12:24am #2

Hi, the User Defined Targets feature does not allow you to "freeze" the image in time (so that you can confirm later, after the verification step that you describe);

when you actually tell the ImageTargetBuilder to build, it will take the current video frame; so for instance it is not possible to build a target from a camera image of 5 seconds ago (just as an example);

this will make your "verification step" a bit difficult to implement, I'm afraid;

also, to make a preview of the image you will need to grab your own screenshot, as you say; this article (from the Vuforia "Knowledge Base" article set) might be of help to do that:

https://developer.vuforia.com/resources/dev-guide/unity-camera-image-access

 

 

Log in or register to post comments