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 i.e. 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 powerP
an object distance ofo
will produce an image ati
The linear magnification will beM
. The formula is1/object distance + 1/image distance = 1/focal length
. Visit the link to have a more clear idea.