Determining pixel size based on an image of a scale/ruler.

조회 수: 29 (최근 30일)
Jake
Jake 2015년 1월 29일
댓글: Faiz Yusoff 2020년 10월 16일
I have an image with a scale on it, and I would like to know the size of each pixel. So that way, I can say that an area of x by x pixels, is equal to y mm^2. What's the best way to go about doing this? Here is the image sample:
My initial idea was to use IM profile along the lines, and determine the pixel distance between the intensity drops. However, if I don't draw my profile perfectly perpendicular, then this approach will not work.
Because I have a large data set of images that all have different scales, I would like to automated this process if possible. Something along the lines of detecting these dark lines, and then determining the minimum distance between neighboring lines.
Thanks in advance.

답변 (2개)

Image Analyst
Image Analyst 2015년 1월 29일
See my spatial calibration demo, attached.
Of course you can do it automatically if you can automatically find the lines and know their true separation.
  댓글 수: 4
Image Analyst
Image Analyst 2015년 1월 30일
Alright, attached is code that does it for you. If you agree, can you mark the Answer as "Accepted". Be sure to change the filename and folder in the attached test.m file.
Faiz Yusoff
Faiz Yusoff 2020년 10월 16일
Hello image analyst,
Would you help me solving my problem to identify the location of red colour in coordinat mm?

댓글을 달려면 로그인하십시오.


DEEPAK DAIYA
DEEPAK DAIYA 2018년 4월 27일
Get your scale image in your current figure axis and call function imdistline. it will create a distance measuring tool in your figure. Drag the point of the line created by the function to your known positions of the scale image, for example two major ticks of the image which are 5 mm apart.Then read this distance in the pixel values, say 'x'. Then your pixel size calibration will be equal to 5/x in mm/pixel.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by