Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR07 / 2read / image processing toolbox guide.pdf
Скачиваний:
166
Добавлен:
18.03.2015
Размер:
18.08 Mб
Скачать

Measuring the Distance Between Two Pixels

Measuring the Distance Between Two Pixels

In this section...

“Using the Distance Tool” on page 4-37

“Exporting Endpoint and Distance Data” on page 4-38 “Customizing the Appearance of the Distance Tool” on page 4-39

Using the Distance Tool

1Display an image in the Image Tool. imtool('moon.tif')

2Click the Distance tool button in the Image Tool toolbar or select Measure Distance from the Tools menu. The Distance tool allows you to measure distance with a click-and-drag approach. When you move the pointer over the image, the pointer changes to cross hairs . Position the cross hairs at the beginning of the region you wish to measure, hold down the mouse button, drag the cross hairs to the end of the region, and release the button.

The Distance tool displays the Euclidean distance between the two endpoints of the line in a label superimposed over the line. The tool specifies the distance in data units determined by the XData and YData properties, which is pixels, by default.

4-37

4 Displaying and Exploring Images

Distance tool button

Distance tool

3An alternative to using the Distance tool in Image Tool is to open a figure window using imshow and then call imdistline. The Distance tool appears as a horizontal line displayed over the image. You can reposition the line or grab either of its endpoints to resize the tool.

Exporting Endpoint and Distance Data

To save the endpoint locations and distance information, right-click the Distance tool and choose the Export to Workspace option from the context menu. The Distance tool opens the Export to Workspace dialog box. You can use this dialog box to specify the names of the variables used to store this information.

4-38

Measuring the Distance Between Two Pixels

After you click OK, the Distance tool creates the variables in the workspace, as in the following example.

whos

 

 

 

 

Name

Size

Bytes

Class

Attributes

distance

1x1

8

double

 

point1

1x2

16

double

 

point2

1x2

16

double

 

Customizing the Appearance of the Distance Tool

Using the Distance tool context menu, you can customize many aspects of the Distance tool appearance and behavior. Position the pointer over the line and right-click to access these context menu options.

Toggling the distance tool label on and off using the Show Distance Label option.

Changing the color used to display the Distance tool line using the Set color option.

Constraining movement of the tool to either horizontal or vertical using the Constrain drag option.

Deleting the distance tool object using the Delete option.

Right-click the Distance tool to access this context menu.

4-39

4 Displaying and Exploring Images

Getting Information About an Image Using the Image

Information Tool

To get information about the image displayed in the Image Tool, use the Image Information tool. The Image Information tool can provide two types of information about an image:

Basic information — Includes width, height, class, and image type. For grayscale and indexed images, this information also includes the minimum and maximum intensity values.

Image metadata — Displays all the metadata from the graphics file that contains the image. This is the same information returned by the imfinfo function or the dicominfo function.

Note The Image Information tool can display image metadata only when you specify the filename containing the image to Image Tool, e.g.,

imtool('moon.tif').

For example, view an image in the Image Tool.

imtool('moon.tif')

Start the Image Information tool by clicking the Image Information button

in the Image Tool toolbar or selecting the Image Information option from the Tools menu in the Image Tool. (Another option is to open a figure window using imshow and then call imageinfo from the command line.)

4-40

Getting Information About an Image Using the Image Information Tool

The following figure shows the Image Tool with the Image Information tool. In the figure, the Image Information tool displays both basic image information and image metadata because a file name was specified with imtool.

Image Information tool button

Image Information tool

Basic image information

Image metadata

Image Tool with Image Information Tool

4-41

Соседние файлы в папке 2read