augmented reality - How can i change image targets and video in videoplayback of qualcomm sdk in android


Keywords:android 


Question: 

How can i change image targets and video in videoplayback of qualcomm sdk, i have got dat and xml file for two new target images but now able to play video for those image targets, what steps should i follow two work it for two new target images and play video corresponding.


2 Answers: 

you have to give refrence of those XML in your Project just like the Reference given of the other XML for this here is sample that is also in ImageTarget Project. In image target Project there is a method in JNI Imagetarget.cpp

Java_com_qualcomm_QCARSamples_Imagtargets_Imagetargets_loadTrackerData(JNIEnv *, jobject)

this method is dealing with multiple XML Files it will help you how to load multiple XMLS

on the contrary if you want to detect multiple markers but with single XML and DAt file recognise your targets from the Vuforia Server combine it in single Xml file and then u can use like this

static const int NUM_TARGETS =4;
static const int Test1 = 0;
static const int Test2 = 0;
static const int Test3 = 0;
static const int Test4 = 0;
static const int Test5 = 0;

and in renderframe method o like this

if (strcmp(trackable->getName(), "Test1 ") == 0)
            currentTarget=Test1 ;
if (strcmp(trackable->getName(), "Test2 ") == 0)
            currentTarget=Test2 ;
if (strcmp(trackable->getName(), "Test3 ") == 0)
            currentTarget=Test3 ;
if (strcmp(trackable->getName(), "Test4 ") == 0)
            currentTarget=Test4 ;
if (strcmp(trackable->getName(), "Test5 ") == 0)
            currentTarget=Test5 ;
 

if you just want new image to be tracked and new video should play go through this:

for new target image:

replace dat and xml in asset folder in android videoplayback sample project with your dat and xml downloaded from Vuforia trackermaneger site. and don't forget to rename them to default if you don't want to build again JNI code.

for new video to be played : either you replace video file in asset folder with same name or (i recommend this) you use any server url as video link,like this-

Uri videolink = Uri.parse("http://commonsware.com/misc/test2.3gp");
                        mMediaPlayer.setDataSource(mParentActivity,videolink);

in videoplaybackhelper class

hope this helps