2. Agenda
1. What is Augmented Reality
2. Existing Platforms
3. BeyondAR Framework
1. What can we do with it?
4. What is the next step?
3. Augmented Reality
• According to WikiPedia:
“Augmented reality (AR) is a live direct or indirect view of a physical, real-
world environment whose elements are augmented (or supplemented)
by computer-generated sensory input such as sound, video, graphics or
GPS data”
4. Augmented Reality
• According to WikiPedia:
“Augmented reality (AR) is a live direct or indirect view of a physical, real-
world environment whose elements are augmented (or supplemented)
by computer-generated sensory input such as sound, video, graphics or
GPS data”
5. Make Augmented Reality
• Using geo localization
• Image recognition
• Sensors
– Accelerometer
– Magnetic field
– Compass
– Motion tracking camera
– …
8. Vuforia
• Proprietary
• Available for Android and iOS
• Unity support
• Big community
• Collect some data form the user: related to the
scanned images
• Target recognition
– Device database: free < 100 images
– Cloud Database: not free >100
22. BeyondAR
Getting started
• Import the library in your project
• Update Manifest
<!-- Minimum permissions for BeyondAR -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- For BeyondAR this is not mandatory unless you want to load something from the network -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- BeyondAR needs the following features-->
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.sensor.compass" />
/BeyondAR
24. BeyondAR
Getting started
Create the UI
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.example);
// ...
mBeyondarFragment = (BeyondarFragmentSupport)
getSupportFragmentManager().findFragmentById (R.id.beyondarFragment);
// ...
}
BeyondarFragment: Class that manages the camera and the OpenGL surface
/BeyondAR
25. BeyondAR
Getting started
Create the AR world and add an AR object
// We create the world object
World myWorld = new World(this);
myWorld.setGeoPosition(41.90533734214473d, 2.565848038959814d);
World: Container for all the BeyondarObjects
• Try to manage all BeyondarObjects using this class
• Responsible for the user location
• You can add plugins
/BeyondAR
26. BeyondAR
Getting started
Create the AR world and add an AR object
// We create the world object
World myWorld = new World(this);
myWorld.setGeoPosition(41.90533734214473d, 2.565848038959814d);
// Create an object
GeoObject go1 = new GeoObject();
go1.setGeoPosition(41.90523339794433d, 2.565036406654116d);
go1.setImageResource(R.drawable.my_image);
go1.setName(”Hello World");
// Add the object
myWorld.addBeyondarObject(go1);
// give the world to the fragment
mBeyondarFragment.setWorld(myWorld);
/BeyondAR
27. BeyondAR
Getting started
Create the AR world and add an AR object
// We create the world object
World myWorld = new World(this);
myWorld.setGeoPosition(41.90533734214473d, 2.565848038959814d);
// Create an object
GeoObject go1 = new GeoObject();
go1.setGeoPosition(41.90523339794433d, 2.565036406654116d);
go1.setImageResource(R.drawable.my_image);
go1.setName(”Hello World");
// Add the object
myWorld.addBeyondarObject(go1);
// give the world to the fragment
mBeyondarFragment.setWorld(myWorld);
/BeyondAR
29. BeyondAR
Getting started
Interaction with the AR Objects
OnTouchBeyondarViewListener OnClickBeyondarObjectListener
mBeyondarFragment.setOnTouchBeyondarViewListener(this);
mBeyondarFragment.setOnClickBeyondarObjectListener(this);
@Override
public void onClickBeyondarObject(ArrayList<BeyondarObject> beyondarObjects) {
if (beyondarObjects.size() > 0) {
Toast.makeText(this, "Clicked on: " +
beyondarObjects.get(0).getName(), Toast.LENGTH_LONG).show();
}
}
/BeyondAR
30. BeyondAR
Getting started
Interaction with the AR Objects
OnTouchBeyondarViewListener OnClickBeyondarObjectListener
mBeyondarFragment.setOnTouchBeyondarViewListener(this);
mBeyondarFragment.setOnClickBeyondarObjectListener(this);
@Override
public void onClickBeyondarObject(ArrayList<BeyondarObject> beyondarObjects) {
if (beyondarObjects.size() > 0) {
Toast.makeText(this, "Clicked on: " +
beyondarObjects.get(0).getName(), Toast.LENGTH_LONG).show();
}
}
/BeyondAR
32. BeyondAR
Using location utils
• Easy way to use the location services
LocationManager locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
// We need to set the LocationManager to the BeyondarLocationManager.
BeyondarLocationManager.setLocationManager(locationManager);
BeyondarLocationManager: Helper to use the location services.
• Retrieves the best location using GPS and the network providers
• Can be used with LocationListener, World or GeoObject
/BeyondAR
33. BeyondAR
Using location utils
Create the AR world and add an AR object
@Override
protected void onResume() {
super.onResume();
// When the activity is resumed it is time to enable the
// BeyondarLocationManager
BeyondarLocationManager.enable();
}
@Override
protected void onPause() {
super.onPause();
// To avoid unnecessary battery usage disable BeyondarLocationManager
// when the activity goes on pause.
BeyondarLocationManager.disable();
}
BeyondarLocationManager.addWorldLocationUpdate(myWorld);
BeyondarLocationManager.addGeoObjectLocationUpdate(user);
/BeyondAR
35. BeyondAR
Working with Views
• Attach a View to a BeyondarObject
Extend BeyondarViewAdapter It follows the same pattern than the
ListAdapter
- Remember to recycle your Views!!
@Override
public View getView(BeyondarObject beyondarObject, View recycledView, ViewGroup parent) {
if (recycledView == null)
recycledView = inflater.inflate(R.layout.beyondar_object_view, null);
TextView textView = (TextView) recycledView.findViewById(R.id.titleTextView);
textView.setText(beyondarObject.getName());
Button button = (Button) recycledView.findViewById(R.id.button);
button.setOnClickListener(myClickListener);
// Once the view is ready we specify the position
setPosition(beyondarObject.getScreenPositionTopRight());
return recycledView;
}
Createtheview
/BeyondAR
36. BeyondAR
Working with Views
• Make a BeyondarObject from a View
ImageUtils.storeView(view, path, imageName);
// If there are no errors we can tell the object to use the
// view that we just stored
beyondarObject.setImageUri(path + imageName);
/BeyondAR
37. BeyondAR
Working with Views
• Make a BeyondarObject from a View
ImageUtils.storeView(view, path, imageName);
// If there are no errors we can tell the object to use the
// view that we just stored
beyondarObject.setImageUri(path + imageName);
/BeyondAR
43. BeyondAR
Plugins
• Example: Google Maps Plugin
// As we want to use GoogleMaps, we are going to create the plugin and
// attach it to the World
mGoogleMapPlugin = new GoogleMapWorldPlugin(this);
// Then we need to set the map in to the GoogleMapPlugin
mGoogleMapPlugin.setGoogleMap(mMap);
// Now that we have the plugin created let's add it to our world.
// NOTE: It is better to load the plugins before start adding object in to the world.
mWorld.addPlugin(mGoogleMapPlugin);
/BeyondAR