← Image Processing for EveryoneToolsInVisionLearning Center
Objects and Measurements · Lesson 67

Measure Area, Perimeter, and Shape

A workshop needs area, perimeter, and compactness for each part.

Read the full lesson and open its transcript below. A narrated video will be added after production.

Lesson overview

What you will learn

A workshop needs area, perimeter, and compactness for each part.

  1. A practical question
  2. The useful idea
  3. Work through the example
  4. Limits and next step
01

A practical question

Two cut metal parts cover the same number of foreground pixels, yet one has a rough damaged edge. An area count alone says they're equal. A perimeter estimate can expose the difference, and a shape ratio can summarize it.

02

The useful idea

For area, count the selected foreground pixels under a consistent rule. For perimeter, follow the digital boundary with a stated convention. A rough outline can have a longer estimated perimeter than a smooth one even when both occupy the same area. If you change the boundary tracing rule or the image scale, the measured ratio may also change.

03

Work through the example

Put the two masks side by side and check the original photos. Does a long perimeter come from the part, or from isolated noise around its edge? Try mild cleanup on a copy and see whether an actual notch remains visible. A single summary number should not hide the boundary that produced it. Two regions may have the same number of foreground pixels but very different boundaries. One can be compact and smooth; another can be long, thin, or jagged. Measure area and perimeter on both, then inspect how a one-pixel change affects the perimeter. Shape descriptors depend on the mask resolution and definition of boundary, so compare them under the same convention. If physical size matters, add calibration before turning pixel counts into units. Now check the idea on a concrete example: Compare two masks with equal area but different boundary roughness. A possible trap is worth naming: Perimeter is sensitive to resolution and jagged pixel edges. The answer follows from that evidence: Area counts foreground pixels, while perimeter follows the border; derived ratios describe shape under a chosen convention.

04

Limits and next step

Record the mask, connectivity, and measurement convention. Pixel counts are useful, but the workshop report needs physical units. Next, we'll convert an area using the camera's calibration.

Worked example

Compare two masks with equal area but different boundary roughness.

Knowledge check

Quick check: test your understanding

Try it yourself: Consider this case: Compare two masks with equal area but different boundary roughness. Explain how you would check the result. In your answer, address this limitation: Perimeter is sensitive to resolution and jagged pixel edges.

Check the reasoning

Area counts foreground pixels, while perimeter follows the border; derived ratios describe shape under a chosen convention. Perimeter is sensitive to resolution and jagged pixel edges.

What is the main idea behind measure area, perimeter, and shape?

Area counts foreground pixels, while perimeter follows the border; derived ratios describe shape under a chosen convention.

How is it used in the example?

Compare two masks with equal area but different boundary roughness.

What limitation should be checked?

Perimeter is sensitive to resolution and jagged pixel edges.

Further reading

Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.

Original ToolsInVision teaching examples. Editorial approach · Suggest a correction

Accessible referenceLesson 67 transcript305 words · Narration ready for the upcoming videoOpen transcript

Two cut metal parts cover the same number of foreground pixels, yet one has a rough damaged edge. An area count alone says they're equal. A perimeter estimate can expose the difference, and a shape ratio can summarize it.

For area, count the selected foreground pixels under a consistent rule. For perimeter, follow the digital boundary with a stated convention. A rough outline can have a longer estimated perimeter than a smooth one even when both occupy the same area. If you change the boundary tracing rule or the image scale, the measured ratio may also change.

Put the two masks side by side and check the original photos. Does a long perimeter come from the part, or from isolated noise around its edge? Try mild cleanup on a copy and see whether an actual notch remains visible. A single summary number should not hide the boundary that produced it. Two regions may have the same number of foreground pixels but very different boundaries. One can be compact and smooth; another can be long, thin, or jagged. Measure area and perimeter on both, then inspect how a one-pixel change affects the perimeter. Shape descriptors depend on the mask resolution and definition of boundary, so compare them under the same convention. If physical size matters, add calibration before turning pixel counts into units. Now check the idea on a concrete example: Compare two masks with equal area but different boundary roughness. A possible trap is worth naming: Perimeter is sensitive to resolution and jagged pixel edges. The answer follows from that evidence: Area counts foreground pixels, while perimeter follows the border; derived ratios describe shape under a chosen convention.

Record the mask, connectivity, and measurement convention. Pixel counts are useful, but the workshop report needs physical units. Next, we'll convert an area using the camera's calibration.