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

24 ビュー (過去 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 Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by