Measurement Precision

Related Topics: How the different measurement tools work; Limitations.

In a classical mathematical definition of space, points don't have distance between them neither they have dimension, so one line can have an infinite number of points.

But digital images are composed of pixels, which do have dimension, so a line of pixels only can include a finite number of them, so any program that measures digital images faces real world limitations when measuring pixels.

Bersoft Image Measurements measures distances between control points placed on precise pixels.

A control point cannot be placed between two pixels, but only exactly on a definite pixel, so it differs from a mathematical point because it has dimension (1 pixel).

The following serial of images was captured with a zoom of 1600% to make clearly visible each individual pixel and illustrate how the program positions control points and how they differ from mathematical points.

Figure 1:
Notice that each of the two control points is exactly on top of a precise pixel.

Figure 2:
Here the user has placed the cursor on a position along the line to add a new control point. Notice that the cursor is not exactly on the center of a pixel, but is near the boundary between two pixels.

Figure 3:
The control point was placed exactly on the pixel where the cursor was positioned. The line is no longer a straight line.

In images with enough resolution this issue is not a problem, because there are enough pixel between any pair of control points as to smooth out the line.

But when the line is rendered on the Measurement Layer, it uses the original pixel in the image. So its borders look jagged:

Paint programs usually use antialiasing (smoothing of jagged lines) to display the image smoothly, but although antialiasing make the images prettier, it distorts the image, so antialiasing is not convenient when doing digital measurements. Bersoft Image Measurement always displays the real pixels in the image, not a smoothed out version.

Shared Pixels

When measuring each one of several connected segments, the control points between segments belong to the first segment (the first segment drawn).

If the first and second segments are in line (180°), the shared pixel will be counted only once, as part of the first segment, but if they are not in-line, the shared pixel will assigned to each segment.

Of course, when counting the total length of all segments (polygon perimeter), all shared pixels always are counted only once.

In all the following images, the shared pixel is painted in red color.

The shared pixel is assigned only to the first segment, which measures 3 pixels;
the second segment measures 4 pixels.
The total length is 7 pixels.

 

Here the shared pixel also is assigned to the first segment, but not to the second one.
The total length is 7.07 pixels, the first and second segments measure 2.83 and 4.24 pixels respectively.

Both segments measure 4 pixels each one, because they are not in line. The shared pixel is assigned to both segments.
The total length is 8 pixels.

 

Also in this image the shared pixel is assigned to both segments, so it is counted twice.

 

 

Vectorial and bitmap graphics

Computer graphics fall into to two main categories: Vector graphics and Bitmap graphics.

The difference between these two types is what they're made up of. Vector graphics are made up of lines and curves. Bitmap graphics are made up of pixels.

The dashed measurement lines are vectorial, so they look smooth at any zoom, but when the image is rendered to the Measurement Layer, which is a bitmap graphic, the pixels get clearly noticeable, causing pixelation (jagged lines).

Note: Perimeter measurement in ellipses, unless the major and minor diameters are the same, are not 100% exact, but are very precise approximations.

How different tools measure areas

Automatic Area

Polygon

Ellipse

Rectangle

Counts the selected area pixels in the image

Counts the pixels inside the polygon.
An non-visible in-memory polygon is drawn and filled with a solid color, then the number of colored pixels is counted, including those under the 1 pixel outline.
The program uses this way to calculate polygonal areas because there are not mathematical ways completely consistent with all kinds of polygons (convex or concave) and 100% accurate.

Uses the following formula:

area = *  d1 / 2 * d2 / 2

d1: major diameter
d2: minor diameter

if d1 = d2, the following formula will be used instead:

area = *  (d / 2)2

Uses the following formula:

area =  width * height

When measuring a figure with perfectly vertical and horizontal lines, like a square, all four tools will return exactly the same area, but when measuring most figures that are not rectangles you may find some differences between different tools.

If you measure an ellipse with the Automatic Area tool, it will count its pixels, consequently, if no conversion factor is applied, it will always return a number without decimal fractions.

On the other hand, if the same ellipse is measured with the Ellipse tool, it will use a mathematical formula instead counting the pixels, so the measurements will be slightly different, and most probably will have several decimal positions.

In fact both measurement will be correct, but mixing both them may cause errors, so it is important to know the difference between the different measuring methods.