예제 #1
0
// ----------------------------------------------------------------------------
// Enables CloudReco Service
// ----------------------------------------------------------------------------
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_CloudRecognition_CloudReco_enterScanningModeNative(JNIEnv*, jobject)
{
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
            trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
    assert(imageTracker != 0);
    QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
    assert (targetFinder != 0);

    // Start CloudReco
    crStarted = targetFinder->startRecognition();

    // Clear all trackables created previously:
    targetFinder->clearTrackables();

    scanningMode = true;

    // Updates state variables
    showAnimation3Dto2D = false;
    showAnimation2Dto3D = false;
    isShowing2DOverlay = false;
    renderState = RS_SCANNING;

}
예제 #2
0
// ----------------------------------------------------------------------------
// Starts the Camera
// ----------------------------------------------------------------------------
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_CloudRecognition_CloudReco_startCamera(JNIEnv *, jobject)
{
    // Initialize the camera:
    if (!QCAR::CameraDevice::getInstance().init())
    return;

    // Configure the video background
    configureVideoBackground();

    // Select the default mode:
    if (!QCAR::CameraDevice::getInstance().selectVideoMode(
                    QCAR::CameraDevice::MODE_DEFAULT))
    return;

    // Start the camera:
    if (!QCAR::CameraDevice::getInstance().start())
    return;

    // Start the tracker:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
            trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));
    assert(imageTracker != 0);
    imageTracker->start();

    // Start cloud based recognition if we are in scanning mode:
    if(scanningMode)
    {
        QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
        assert (targetFinder != 0);
        crStarted = targetFinder->startRecognition();
    }
}
JNIEXPORT void JNICALL
Java_rajawali_vuforia_RajawaliVuforiaActivity_startCamera(JNIEnv *env,
		jobject object) {
	LOG("Java_rajawali_vuforia_RajawaliVuforiaActivity_startCamera");

	// Select the camera to open, set this to QCAR::CameraDevice::CAMERA_FRONT
	// to activate the front camera instead.
	QCAR::CameraDevice::CAMERA camera = QCAR::CameraDevice::CAMERA_DEFAULT;

	// Initialize the camera:
	if (!QCAR::CameraDevice::getInstance().init(camera))
		return;

	// Configure the video background
	configureVideoBackground();

	// Select the default mode:
	if (!QCAR::CameraDevice::getInstance().selectVideoMode(
			QCAR::CameraDevice::MODE_DEFAULT))
		return;

	// Start the camera:
	if (!QCAR::CameraDevice::getInstance().start())
		return;

	// Start the tracker:
	QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	QCAR::Tracker* markerTracker = trackerManager.getTracker(
			QCAR::MarkerTracker::getClassType());
	if (markerTracker != 0)
		markerTracker->start();

	QCAR::ImageTracker* imageTracker =
			static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(
					QCAR::ImageTracker::getClassType()));
	if (imageTracker != 0)
		imageTracker->start();

	// Start cloud based recognition if we are in scanning mode:
	if (scanningMode) {
		QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
		assert(targetFinder != 0);

		targetFinder->startRecognition();
	}
}
JNIEXPORT void JNICALL
Java_rajawali_vuforia_RajawaliVuforiaActivity_enterScanningModeNative(JNIEnv*,
		jobject) {
	QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	QCAR::ImageTracker* imageTracker =
			static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(
					QCAR::ImageTracker::getClassType()));

	assert(imageTracker != 0);

	QCAR::TargetFinder* targetFinder = imageTracker->getTargetFinder();
	assert(targetFinder != 0);

	// Start Cloud Reco
	targetFinder->startRecognition();

	// Clear all trackables created previously:
	targetFinder->clearTrackables();

	scanningMode = true;
}