Python image processing: Brisk feature detection

Source: Internet
Author: User
Tags cos sin

Happy Shrimp

http://blog.csdn.net/lights_joy/

Welcome reprint, but please keep the author information


brisk is brief an improvement of the descriptors, compared to the brief python



First read the Image:


# Read Original image img = Cv2.imread (r ' F:\projects\src\opencv\images\cotton\39.gray.jpg ') plt.imshow (IMG)

then create a Brisk Feature Detectors:

# Create Brisk Detector brisk = Cv2. Brisk_create ()

Next, the features of the image are computed, and the prototype of this function is:

Help on built-in function Detectandcompute:detectandcompute (...)    Detectandcompute (image, mask[, descriptors[, useprovidedkeypoints]), keypoints, descriptors

Call it to compute the feature point and display:

# Compute feature points and display (KPT, desc) = Brisk.detectandcompute (img, None) bk_img = img.copy () out_img = Img.copy () out_img = Cv2.drawkeypoin TS (bk_img, KPT, out_img) plt.figure (2) plt.imshow (out_img)

The result is this:


It seems that there is no direct help to our leaf recognition, we need to find the characteristic point.


rotate the original image directly - Degree:

# Original image rotated 30 degrees Ang=np.pi/6rot_mat = Np.array ([[Np.cos (ANG), Np.sin (ANG), 0], [-np.sin (ANG), Np.cos (ANG), +]]) img_30 = Cv2.warpaffine (IMG, Rot_mat, (600,500)) Plt.figure (3) plt.imshow (img_30)

To calculate a new eigenvalue:

# Feature point Detection (kpt_30, desc_30) = Brisk.detectandcompute (img_30, None) bk_img = img_30.copy () out_img = Img_30.copy () out_img = Cv2 . drawkeypoints (Bk_img, kpt_30, Out_img) plt.figure (4) plt.imshow (OUT_IMG)


To do the matching of the feature points directly:

# feature points Match Matcher = Cv2. Bfmatcher () matches = Matcher.match (desc, desc_30) print (matches)

Finally, the matching results are shown in the image:

# Show matching results, show only the previous 5 points matches.sort (none, none, True) out_img = Cv2.drawmatches (img, KPT, img_30, Kpt_30, Matches[0:5], Out_ IMG) plt.figure (5) plt.imshow (out_img)



The matching effect is also disappointing.













??

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Python image processing: Brisk feature detection

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.