Log in or register to post comments

How can I get defined width and height in xml of an trackable image?

March 29, 2012 - 10:18pm #1

How can I get defined width and height in xml of an trackable image? As I saw, I think it is related with QCAR::ImageTarget; however, I do not know how to use it

You're welcome.

January 11, 2013 - 11:08am #7

You're welcome.

resolved

January 11, 2013 - 8:53am #6

yes i had resolved in the same way.

 

 

assert(result->getType() == QCAR::TrackableResult::IMAGE_TARGET_RESULT);

        const QCAR::ImageTargetResult* imageResult = static_cast<

                                    const QCAR::ImageTargetResult*>(result);

        const QCAR::ImageTarget& imageTarget = imageResult->getTrackable();

 

thanks a lot :)

Specifically for the code you

January 11, 2013 - 6:40am #5

Specifically for the code you mention, the sample code I report here below compiles correcty, and you can use it as reference:

#include <QCAR/Trackable.h>

#include <QCAR/TrackableResult.h#include <QCAR/ImageTarget.h>

#include <QCAR/ImageTargetResult.h>

...

 

for(int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++)

{

const QCAR::TrackableResult* result = state.getTrackableResult(tIdx);

const QCAR::ImageTargetResult* imageTargetResult = static_cast<const QCAR::ImageTargetResult*>(result);

const QCAR::Trackable& trackable = result->getTrackable();

const QCAR::ImageTarget& imageTarget = static_cast<const QCAR::ImageTarget&>(trackable);

 

 

Hi, Vuforia 2.0 has

January 11, 2013 - 6:32am #4

Hi, Vuforia 2.0 has introduced some changes in the API;

these are explained in detail in the migration guide here:

https://developer.vuforia.com/resources/dev-guide/migrating-your-android-sdk-project

Note that the migration guide has three sections:

-one section about new API

-one section about modified API

-one section about how to migrate your code using Image Targets as a reference

I hope this will answer your questions.

cast not working

January 11, 2013 - 5:57am #3

With vuforia-sdk-android-2-0-29 the cast suggested not working, it generate

error: invalid static_cast from type 'const QCAR::Trackable' to type 'QCAR::ImageTarget*'

in building.

Are there other solutions?

Re: How can I get defined width and height in xml of an trackabl

March 30, 2012 - 5:26pm #2

If you know your trackable is an ImageTarget you can cast it and call getSize:

QCAR::ImageTarget* imageTarget = static_cast<QCAR::ImageTarget*>(trackable);
QCAR::Vec2F targetSize = imageTarget->getSize();

Make sure you add the ImageTarget.h include:

#include <QCAR/ImageTarget.h>

- Kim

Log in or register to post comments