×
Namespaces

Variants
Actions
(Difference between revisions)

QAugmentedReality - Local based augmented reality component

From Nokia Developer Wiki
Jump to: navigation, search
galazzo (Talk | contribs)
(Galazzo -)
galazzo (Talk | contribs)
(Galazzo -)
Line 24: Line 24:
  
 
== Introduction ==
 
== Introduction ==
QAugmentedReality is a camera component that provides all functionalities to create your own local based augmented reality application like Nokia City Lens.<br />
+
QAugmentedReality is a camera component that provides all functionalities to create your own local based augmented reality application like Nokia City Lens or social applications for example displaying your friends location or your parked car location direction.
  
 
== Summary ==
 
== Summary ==
Line 31: Line 31:
 
{{#ev:youtube|WFez-3_xp64}}
 
{{#ev:youtube|WFez-3_xp64}}
  
''Add categories below. Remove Category:Draft when the page is complete or near complete''
+
== Get Started with QAugmentedReality ==
 +
* Download the project from [projects.developer.nokia.com/QAugmentedReality here]
 +
* Include '''QAugmentedReality''' directory into your project
 +
 
 +
=== .pro ===
 +
<code cpp>
 +
include(QAugmentedReality/AugmentedRealityLibrary.pri)
 +
</code>
 +
 
 +
=== main.cpp ===
 +
<code cpp>
 +
#include <QtGui/QApplication>
 +
#include "qmlapplicationviewer.h"
 +
 
 +
#include <QtDeclarative>
 +
#include "qaugmentedrealitycamera.h"
 +
 
 +
Q_DECL_EXPORT int main(int argc, char *argv[])
 +
{
 +
    QScopedPointer<QApplication> app(createApplication(argc, argv));
 +
 
 +
    QmlApplicationViewer viewer;
 +
 
 +
    qmlRegisterType<QAugmentedRealityCamera>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCamera");
 +
    qmlRegisterType<QAugmentedRealityCameraModel>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraModel");
 +
    qmlRegisterType<QAugmentedRealityCameraItem>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraItem");
 +
    qmlRegisterType<QAugmentedRealityCameraDelegate>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraDelegate");
 +
 
 +
    // Resize the root QML element to view size
 +
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
 +
 
 +
    // Performance optimization flags
 +
    viewer.setAttribute(Qt::WA_OpaquePaintEvent);
 +
    viewer.setAttribute(Qt::WA_NoSystemBackground);
 +
    viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
 +
    viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);
 +
    viewer.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
 +
 
 +
 
 +
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
 +
    viewer.setMainQmlFile(QLatin1String("qml/QAugmentedRealitySample/main.qml"));
 +
    viewer.showExpanded();
 +
 
 +
    return app->exec();
 +
}
 +
</code>

Revision as of 02:00, 13 June 2012

Article Metadata
Tested with
Devices(s): Nokia N8, Nokia C7-00
Compatibility
Platform(s):
Symbian
Platform Security
Capabilities: Location, NetworkServices,UserEnvironment,ReadUserData
Article
Keywords: Augmented Reality, Camera, GPS, Compass
Created: galazzo (13 Jun 2012)
Last edited: galazzo (13 Jun 2012)

Contents

Introduction

QAugmentedReality is a camera component that provides all functionalities to create your own local based augmented reality application like Nokia City Lens or social applications for example displaying your friends location or your parked car location direction.

Summary

The component built entirely from scratch, inherits all camera features adding GPS, Accelerometer and Compass support.
Anyway the component's strenght is the model support that allows you to easy manage your data to display. To add a pin into your scene you just need to add a QAugmentedRealityCameraItem element to QAugmentedRealityCameraModel to obtain a result like below:


Get Started with QAugmentedReality

  • Download the project from [projects.developer.nokia.com/QAugmentedReality here]
  • Include QAugmentedReality directory into your project

.pro

include(QAugmentedReality/AugmentedRealityLibrary.pri)

main.cpp

#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
 
#include <QtDeclarative>
#include "qaugmentedrealitycamera.h"
 
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
 
QmlApplicationViewer viewer;
 
qmlRegisterType<QAugmentedRealityCamera>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCamera");
qmlRegisterType<QAugmentedRealityCameraModel>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraModel");
qmlRegisterType<QAugmentedRealityCameraItem>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraItem");
qmlRegisterType<QAugmentedRealityCameraDelegate>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraDelegate");
 
// Resize the root QML element to view size
viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
 
// Performance optimization flags
viewer.setAttribute(Qt::WA_OpaquePaintEvent);
viewer.setAttribute(Qt::WA_NoSystemBackground);
viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);
viewer.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
 
 
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
viewer.setMainQmlFile(QLatin1String("qml/QAugmentedRealitySample/main.qml"));
viewer.showExpanded();
 
return app->exec();
}
120 page views in the last 30 days.
×