Region description

Basic description

Basic properties like area, Euler number, minimum rectangle that wraps the figure, etc. a region can be defined inside an image. In MATLAB we do this process in the following way:


B = bwlabel(f);
D = regionprops(B, properties)

where f is the image that contains the regions that we want to describe. The first thing we do is to convert the image to a representation through labels, using the first command.

The second command takes that labelled matrix and calculates the properties that we want. For example:

D = regionprops(B, 'area', 'boundingbox')

This would produce a structure like the following:


D =
	Area: 19939
	BoundingBox: [30.5000 19.5000 223 306]

The properties we want to calculate are listed separated by commas, as shown in the previous example. There are several properties:

Invariant moments

μpq=x=-y=-x-xc2y-ycqf(x,y)

ηpq= ηpqη00y

The following six moments give us six different numeric values that are insensitive to image transformations like scale changes, mirroring and rotation:

ϕ1=η20+η02

ϕ2=η20-η022+4η112

ϕ3=η30-3η122+3η21-η302

ϕ4=η30+η122+η21+η302

ϕ5=η30-3η12η30+η12η30+η122-3η21+η302+3η21-η03η21+η033η30+η122-η21+η032

ϕ6=η20-η02η30+η122-η21+η032+4η11η30+η12η21+η03

Main Components

We can describe an image using main componets. Suppose we have a group of images and we build the following group of matrices:

Snapshot of MATLAB interface

The average vector would be:

mx=1Kxkk=1K

where K = MN. Then, the covariance matrix can be built, with a size of mxm, like this:

Cx=1K-1k=1KKxk-mxxk-mxT

The eigenvalues and eigenvectors would then be:

y=Ax-mx

x=ATy+mx

We can reduce the number of eigenvalues to q. Then, the previous equation would turn into:

x^=AqTy+mx

If we stay with the main eigenvalues (the largest ones), we can obtain a reduced group of images that have the most relevant information. At the same time, this eigenvalues characterize the properties of the images.

The following command in MATLAB makes all the necessary calculations:

P = princomp(X,q)

where X is a matrix that contains the vectors x of the previous expressions, q is the number of eigenvalues that we want to obtain, and P is a structure that contains several things:

You can practice these concepts using snippet08.