简体   繁体   中英

Focal Length of Camera View according to Distance

I'm working on an app related to Augmented Reality. It has a gallery that let you select the picture and frame and then a Live Camera Preview shows you how it'll look on your wall. In this live preview use set its distance from wall ie 1 meters to 6 meters and the picture adjusts accordingly and shows in the live camera view. For now I'm using the assumed values like:

case 1:
self.imageObject.frame = CGRectMake(self.imageObject.frame.origin.x , self.imageObject.frame.origin.y, 180, 180);            
break;

Suppose if the initial size of all the images is 200x200 pixels so what will be the formula from which I can get the exact value that if frame size is 200x200 at 1m and when it taps 2m the size changes to the exact 2m value of frame just like a real focal value. Its like distance to pixels conversion what I'm thinking.

This link might help you. What you need to do is you should know the camera focal length of iPhone camera. It'll be different for 5s, 6 or 6 plus. For a lens of focal length f corresponding to lens power P an object distance of o will produce an image at i The linear magnification will be M . The formula is 1/object distance + 1/image distance = 1/focal length . Visit the link to have a more clear idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM