am2 Posted May 29, 2015 Report Share Posted May 29, 2015 Hi,I have faced a problem and I hope I post my question in right place,I want to develop an AR application,When a user focus camera on a building it recognize its location and load data based on its location,I have some ideas how to find the location of building which is in front of cameraIt can calculate distance(how?) from camera and building and estimate the exact location of building using phons location service.It also can buffer a distance (how much?) from cameras location and find what is in that distance..Any other ideas which we can do this job using android sensors?Thank you so much Quote Link to comment Share on other sites More sharing options...
souvik.gis Posted June 1, 2015 Report Share Posted June 1, 2015 You can drive here for focal length related issues http://en.wikipedia.org/wiki/Focal_length The most simple formula to estimate distance to the object is where x is the size of the object on the sensor, f is focal length of the lens, X is the size of the object, and dis distance from nodal point to the object. x and f, and X and d are measured in the same units, e.g. mm and m respectively (to calculate x you'll need to estimate pixel size for your sensor; for example, for Pentax K20D it is 23.4 mm/4672 px ≈ 5.008e-3 mm/px, i.e. an image 100 px long corresponds to x = 50.08e-3 mm). In the following I assume that the size of the object (X) is unknown, and the only known parameters are x(image size) and f (focal length). The problem is that we cannot tell from one photo if is a small object very close to the camera or a big object far away, because the depth of field in landscape shots is usually very big (and that's why pinhole formula is applicable). To solve this problem we may use two or more images to measure the distance. Provided you can measure all angles and distance between two camera positions, you can also calculate distance to the remote object. But measuring all angles is not an easy task. An easier approach is to take two photos which stay on the same line with the object, with object in the center of the image. Let distance to the object on the first photo be d₁, and image size be x₁: Then if we move the camera s meters directly towards the object, then on the second photo we have image size x₂ slightly bigger than x₁: Which gives us Evidently, if s is not big enough to affect image size significantly, you cannot estimate distance reliably, and need to use more complicated methods. The bigger is difference x₂ - x₁, the better. Another formula is: ----------------------------------- distance to object (mm) = focal length (mm) * real height of the object (mm) * image height (pixels) --------------------------------------------------------------------------- object height (pixels) * sensor height (mm) 1 Quote Link to comment Share on other sites More sharing options...
am2 Posted June 1, 2015 Author Report Share Posted June 1, 2015 You can drive here for focal length related issues http://en.wikipedia.org/wiki/Focal_length The most simple formula to estimate distance to the object is where x is the size of the object on the sensor, f is focal length of the lens, X is the size of the object, and dis distance from nodal point to the object. x and f, and X and d are measured in the same units, e.g. mm and m respectively (to calculate x you'll need to estimate pixel size for your sensor; for example, for Pentax K20D it is 23.4 mm/4672 px ≈ 5.008e-3 mm/px, i.e. an image 100 px long corresponds to x = 50.08e-3 mm). In the following I assume that the size of the object (X) is unknown, and the only known parameters are x(image size) and f (focal length). The problem is that we cannot tell from one photo if is a small object very close to the camera or a big object far away, because the depth of field in landscape shots is usually very big (and that's why pinhole formula is applicable). To solve this problem we may use two or more images to measure the distance. Provided you can measure all angles and distance between two camera positions, you can also calculate distance to the remote object. But measuring all angles is not an easy task. An easier approach is to take two photos which stay on the same line with the object, with object in the center of the image. Let distance to the object on the first photo be d₁, and image size be x₁: Then if we move the camera s meters directly towards the object, then on the second photo we have image size x₂ slightly bigger than x₁: Which gives us Evidently, if s is not big enough to affect image size significantly, you cannot estimate distance reliably, and need to use more complicated methods. The bigger is difference x₂ - x₁, the better. Another formula is: ----------------------------------- distance to object (mm) = focal length (mm) * real height of the object (mm) * image height (pixels) --------------------------------------------------------------------------- object height (pixels) * sensor height (mm) Thank you for your great information, As It seems The secound method is better because tacking two picture is a little hard for end user,But here the problem is getting real hieght of the object. I was wondering what if we use spatial queries?we have the exact location of camera.we can find cameras direction using phones sensores. If we have a map of buildings. we can use a set of buffers to find closest polygon to our camera's location in the specified direction, Is this possible using spatial queries?with assumption that there is a map of buildings around us Quote Link to comment Share on other sites More sharing options...
souvik.gis Posted June 1, 2015 Report Share Posted June 1, 2015 Sorry am2. I don't have any idea. Please check out this site http://www.roborealm.com/index.php And please follow this book.... http://www.umiacs.umd.edu/~rama/Publications/Sank_PIEEE_2008.pdf 1 Quote Link to comment Share on other sites More sharing options...
am2 Posted June 2, 2015 Author Report Share Posted June 2, 2015 Sorry am2. I don't have any idea. Please check out this site http://www.roborealm.com/index.php And please follow this book.... http://www.umiacs.umd.edu/~rama/Publications/Sank_PIEEE_2008.pdf Thank you so much for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.