Pixels to inch conversion

조회 수: 10 (최근 30일)
harjan
harjan 2014년 3월 17일
답변: Image Analyst 2014년 3월 17일
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 ...

채택된 답변

Image Analyst
Image Analyst 2014년 3월 17일
See my spatial calibration demo, attached. It lets you specify some known distance in the image and then make measurements based off of that.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2014년 3월 17일
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)

Amit Nambiar
Amit Nambiar 2014년 3월 17일
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!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by