Log in or register to post comments

how to integrate vedioplayback example to cloudrecognization example

May 3, 2013 - 10:53pm #1

hi i can able to paly vedios using vedio play back example but in this vedio play back i want scan action,so it is default in clodreco,but in clodreco sample am able display price but i want display vedio insted price,please i didnt get how to do, i strucked in this part many days onwards,thats why i posted this may times,any one did this before help me please..

how to integrate vedioplayback example to cloudrecognization exa

May 8, 2013 - 4:43am #7

AlessandroB i did change below

Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv* env, jobject obj)
 

now the above line not showing any exception ,please dont mind ask line by line doubts,

in url u said  QCAR_onUpdate() u have  to replace below code

//NEW code for Cloud Reco
QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
              trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
 
// Get the target finder:
QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
 
// Check if there are new results available:
const int statusCode = targetFinder->updateSearchResults();
 
if (statusCode < 0)
{
    char errorMessage[80];
 
    sprintf(errorMessage, "Error with status code %d at frame %d", statusCode,
                state.getFrame().getTimeStamp());
}
else if (statusCode == QCAR::TargetFinder::UPDATE_RESULTS_AVAILABLE)
{
    // Process new search results
    if (targetFinder->getResultCount() > 0)
    {
        const QCAR::TargetSearchResult* result = targetFinder->getResult(0);
 
        // Check if this target is suitable for tracking:
        if (result->getTrackingRating() > 0)
        {
            // Create a new Trackable from the result:
            QCAR::Trackable* newTrackable = targetFinder->enableTracking(*result);
 
             if (newTrackable != 0)
             {
                 LOG("Successfully created new trackable '%s' with rating '%d'.",
 
                 newTrackable->getName(), result->getTrackingRating());
 
                 if (strcmp(result->getUniqueTargetId(), lastTargetId) != 0)
                 {
                      // If the target has changed...
                      // app-specific: do something
                      // (e.g. generate new 3D model or texture)
                  }
 
                  strcpy(lastTargetId, result->getUniqueTargetId());
 
                  // Stop Cloud Reco scanning
                  targetFinder->stop();
 
                  scanningMode = false;
                  showStartScanButton = true;
              }
          }
      }

but actual in imagetargets.cpp  QCAR_onUpdate() is like this

class ImageTargets_UpdateCallback : public QCAR::UpdateCallback
{   
    virtual void QCAR_onUpdate(QCAR::State& /*state*/)
    {
        if (switchDataSetAsap)
        {
            switchDataSetAsap = false;

            // Get the image tracker:
            QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
            QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
            if (imageTracker == 0 || dataSetStonesAndChips == 0 || dataSetTarmac == 0 ||
                imageTracker->getActiveDataSet() == 0)
            {
                LOG("Failed to switch data set.");
                return;
            }
            
            if (imageTracker->getActiveDataSet() == dataSetStonesAndChips)
            {
                imageTracker->deactivateDataSet(dataSetStonesAndChips);
                imageTracker->activateDataSet(dataSetTarmac);
            }
            else
            {
                imageTracker->deactivateDataSet(dataSetTarmac);
                imageTracker->activateDataSet(dataSetStonesAndChips);
            }
        }
    }
};
 

so i repace code  like below  in QCAR_onUpdate() method but if i gave like this means am getting so many exceptions while building  exactly wat i have to change in imagetargets.cpp

 

// Object to receive update callbacks from QCAR SDK
class ImageTargets_UpdateCallback : public QCAR::UpdateCallback
{   
    virtual void QCAR_onUpdate(QCAR::State& /*state*/)
    {
        if (switchDataSetAsap)
        {
            switchDataSetAsap = false;

            //NEW code for Cloud Reco
            QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
            QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                          trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
             
            // Get the target finder:
            QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
             
            // Check if there are new results available:
            const int statusCode = targetFinder->updateSearchResults();
             
            if (statusCode < 0)
            {
                char errorMessage[80];
             
                sprintf(errorMessage, "Error with status code %d at frame %d", statusCode,
                            state.getFrame().getTimeStamp());
            }
            else if (statusCode == QCAR::TargetFinder::UPDATE_RESULTS_AVAILABLE)
            {
                // Process new search results
                if (targetFinder->getResultCount() > 0)
                {
                    const QCAR::TargetSearchResult* result = targetFinder->getResult(0);
             
                    // Check if this target is suitable for tracking:
                    if (result->getTrackingRating() > 0)
                    {
                        // Create a new Trackable from the result:
                        QCAR::Trackable* newTrackable = targetFinder->enableTracking(*result);
             
                         if (newTrackable != 0)
                         {
                             LOG("Successfully created new trackable '%s' with rating '%d'.",
             
                             newTrackable->getName(), result->getTrackingRating());
             
                             if (strcmp(result->getUniqueTargetId(), lastTargetId) != 0)
                             {
                                  // If the target has changed...
                                  // app-specific: do something
                                  // (e.g. generate new 3D model or texture)
                              }
             
                              strcpy(lastTargetId, result->getUniqueTargetId());
             
                              // Stop Cloud Reco scanning
                              targetFinder->stop();
             
                              scanningMode = false;
                              showStartScanButton = true;
                          }
                      }
                  }
        }
    }
};

how to integrate vedioplayback example to cloudrecognization exa

May 6, 2013 - 11:06pm #6

hi am trying using   your code to integrate imagetargets to cloudreco sample application ,but in in imagetargets.cpp in UpdateCallback() i replace this code

 

class ImageTargets_UpdateCallback : public QCAR::UpdateCallback
{   
    virtual void QCAR_onUpdate(QCAR::State& /*state*/)
    {
        if (switchDataSetAsap)
        {
            switchDataSetAsap = false;
     //NEW code for Cloud Reco
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
                  trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
 
    // Get the target finder:
    QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
 
    // Check if there are new results available:
    const int statusCode = targetFinder->updateSearchResults();
 
    if (statusCode < 0)
    {
        char errorMessage[80];
 
        sprintf(errorMessage, "Error with status code %d at frame %d", statusCode,
                    state.getFrame().getTimeStamp());
    }
    else if (statusCode == QCAR::TargetFinder::UPDATE_RESULTS_AVAILABLE)
    {
        // Process new search results
        if (targetFinder->getResultCount() > 0)
        {
            const QCAR::TargetSearchResult* result = targetFinder->getResult(0);
 
            // Check if this target is suitable for tracking:
            if (result->getTrackingRating() > 0)
            {
                // Create a new Trackable from the result:
                QCAR::Trackable* newTrackable = targetFinder->enableTracking(*result);
 
                 if (newTrackable != 0)
                 {
                     LOG("Successfully created new trackable '%s' with rating '%d'.",
 
                     newTrackable->getName(), result->getTrackingRating());
 
                     if (strcmp(result->getUniqueTargetId(), lastTargetId) != 0)
                     {
                          // If the target has changed...
                          // app-specific: do something
                          // (e.g. generate new 3D model or texture)
                      }
 
                      strcpy(lastTargetId, result->getUniqueTargetId());
 
                      // Stop Cloud Reco scanning
                      targetFinder->stop();
 
                      scanningMode = false;
                      showStartScanButton = true;
                  }
              }
          }
    }
    }
 
 
    }
};
 
where i did mistake in the above code. above code i paseted in Imagetargets.cpp while building ndk i am getting below error
 
Compile++ arm    : ImageTargets <= ImageTargets.cpp
jni/ImageTargets.cpp: In member function 'virtual void ImageTargets_UpdateCallback::QCAR_onUpdate(QCAR::State&)':
jni/ImageTargets.cpp:148:21: error: 'state' was not declared in this scope
jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv*, jobject)':
jni/ImageTargets.cpp:451:25: error: 'env' was not declared in this scope
jni/ImageTargets.cpp:451:45: error: 'obj' was not declared in this scope
jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_startCamera(JNIEnv*, jobject)':
jni/ImageTargets.cpp:768:58: error: 'class QCAR::Tracker' has no member named 'getTargetFinder'
jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_stopCamera(JNIEnv*, jobject)':
jni/ImageTargets.cpp:787:54: error: 'class QCAR::Tracker' has no member named 'getTargetFinder'
/cygdrive/c/Development/Android/android-ndk-r8/build/core/build-binary.mk:272: recipe for target `obj/local/armeabi/objs/ImageTargets/ImageTargets.o' failed
make: *** [obj/local/armeabi/objs/ImageTargets/ImageTargets.o] Error 1
 
 

 

 

 

how to integrate vedioplayback example to cloudrecognization exa

May 6, 2013 - 5:06am #5

thanks alot surly i ll follow and let you

how to integrate vedioplayback example to cloudrecognization exa

May 6, 2013 - 3:28am #4

Hi radhach,

my suggestion would be to take things gradually and incrementally; perhaps the best is to familiarize with the key implementation parts of the CloudReco;

probably here the nicest tutorial we have is this:

https://developer.vuforia.com/forum/faq/android-how-integrate-cloudreco-imagetargets-sample

That tutorial explains how to enable the Cloud Reco feature starting from the simplest of our samples, i.e. the ImageTargets sample; what is nice about that tutorial is that it just provides the very minimum amount of code additions that you need to add to the Image targets code, and so it should help you to grasp the relevant part of Cloud Reco code.

Once you have gone through it, you could mpve to the next step, i.e. integrating VideoPlayback features on top of it.

 

how to integrate vedioplayback example to cloudrecognization exa

May 5, 2013 - 9:40pm #3

i tried so many days onwards to integrate vedioplay back,cloudreco sample application but i didnt get any idea to implement,if you don't mind if have time try this and help me AlessandroB please

how to integrate vedioplayback example to cloudrecognization exa

May 4, 2013 - 1:53pm #2

Hi,

We don't have a specific tutorial that guides you step by step in how to integrate VideoPlayback and CloudReco, but you can take a look at the "Sample Specific Notes" sections of the two samples, which explains the main elements of the sample code.

 

https://developer.vuforia.com/resources/sample-apps/cloud-recognition-sample-app

https://developer.vuforia.com/resources/sample-apps/video-playback-sample-app

 

Log in or register to post comments