Professional Documents
Culture Documents
Smart Scanner For Advertisements
Smart Scanner For Advertisements
1
@Override public void
onRequestPermissionsResult(int
requestCode,String
Permissions[],int[]grantResults){
Toast.makeText(getApplicationContext(),
"onRequestPermissionsResult",
Toast.LENGTH_LONG).show();
switch(requestCode){ case MY_PER_CAM:
{ if(grantResults.length>0 &&
grantResults[0] ==
PackageManager.PERMISSION_GRANTED
){
Toast.makeText(getApplicationContext(),"Ca
mera
Granted",Toast.LENGTH_LONG).show();
Break down of code base }else{
1. It allows us to enter the API Key, which key Toast.makeText(getApplicationContext(),"Ca
will only work when using the eu.kudan.ar mera
application Id and can be found at Denied",Toast.LENGTH_LONG).show(); }
https://wiki.kudan.eu/Development_License_ return; } } }
Keys.
2. System request for the camera permission to 4. Create our trackable with an image:
be granted while using the callback. ARImageTrackable trackable =
if(ContextCompat.checkSelfPermission(this, createTrackable("Marker","lego.jpg");
Manifest.permission.CAMERA) != Get the trackable Manager:
PackageManager.PERMISSION_GRANTED ARImageTracker trackableManager =
){ Log.d("Marker","Did != ARImageTracker.getInstance();
PackageManager.PERMISSION_GRANTED Add image trackable to the image tracker
"); manager:
if(ActivityCompat.shouldShowRequestPermi trackableManager.addTrackable(trackable)
ssionRationale(this,
Manifest.permission.CAMERA)){ } else{ 5. Create an image node using an image of
//request forpermission-use the callback the kudan cow:
ActivityCompat.requestPermissions(this, new ARImageNode cow = new
String[]{Manifest.permission.CAMERA}, ARImageNode("target.png"); Add the image
MY_PER_CAM); } } } node as a child of the trackable's world:
trackable.getWorld().addChild(cow);
3. This method should be overridden and all
the AR content setup placed within it. This 6. Initialize "video texture"
method is called only at the point at which the ARVideoTexture videoTexture = new
AR Content is ready to be set up. It checks for ARVideoTexture();
the camera permission is granted or denied. If videoTexture.loadFromAsset("sample-mp4-
granted hence the workflow of the system will video.mp4");
continue or else it will return until and unless Initialise video node with video texture
the permission is not granted. ARVideoNode videoNode = new
ARVideoNode(videoTexture);
2
Add video node to image trackable texture2D.loadFromAsset("bigBenTexture.pn
trackable.getWorld().addChild(videoNode); g");
Apply Video scale Apply model texture to model texture
float scale = trackable.getWidth() / material
videoTexture.getWidth(); ARLightMaterial material = new
videoNode.scaleByUniform(scale*0.5f); ARLightMaterial();
material.setTexture(texture2D);
material.setAmbient(0.8f, 0.8f, 0.8f);
Apply texture material to models mesh nodes
7. Initialize "bigimage" node for(ARMeshNode meshNode :
ARImageNode imageNode = new modelImporter.getMeshNodes()){
ARImageNode("eyebrow.png"); meshNode.setMaterial(material); }
Add image node to image trackable modelNode.rotateByDegrees(90,1,0,0);
trackable.getWorld().addChild(imageNode); modelNode.scaleByUniform(0.25f);
Apply image scale
ARTextureMaterial textureMaterial = Figure 2.0 presents the Activity Diagram of
(ARTextureMaterial)imageNode.getMaterial( Article
); float scale = trackable.getWidth() /
textureMaterial.getTexture().getWidth();
//imageNode.scaleByUniform(scale);
3
Conclusion
The Project which is expressed in article
covers Advertising industry and could be
implemented also in different spheres of
industry. Within help of this application users
could easily interact with right and safe
commercials (information). It allows them to
grab detailed data about certain product or
service. Application itself could only run with
advanced smartphones which has well
configured cameras. The given project in
article is developed for Android, but it could
be converted to iOS for the future work.
Moreover, this project includes internal
entrainment for user itself, with 360⁰ pictures,
advanced augmented reality videos etc.
Literature
[1] National Center for Supercomputing
Applications, University of Illinois.. 1995.
INTRODUCING VIRTUAL
ENVIRONMENTS. [ONLINE] Available at:
http://archive.ncsa.illinois.edu/Cyberia/VETo
pLevels/VR.Overview.html. [Accessed 19
July 2017].