Vuforia: a bit of magic in our reality

    The modern world does not cease to please us with technological advances, who, if not the habrazhiteli, know this. I still attribute all sorts of helmets of virtual reality to something rather sci-fi than real, despite the fact that they already exist (just search the Oculus Rift hub ) Besides, if I may say so, “pure” virtual reality, projects to complement our reality (Augmented Reality) seem increasingly interesting. The castAR project, sensational on Kickstarter, is a living proof of this, and Google Glass, although not quite that, fits into the term augmentation.

    Only one thing, Oculus Rift - today it is a version for developers, castAR is generally only a concept, but Google Glass went to the lucky ones and its possibilities are very limited. In general, there is no need to talk about reaching a wide audience. But smartphones of all sorts have settled everywhere in our lives. They are all wonderful, have a camera and are smart enough to become the augmented reality window.

    In this article I will talk about Vuforia, a framework that allows you to do something similar with your phone. The post is rather a review to understand the terminology and understand how all this is done.

    VuforiaIs a platform for creating augmented reality applications for phones and tablets on iOS and Android operating systems. I must say, I was pleasantly surprised that Qualcomm, in addition to producing the iron component of our favorite gadgets, also provides such tools for developers.

    The core of the platform is the QCAR library , written in C ++ and hiding behind its interfaces almost everything from defining a target and ending with rendering a picture.

    In addition to the library, the platform includes: iOS and Android Vuforia SDK for developers; Target Manager - a system for creating and managing targets; as well as a set of web services ( Vuforia Web Services) into which you can take out storage of targets and some other functionality. The platform is developing very dynamically and new parts are added quite often.

    I have already mentioned the target or target several times , so there is nothing left to do but tell us more about it.

    Targets


    To add something to the real world, you need to “cling” to an object in this world. It is for this purpose that the targets serve. In other words, the target is a real object, knowing which our application can place virtual objects in the right places and corresponding proportions.

    Vuforia provides a wide selection of targets:

    • Image targets - the basic type of targets, which is a regular picture, for example, the cover of a magazine, a photograph or a poster of a new film. The image serves as a kind of two-dimensional barcode, only without black and white regions. Using it, we can determine exactly which picture fell into the camera lens, as well as its location in space and scale. It is worth saying that not every picture is suitable for creating a target. Good targets are those in which there are many contrasting details. It is precisely on these details that the support matrix is ​​built for subsequent target recognition.
    • Simple 3D targets (Cube and Cuboid) are targets in the form of rectangular parallelepipeds (including a cube). For example, breakfast cereal packaging, a matchbox, or a board game just bought can serve as such a target. Like any box, such a target consists of six planes, and to create it, we need six pictures for each of them. If you ever glued a cube of paper - then quickly cope with the task.
    • Cylinder targets - this type of target, despite the name, is a truncated cone with the ability to specify the diameters of the bases. Of course, if you choose the same diameters, you get just a cylinder, but still this is a special case. In order to create such a target, we need to not only indicate the diameters of the bases and height, but also add three pictures - one for each of the two bases, and one more for the side surface.
    • Frame markers - this target in the form of a specially prepared frame, which is already much more like a barcode. You can put any picture in such a frame. This type of target is perfect if the picture was not detailed enough and you couldn’t create a sensible image target from it.
    • Text (word targets) . Text recognition is also built into the Vuforia library, so any word or combination of them can be a target. At the moment, only Latin is supported, but this is already very interesting. Just imagine how interesting learning foreign words can be.

    Depending on the number of targets required for your application, you can either store them in the so-called Device Database , always have access to them and recognize them directly on the device itself, or transfer part of this load to Cloud Databases - a service from the Vuforia Web Services suite designed to store targets and determine them based on the data sent from the device. Both approaches have their pros and cons, but deciding on the goals of your application will not be so difficult to choose.

    In addition, targets can be created directly from the application itself using the picture received from the camera.

    It is also worth noting that QCAR does not require the entire target to enter the frame. In order to recognize and use it, only parts will be enough. This is very important and allows you to view all the magic of your application from a variety of angles.

    Magic


    A more hackneyed catch phrase than “Give me a foothold and I will turn the Earth!” hard to come up with, but here it fits perfectly. Now, having the opportunity to “hook”, we can begin to add the very magic that can be seen on the smartphone screen in our real world.

    To do this, let's figure out what kind of magic we can afford. To do this, I tried to collect basic examples of using augmented reality and all of them can be used with Vuforia.

    • Static and dynamic 3D models . We can add any 3D object starting from the beloved teapot all the way up to complex animation. Vuforia actively supports the ability to integrate with Unity, which further unties our hands. We are limited only by the imagination and power of smartphones / tablets.
    • Virtual buttons to interact with which will have to be quite real objects. For example, it can be a button on your target, clicking on which launches a virtual ground-to-air rocket from your desktop, which can only be viewed through the smartphone screen.
    • Videos and pictures that allow us to replace our target or make it a little more lively.
    • Changing the background , among other things, you can change the picture itself received from the camera. In other words, we can not only supplement the picture, but also operate with it ourselves.

    With such an impressive range of tools, you can do almost anything.

    As I said, this article is more of a review and its purpose was to introduce you to Vuforia and provide food for imagination. If the topic resonates with Khabrovich’s hearts, then in the next article I will look at the examples that Vuforia provides with the Android SDK, describe the code that is there, and maybe we will whip up something. And finally, the video that personally blew my mind and made me jump like a little boy who first saw the capital.



    useful links


    Also popular now: