Objects may be recognised from their outline. Shape is a very powerful feature:
- Classification by shape;require definition of suitable shape features
- Recognition of shape;
- Detection of shape
- allows users to draw a “simple” shape (circle, triangle etc) on their phone
- then ask a server if the drawn shape matches one of the shapes in its database-a low number of shapes
Choose Contour features
Given a contour, detected in the image/drawn by user, calculate rotation-invariant moments. E.g., oldest & most well known one: Hu moments
some others: Eccentricity, area, convexity defects, FFT transform of the centroid distance function, etc.
Choose Classification Method
There’re many methods to choose from. SVM, Decision Trees, Bayes Classifiers/Neural Networks (simpler classifiers), etc.
Prepare Training set of tagged contours
For the images in database which already know the type of shape, the id of the type should be included in the feature vector. This will serve as the training set. supervised training.
Train the classifier
Once building training set, rain classifier.
Use classifier in the App
Every time to classify a new shape just get its feature vector and use it to query the classifier.
To recognize the shapes in the picture by template matching, firstly represent shape as follows:
- notation to record a list of boundary bounds along a contour:
- Start location is given in absolute co-ordinates (x,y) and initial direction; Continuing location is given by the direction in which the contour is continued.
- Basic idea: Lower frequency coefficients represent the essence of the curve, higher frequency coefficient represent noise and artefacts
Centroid Distance Function
- Compute distance form centroid for every shape point,
- Founction is then subject to Fourier tansform,
- Requires star-convex shapes
- Contour is normalised with contour length
- Could apply to any closed curve
- Area in triangle between centroid and pairs of subsequent contour points
- Star-convex figures only
- similar to centroid distance, size matters
Shape Matrix (square/polar grid)
- construct a region-of-interest, create corresponding matrix: each cell is an matrix entry, cells are 1 if in the shape; vice versa;
- shapes of arbitrary topology
- cell size represents accuracy of shape representation
- matrix itself is not a feature
- matrix can be normalised, location, orientation, size
- local distribution of boundary points (each boundary point has its own local)
- neighbourhood is gridded and histogram of boundary points is computed.
- shape matching:
- Similar shapes should have boundary points with similar local neighbourhood
- Matching as a graph operation
- For each point of one shape, the best-fitting point in the other shape is searched
- Fitting quality depends on similarity between shape contexts
- Non-fitting points can be accomodated by adding dummy points
- Representation of a binary shape by the centres and sizes of maximal disks (the disk of maximal size touching but not exceeding the shape)
- Have topological features(endpoints, intersections, branches) and geometrical features(location, diameters)
- Computation of a skeleton: thinning by constrained morphological erosion.
- Assign different categorical meaning to different aspects of skeleton
- shape is evolved from different kinds of evolutions of a wave front from the skeleton (shocks of different order)
- Combination of shocks is represented by graph
- Matching between shapes by graph matching