Monday, December 3, 2012

Measuring within images

Here's a question - is it possible to measure within images? The answer, of course, is yes (with a gigantic caveat). It depends on what you mean by measure, and what it is that you'd like to measure.

In Amped Five, you have the ability to measure in 1d, 2d, and 3d. Tomorrow, we'll look at 3d measurements. Here's a look at 2 dimensional (X,Y) measurements within images.

The Amped FIVE Measure 2d tool computes a specific measurement distance in a rectified image. Image rectification corrects image distortion by transforming the image into a standard coordinate system (think perspective correction). Given an image of a planar surface (2d), points on the image plane can be mapped into corresponding points in the rectified plane by means of a projective transformation called homography. Points in one plane are mapped into the corresponding points in the other plane as follows:
X = Hx where x is an image point, X is the corresponding point on the world plane and H is the 3x3 matrix representing the homography transformation. Once the homography matrix H is known (or has been computed), any image point can be mapped into the corresponding location on the rectified planar surface and distances between actual points can be extracted by computing the Euclidean distance d(X1,X2), where X1 and X2 are the actual points of the two points x1 and x2 on the image plane. The homography is computed directly from a set of at least four points by the Perspective Correction filter.

Correct Perspective, in FIVE, maps a desired quadrangular region to a rectangular one, which allows seeing the plane of interest as the plane of the image was parallel to it. Pixel values are interpolated with a bicubic algorithm. (Anil. K. Jain, Fundamentals of Digital Image Processing, Prentice Hall, pp. 320-322, 1989.)

So what's the takeaway here? Measuring planar surfaces, or making two dimensional measurements within images, requires that a perspective correction process be applied first. If this isn't possible, then you should consider 3d measurements - which will be covered tomorrow - that deal with perspective as it is, and factors/computes the vanishing point in the image.

No comments: