How to use vuforia on PC Application

Patrick picture Patrick · Feb 12, 2013 · Viewed 7.7k times · Source

i'm new on vuforia and i need some help with this topic. Can someone tells me if its possible use vuforia with a webcam on a pc application? I got webcam frames on a plane texture and i tried to pass those textures to vuforia but i have not got it work.

I used WebCamTexture to get frames of webcam.

Answer

Joetjah picture Joetjah · Feb 13, 2013

I'm not familiar with Vuforia (although it looks interesting, I'm going to try that out myself this weekend!), I might have a suggestion.

Is it possible Vuforia doesn't know what to do because of the images being WebCamTexture instead of something like Texture2d?

WebCamTexture is a Texture (Texture2D, WebCamTexture, RenderTexture all extend from Texture but they aren't exchangeable).

So, try to convert your texture and pass that on to Vuforia?

var tx2d = new Texture2D();
tx2d.SetPixels((go.renderer.material.mainTexture as WebCamTexture).GetPixels());

EDIT: What I found here, under the section Running in the editor:

There is a specific Web Cam Behaviour script.

To use Play Mode for Vuforia in Unity Pro, simply select the attached, or built-in, webcam that you want to use from the Camera Device menu, and then activate Play Mode using the Play button at the top of the Editor UI.

You can also use the standard Unity Play Mode with non-Pro Unity versions and by setting ‘Don’t use for Play Mode’ in the Web Cam Behaviour component.

To use standard Play Mode, adjust the transform of the ARCamera object to get your entire scene in view, and then run the application in the Unity editor. There is no live camera image or tracking in standard Play Mode, instead all Targets are assumed to be visible. This allows you to test the non-AR components of your application, such as scripts and animations, without having to deploy to the device each time.