Log in or register to post comments

how to render teapot when target is detected with cloud

June 20, 2013 - 8:29pm #1

What i need to write so it will render teapot when target is detected with cloud  in sample where imagetargets and cloud recognition are integrated 

how to render teapot when target is detected with cloud

June 25, 2013 - 3:44am #9

Hi alessandroB, i check it again, all remained the same, and when my target is recognized scanning just of target just stops, and with this kind of error in logCat 

 

06-25 16:40:14.865: I/AR(6161): ImageTracker: Successfully created dataset
06-25 16:40:14.975: I/AR(6161): Successfully created ImageTarget.
06-25 16:40:14.975: I/QCAR(6161): Successfully created new trackable 'DecoLab' with rating '1'.
06-25 16:40:14.975: I/QCAR(6161): Recognized target name is 4432616
06-25 16:40:14.995: A/libc(6161): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1)
 
then about activity starts
 
I am not able to understand what is going on, 
 
I also posted on_update method inside cpp  can you  help me to solve this problem, thanks in advance
 
 
 
 
 
 
// Use the following calls if you would like to customize the color of the UI
// targetFinder->setUIScanlineColor(1.0, 0.0, 0.0);
// targetFinder->setUIPointColor(0.0, 0.0, 1.0);
 
// Object to receive update callbacks from QCAR SDK
class ImageTargets_UpdateCallback: public QCAR::UpdateCallback {
virtual void QCAR_onUpdate(QCAR::State& state) { //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) {
 
LOG("Recognized target name is %d",result->getUniqueTargetId());
//snprintf(targetMetadata, CONTENT_MAX, "%s", result->getMetaData());
 
// 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;
}
}
}
}
}
};
 
ImageTargets_UpdateCallback updateCallback;
 

 

how to render teapot when target is detected with cloud

June 21, 2013 - 2:27am #8

Ok, i will try to check it again, thanks

how to render teapot when target is detected with cloud

June 21, 2013 - 1:55am #7

Just check again the tutorial steps, make sure you have implemented both the C++ and the JAVA parts of the tutorial.

 

how to render teapot when target is detected with cloud

June 21, 2013 - 1:04am #6

Can you give some referrence or something , thanks in advance

how to render teapot when target is detected with cloud

June 21, 2013 - 12:46am #5

Yes it detecting it , i check it from last reco   panel from target manager, nothing is rendered

may be I need to write something here inside onUpdate method

 

virtual void QCAR_onUpdate(QCAR::State& state)
    {//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)
                    {
 
 
May be here for example or what, any ideas?
 
 
                    }
 
 
 
                     strcpy(lastTargetId, result->getUniqueTargetId());
 
                     // Stop Cloud Reco scanning
                     targetFinder->stop();
 
                     scanningMode = false;
                     showStartScanButton = true;
                 }
             }
         }
    }
    }

how to render teapot when target is detected with cloud

June 21, 2013 - 12:03am #4

Have you clicked on the Scan button on the screen ?; this will start CloudReco scanning, then if your target has a rating > 0, it should be able to detect it.. 

how to render teapot when target is detected with cloud

June 20, 2013 - 11:33pm #3

yes all stuff was done according to this tutorial, but for example i have my own cloud database and own image targets, i changed client key of tutorial according to own keys, but when i am tracking my target nothing is rendered, teapot is rendered while chips and stones targets  are detected by cloud

how to render teapot when target is detected with cloud

June 20, 2013 - 10:40pm #2

Hi, have you already checked this article:

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

This shows how to integrate CR with Image Target and render a teapot for a cloud target (the relevant rendering code is in renderFrame() function in ImageTarget.cpp)

 

Log in or register to post comments