Pixels to inch conversion
11 views (last 30 days)
Show older comments
Hello everyone, I need to convert the number of pixels into inches(cm)...I know the calculation but if the image is taken as a photograph, based on the camera distance number of pixels are varied...Then what is the relationship between number of pixels and camera focal length...Thanks in advace ...
0 Comments
Accepted Answer
Image Analyst
on 17 Mar 2014
See my spatial calibration demo, attached. It lets you specify some known distance in the image and then make measurements based off of that.
0 Comments
More Answers (2)
Walter Roberson
on 17 Mar 2014
Unknown. You need at least two pieces of information to determine this. For example the lens aperture together with the focal length.
Usually the easiest way to proceed is to calibrate the camera at any reasonable distance: take a picture of an object of known length, count the pixels occupied in the image, convert to a pixels per inch (or pixels per mm) ratio; that together with the focal length is enough to calibrate for all distances, using standard trigonometry (e.g., twice the focal length would render the same sized object as half as many pixels)
0 Comments
Amit Nambiar
on 17 Mar 2014
Hi harjan, Walter suggested a good thing. I wanted to do the same thing in my assignment. It is not a good idea to find out the pixels/inch factor by knowing the camera's cmos sensor dimensions or aperture and all. It introduces lot of errors while measurement. I wanted reasonable accuracy. So what I did is i placed a 4 cms square scale(you can take anything as per your convenience) near the object whose image is taken. I separated the scale's region in image using rgb values and found out the pixel counts of each side and then measured my objects dimensions. I got 95% accuracy by this method!
0 Comments
See Also
Categories
Find more on Image Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!