Syntax
h=immeasureui([imf])
Input Parameter
imf : | | Image or image file name or empty |
Output Parameter
h : | | handle to graphics objects to be deleted |
Examples
Just try
imreadui;
imreadui(CADpictservo); I=ans;
immeasureui(I)
Copyright 2012-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is a user interface function designed to measure distances within an image using mouse clicks. It is part of the SolidGeometry library and was introduced by Tim Lueth.
Input Parameters
- imf: This parameter can be an image, an image file name, or empty. If it is a string or empty, the function will call
imreadui
to load the image. If it is an image, it will be directly plotted using implot
.
Output Results
- h: This is a handle to graphics objects that can be deleted later. It includes lines and text annotations created during the measurement process.
Algorithm Steps
- Retrieve the input parameter
imf
using getfuncparams
.
- Check if
imf
is a string or empty. If so, use imreadui
to load the image. Otherwise, assume imf
is an image and plot it using implot
.
- Enter a loop to allow the user to select two points on the image using
ginput
.
- While two points are selected, perform the following actions:
- Hold the current plot to overlay new graphics.
- Plot a line between the two points using
lplot
with red circles and dashed lines.
- Calculate the midpoint of the line and the distance between the two points.
- Create a text annotation at the midpoint displaying the distance, formatted to two decimal places.
- Set the text color to red and font size to 16.
- Store the line and text handles in the output variable
h
.
- Refresh the graphics display with
shg
.
- Prompt the user to select another pair of points.
- Exit the loop when fewer than two points are selected.
Algorithm explaination created using ChatGPT on 2025-08-19 00:24. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21