camera overlay change with bearing and elevation

2019-02-12 22:17发布

问题:

Folks,

I am trying to get a utility as shown in the picture below. Basically the camera display window covers part of the device's screen and a list of points that are connected by a curve or straight line are presented over the camera view as an overlay. I understand this can be drawn using quartz but this is less than half of my problem.

The real issue is that the overlay should present different points as the bearing and elevation changes.

For example:

  • if the bearing has to change +5 degrees and elevation +2 degrees, then PT1 will be next to the right edge of the camera view, PT2 will also move to the right and PT3 will be visible.
  • Another movement that changes the bearing +10 degrees would make PT1 not visible, PT2 at the right, PT3 middle and PT4 on the left edge of the camera view.

My questions after the picture:

  1. Is it possible to have a view that is substantially larger than the size of the camera view (as shown below) and use some methods (I need to research these) to move the view when bearing/elevation changes? Is it recommended performance wise?
  2. Is quartz the way to go here? What else do I need (other then of course AVFoundation for the camera and corelocation/motion)? Since my application is only iOS 7 I can use any new methods/APIs exclusive to iOS 7.
  3. Aside from raywendelrich's tutorial on the augmented reality game, are there any tutorials that you know of that could help me with this endeavor?

回答1:

Have a look at the following, each article or link has different key things required to make your final product. You eventually will be using a combination of geolocation, the compass/or the iphone's gyroscope data coming in.

Reading all the references combined and implementing them one by one in different projects will give you a solid start on how to then combine it all together to create your application. But first you need to get a solid understanding on how to manipulate the knowledge you will learn and how you can then apply it to create your project.

References:

A cool project from Ray Winderlech teach you how to use location gps coordinates in your application

  • Augmented reality location based tutorial

The next two links show you how to grab gyroscope data to find out the pitch, yaw and rotation and find out the device current position in space.

  • Apple gyroscope example app
  • Another core motion gyroscope example

Will teach you how to use the compass

  • Ray Winderlichs augmented reality compass tutorial for ios

Here's some more augmented reality stuff on overlaying stuff on the camera view

  • iPhone AR Toolkit
  • Augmented reality marker tracking tutorial