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

24 visualizaciones (últimos 30 días)
Jake
Jake el 29 de En. de 2015
Comentada: Faiz Yusoff el 16 de Oct. de 2020
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.

Respuestas (2)

Image Analyst
Image Analyst el 29 de En. de 2015
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 comentarios
Image Analyst
Image Analyst el 30 de En. de 2015
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 el 16 de Oct. de 2020
Hello image analyst,
Would you help me solving my problem to identify the location of red colour in coordinat mm?

Iniciar sesión para comentar.


DEEPAK DAIYA
DEEPAK DAIYA el 27 de Abr. de 2018
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.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by