Machine learning 050- Extracting Star features from images
(Python libraries and versions used in this article: Python 3.6, Numpy 1.14, Scikit-learn 0.19, matplotlib 2.2)
For the feature points of the image, we have discussed the edge detection method and Harris corner detection algorithm before. These detection algorithms detect the contour edges of the image rather than the internal details. To further extract the features of the internal details of the image, SIFT feature extractor and Star feature extractor are needed. Last article we explained the SIFT feature extractor, now we introduce the Star feature extractor.
In the blog post on the basic concept of feature points and how to find them, OpenCV has the following feature point model :(the use of these functions also applies to opencv-python)
1, Harris – Shi – Tomasi characteristics detector and CV: : GoodFeaturesToTrackDetector
The most commonly used definition of corner points is proposed by Harris [Harris88]. These corner points, called Haar corner points, can be considered as the original key points; It was further extended by Shi and Tomasi [Shi94], which proved to be superior for most tracing applications. Called “GoodFeatures” in OpenCV for historical reasons;
SimpleBlobDetector and CV :: SimpleBlobDetector
Put forward the concept of “spots”. Spots are not so explicitly localized in nature, but represent areas of interest that might be expected to have some stability over time.
3, FAST FeatureDetector and CV :: FastFeatureDetector
Originally proposed by Rosten and Drummond [Rosten06], THE basic idea of FAST (Characteristics of Accelerated Section Test) is that P will be a good key point if several points nearby are similar to P.
SIFT feature detector and CV :: xFeatures2D :: SIFT
SIFT feature (Scale-invariant Feature Transformation) [Lowe04], originally proposed by David Lowe in 2004, is widely used and is the basis of many features subsequently developed; SIFT features are expensive to calculate, but highly expressive.
5. SURF feature detector and CV :: xFeatures2D :: SURF
The SURF feature (Accelerated robust feature) was first proposed by Bay et al in 2006 [Bay06, Bay08] and is in many ways an evolution of the SIFT feature we just discussed. Features generated by SURF are not only computed much faster, but in many cases it is also more robust to observed changes in direction or illumination from SIFT features.
6. Star/CenSurE Feature Detector and CV :: XFeatures2D :: StarDetector
The Star feature, also known as the Central circumferential extremum (or CenSurE) feature, attempts to solve the problem of providing the localization level of the Haar point or FAST feature while also providing scale invariance.
7. BRIEF descriptor extractor and CV :: BriefDescriptorExtractor
BRIEF, or binary robust independent basic features, is a relatively new algorithm, and BRIEF does not find key points; Instead, it is used to generate descriptors for key points that can be located by any other available feature detector algorithm.
8. The BRISK algorithm
The BRISK40 descriptor, introduced by Leutenegger et al., attempts to improve Brief in two different ways (Leutenegger11). BRISK first introduces a feature detector of his own (recall that Brief is just a way of calculating descriptors). Second, BRISK’s feature itself, while similar to the BRIEF principle, attempts to make binary comparisons in ways that increase the robustness of the overall functionality.
ORB feature Detector and CV :: ORB
ORB functionality [Rublee11] was created with the goal of providing a faster alternative to SIFT or SURF. The ORB functionality uses a keypoint detector that is very close to FAST (which we saw earlier in this chapter), but uses a fundamentally different descriptor, based primarily on BRIEF.
10. FREAK descriptor extractor and CV :: xFeatures2D :: FREAK
Originally introduced as an improvement on Brief, BRISK, and ORB, the FREAK descriptor is a bio-heuristic descriptor that functions much like Brief, mainly in the way it evaluates the domain of binary comparisons [Alahi12].
Dense feature grid and CV :: DenseFeatureDetector class
The purpose of CV :: DenseFeatureDetector Class53 is simply to generate a regular array of features in the grid in the image.
1. Extracting image feature points using Star
Specific code and my last article is very similar, you can first look at [furnace AI] machine learning 049- extract image SIFT feature points
star = cv2.xfeatures2d.StarDetector_create() # Build Star feature point detector object
keypoints = star.detect(gray, None) # Use Star feature point detector object to detect feature points in gray-scale image
Copy the code
Draw keypoints to the original image
img_sift = np.copy(img)
cv2.drawKeypoints(img, keypoints, img_sift, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# The size of the circle indicates the importance of the feature, mainly on the table leg, which is more representative of the upper edge and edges
# Display the image drawn with feature points
plt.figure(12,figsize=(15.30))
plt.subplot(121)
img_rgb=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
plt.imshow(img_rgb)
plt.title('Raw Img')
plt.subplot(122)
img_sift_rgb=cv2.cvtColor(img_sift,cv2.COLOR_BGR2RGB)
plt.imshow(img_sift_rgb)
plt.title('Img with Star features')
Copy the code
# # # # # # # # # # # # # # # # # # # # # # # # small * * * * * * * * * * and # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
1, Star feature point extraction method is easy to implement in the code, cv2. Xfeatures2d. StarDetector_create () this function can build Star detector and detect method can be achieved.
2. The results of Star feature point extractor and SIFT feature point extractor have many similarities, both of which have many feature points near the table leg.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Note: This part of the code has been uploaded to (my Github), welcome to download.
References:
1, Classic Examples of Python machine learning, by Prateek Joshi, translated by Tao Junjie and Chen Xiaoli