File Exchange

image thumbnail

Image Measurement Utility

version 1.9 (2.41 MB) by

Interactive tool allowing the measurement of distances, radii, and angles in images

29 Ratings



View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This tool is intended to aid measuring on images. In order to do this the image needs to have some visual scale to calibrate the pixel to length ratio on, e.g. scale bar, ruler.
It can measure:
- the distance between points
- the perpendicular distance between a line and a point
- the length of a spline
- the radius of a circle
- the angle of the intersection of two lines
All measurements can be deleted or modified afterwards.

The tool is intended for high quality measurements, and is therefore build around tools like "imline" from the image processing toolbox. These tools are powerful because they allow you to select, zoom, re-adjust, and than confirm your selection. Nevertheless, a "quick" selection option is added to allow measurements with less mouse clicks (also useful for users whom don't have the IP toolbox).

The tool can handle batches of images, allowing measurements on several images with only one calibration. This also allows for measurements where a different image was used to calibrate the scale on.

The results can be saved to the workspace and to a text file (which can be read in excel as a .csv). Additionally two image save options are provided, i.e. PNG and PDF, where the PNG version also anti-aliases the image.

Finally, help is provided in the form of a status bar guiding the user through the process, complemented with readable tooltips and a full help readme, accessible from the interface.

Comments and Ratings (45)

James Huth

Thank you John. That worked!

John Clark

James, Ayman, there's an extra wildcard since the original author left wildcards in his imagetypes cell (line 155 of measuretool.m).
To fix, remove the wildcard in line 174 of measuretool.m so that it reads:
filestmp = dir([filepath filesep imagetypes{i}]);

James Huth

Hi - I'm having the same problem as Aymann... error when trying to open image. Tried to fix first "dir" error... couldn't. Any advice? Thank you.

Ayman Saleh

For some reason, whenever I try to upload an image, I keep getting these errors.
Error using dir
Characters adjacent to a ** wildcard must be file separators.

Error in measuretool>FileBrowse_Callback (line 174)
    filestmp = dir([filepath filesep '*' imagetypes{i}]);

Error in gui_mainfcn (line 95)

Error in measuretool (line 41)
    gui_mainfcn(gui_State, varargin{:});

Error in>@(hObject,eventdata)measuretool('FileBrowse_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Anyone have any idea what I am doing wrong?


SL (view profile)

It would be really great to get the syntax `measuretool(Img)` such that you do not need to use the file browser to find the file. I would also like to get better documentation with clear synapse and example commands in Matlab promp.


This is extremely useful. Only reason for 4/5 stars is that it re-plots the image and measurements every time and if you have a lot of measurements (100+), it can bog down a get a little slow.

This is a wonderful tool and very useful for my application. Is there a way to preserve a zoomed in view, rather than zooming out after each measurement? I'd like to stay zoomed in as I am making many measurements in a small area.

App is not opening perfectly in matlab 2014a. top portions of app is not visible. I cannot load files.

Great tool! It has been incredibly helpful for me and very easy to use. It is very accurate and makes measuring a large number of images in a dynamic environment very easy.

I was wondering if it is possible to have something that stores the calibration coordinates to the workspace similar to how the software stores the distance measurements.

So I am thinking there could be a structure that includes the following fields in the first row:

filename = 'name of image'
type = 'calibration'
value = 'distance between the two points'
intensity = '--'
profile = '--'
unit = 'calibration units'
x and y = 'the x or y coordinate for the calibration'

Also, another thing that I have noticed is that if one is measuring a large number of images and re-calibrates halfway through it changes all of the previous measurement values based on this re-calibration. It would be great in my opinion if this was more explicit or optional.

Thank you very much for this SOFTWARE.
I want to measure size of objects from capturing an image on a microscopy and this software has made my work complete.

Jan Klement

Excelenet for 2D measurements.

Amit Saha

Thank you very much for this great tool. This tool has made my project complete, on machine vision systems. Thank you, thank you so much.

Ilya Belevich

Hi Jan,
thank you for this great work!

I've noticed a small bug: when I delete a measurement the n-numbers of the others are not changed. As result addition of a new measurement produces two measurements with the same n-number.


Aditya (view profile)

Really awesome stuff - great interface, great use of cross-hairs for identifying features.

An enhancement idea:
If I have engineering data traces, it would be great to do calibration in 2 directions and then automatically calculate coordinates of points from the origin.


Great App. Just wanted to say thanks!


I would suggest an application for google glass of this tools.


Lacey (view profile)

Hi Jan-

Great tool! I noticed the measurement displays with only two decimal places. Can you build in an option that allows you to select how many significant digits you wish to display the measurement? Also, is it possible to make an option to display the x and y coordinates of the distance as well?

Thanks for posting this app. It is very helpful!

Jan Neggers

Jan Neggers (view profile)

Thank you Jie, you are correct, I forgot to add .bmp to the list of options, and your fix is perfect. I will update the tool accordingly.


Jie (view profile)

I think this is a great tool.
But I have a doubt. Does this toolbox work for .bmp file? When I try to browse .bmp files, there seems to be error. Pictures I took in microscope is usually .bmp file.
I simply add "*.bmp"(in correct form) in your .m file No. 156 & 160 line. It seems work good. Do you think I'm doing right? Wish to hear from you.

Justin Blaber

Justin Blaber (view profile)

Thanks for the great tool!


Matt (view profile)

Great tool, easy to use and works well. The ability to turn off image processing tool box requirement is a very nice touch


Justin (view profile)

I haven't used this much yet, but it looks great. Is there any simple way to reduce the height of the GUI so that it doesn't extend below my task bar though?


Mario (view profile)

It is very simple and its use is intuitive. I love it and use it all the time.


Ahmed (view profile)


This is really a good work. Well done.

Great job


Vijay (view profile)

How to get the real length & breadth of an image in millimeters?
i need it to calculate pixels/mm for my text extraction project


Shahab (view profile)

great program, thanks


Sabad (view profile)

Amazing tool!
So useful. Thanks a lot.

Civil Eng

I am getting errors whatever I click

Civil Eng

Selcuk Fidan

ling li


Jan Neggers

Jan Neggers (view profile)

Hi Jakub, i'll see what I can do, this is a little bit more complex as one might think since the intensity is stored in pixels which are discrete by nature, and the measurement lines do not follow pixel locations per se, so some interpolation is required.


Jakub (view profile)

Hi Jan,

Great tool. Would it be possible to add a feature to measure mean intensity of signal within line length.


superb tool ..Thank u

Jan Neggers

Jan Neggers (view profile)


If you don't have the function imline, then you probably have a matlab version older then 2009b, or maybe the function is provided by the image processing toolbox.


Becky (view profile)

I am getting an error when I try to calibrate (see below). Can you offer any suggestions? I have an jpeg radiographic image.

??? Undefined function or method 'imline' for input arguments of type 'double'.

Error in ==> measuretool>Calibrate_Callback at 435
    h = imline(Data.gca,[u(1) v(1) ; u(2) v(2)]);

Error in ==> gui_mainfcn at 96

Error in ==> measuretool at 41
    gui_mainfcn(gui_State, varargin{:});

Error in ==> @(hObject,eventdata)measuretool('Calibrate_Callback',hObject,eventdata,guidata(hObject))

??? Error while evaluating uicontrol Callback

great program in analyzing TEM images. I wanted to know how difficult is it to save the data because I would like to do size distribution analysis on the saved data.


Till (view profile)

Hi Jan,
thanks for this nice tool. However, I have a question: I have gray scale TEM images in tif format. Your tool seems to convert them to RGB. I had a very short glance at the code, and think it is related to the call of imagesc in line 324. It might also be related to the specific format of my tif file. It would be nice, if you could comment on this.

this GUI is excellent. It can measure the distance between 2 points, perpendicular distance of a point from a line, angle between 2 lines. This GUI is fantastic.

Jan Neggers

Jan Neggers (view profile)

I've posted an update to fix some minor bugs, awaiting review at the moment.



added the .bmp image type as suggested by Jie


Updated to include an App file for R2012b


Added a feature, as suggested by Jakub, now the average intensity can be drawn, and the intensity profiles can be saved to the workspace.


Made the GUI more intuative by improving the status texts, and disabling most buttons during a measurement.


A major update of the GUI, the interface is more intuitive now, also, some options have been added to allow the use of this tool for pre 2009b versions of matlab or in absense of the IP toolbox.


Added the long awaited save options, and fixed a bug with the help function not working.


I've fixed the color issue, mentioned by Till, also added a lot of comments to make the code more readable, and changed the method of providing the in GUI help.


Fixed some minor bugs, that would throw errors to the command screen when pressing buttons in an unexpected order.

MATLAB Release
MATLAB 8.0 (R2012b)

Inspired: Microscopy Image Browser (MIB)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video