What is Shape Context
Shape context is a very classic feature for shape recognition (a string of computer-friendly numbers) that is extracted by Serge Belongie and Jitendra Malik in their article "Shape Matching and" in 2002. object recognition using shape contexts "is presented. This feature extraction method allows the computer to measure the similarity between shapes, and can simultaneously derive the point correspondence between shapes.
Shape context, when representing a shape, first samples N points on the shape's outline, and for each point, it uses the information of its surrounding points to extract a vector to represent the point (the exact extraction method can refer to the original paper). As a result, each shape is represented by N vectors, and the vectors can be measured distances, and after determining how this distance is measured, the Hungarian (Hungarian) algorithm can be used to find the two shapes,n pairs n The best matching relationship. Of course, the author of the article further proposed that the TPS (Thin Plate Spline) can be used to change the shape of the match to the constant deformation, in order to achieve better matching results, here is not introduced.
Matching of contour points of the same shape
Matching of contour points of different shapes
Use shape context for character recognition
The process of using shape context for character recognition is the process of finding the most similar template library image to the shape to be identified. Although the process of thinking is relatively simple, but there are some things to be aware of, here to write my own approach.
1) Preparation of template word repertoires
Because shape context can make a good match when the shape has a plane transformation such as tilt, displacement, and size. So unlike a statistical-based model, each character that uses the shape context feature requires fewer templates to be identified. The experiment here uses only one to two templates for each character, and each template is a single-pixel contour that is drawn manually.
Character Template Library for recognition
2) Sampling of shape points
When you use shape context to extract a shape's features, you first sample N points on the shape's outline. The number of contour points of the actual input image is generally unknown, and depending on the size of the image, the coordinates of these points are different, so it is necessary to preprocess these conditions.
When the contour point of the input image is sufficient, the first one can intercept the smallest area of the image containing the contour, then sample the contour of the region by N points, and finally scale the coordinates of these points to the [0-1] interval to achieve the goal of scale normalization.
Sampling and normalization of the contour points of the input image
When the number of contour points of the input image is insufficient, we can enlarge the image, and then sample it according to the above method when the number of contour points is sufficient. However, it should be noted that when the image is enlarged, the original shape outline may be thicker, so the image refinement operation is required, so that the width of the contour as far as possible to maintain a single pixel width.
Processing when the number of outline points of the input image is insufficient
a demonstration of the character recognition program
Click I open the video to watch
http://blog.csdn.net/raodotcong/article/details/9060529
Shape context for pattern recognition---shapes recognition using shape context