This page is a part of CVprimer.com, a wiki devoted to computer vision. It focuses on low level computer vision, digital image analysis, and applications. It is designed as an online textbook but the exposition is informal. It geared towards software developers, especially beginners, and CS students. The wiki contains mathematics, algorithms, code examples, source code, compiled software, and some discussion. If you have any questions or suggestions, please contact me directly.

# Measuring holes in a gasket

Given an image of a gasket. Its resolution is 300 dpi.

Next the Pixcavator 2.4 analysis is performed under a magnification of 13x. The shrunk image is on the right.

The analysis yields perimeters of the 4 large holes as 952, 957, 964, & 953 pixels (average = 956). When one "physically" measures these openings, the result is that the diameter is 3.452 in. = 87.68 mm. This would correspond to a circumference of 10.845 in. = 275.46 mm. Question: what scaling factor is appropriate to generate correct results?

To get the correct measurement for the perimeter one shouldn't multiply by 13. This number refers to the size of the image in pixels, i.e., area (like 100x100=10,000 pixels). [Shrinking is handled differently in Pixcavator 3.0 and later - see Tutorial.] As a result while the areas of objects go down by 13, the lengths (and Perimeter) go down by sqrt(13) = 3.6. Using this scaling factor produces a result that is close to the actual measurement: 956x3.6/300 = 11.472 inches.

One thing to keep in mind is that the accuracy of computation of lengths is limited (see Lengths of curves) regardless of the resolution. Assuming that the hole is known to be a circle and if you are interested in the diameter, you are better off getting it from the area of the hole instead of the perimeter - you get 3.4 inches. Similarly for squares.