19R604 - VS 441 Flipbook PDF

19R604 - VS 441

52 downloads 123 Views 341KB Size

Story Transcript

19R604 – VISION SYSTEMS Assignment on

METHODS FOR DETECTING THE FEATURES OF AN IMAGE Submitted by

PRAGATHEESH RJ

21R441

22 JANUARY 2023

PSG COLLEGE OF TECHNOLOGY DEPARTMENT OF ROBOTICS AND AUTOMATION COIMBATORE -641 004

HARRIS CORNER DETECTION: Input:

Output:

Features of an Image: A feature in computer vision is a region of interest in an image that is unique and easy to recognize. Features include things like, points, edges, blobs, and corners. The common methods to detect the features of an image, • Harris corner detector: This method is used to detect corners in an image, which can be useful for object recognition and tracking. • Shi-Tomasi Corner Detector: It is used to extract the strongest corners from images and other corners below level are rejected. • ORB (Oriented FAST and Rotated BRIEF): This method is a combination of the FAST corner detector and the BRIEF descriptor. It is faster to compute than SIFT and SURF, and it can detect features in real time. HARRIS CORNER DETECTION: Program: import numpy as np import cv2 as cv filename = (r"E:\6th SEM\AIVS LAB\Resources\allen key.jpg") img = cv.imread(filename) gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY) gray = np.float32(gray) dst = cv.cornerHarris(gray,2,3,0.04) #result is dilated for marking the corners, not important dst = cv.dilate(dst,None) # Threshold for an optimal value, it may vary depending on the image. img[dst>0.01*dst.max()]=[0,0,255] cv.imshow('dst',img) cv.waitKey(0) cv.destroyAllWindows()

SHI - TOMASI CORNER DETECTOR: Input:

Output:

SHI - TOMASI CORNER DETECTOR: Program: import cv2 import numpy as np import matplotlib.pyplot as plt #matplotlib inline # path to input image specified and # image is loaded with imread command img = cv2.imread(r"E:\6th SEM\AIVS LAB\Resources\old.jfif") # convert image to grayscale gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Shi-Tomasi corner detection function # We are detecting only 100 best corners here # You can change the number to get desired result. corners = cv2.goodFeaturesToTrack(gray_img, 100, 0.01, 10) # convert corners values to integer # So that we will be able to draw circles on them corners = np.int0(corners) # draw red color circles on all corners for i in corners: x, y = i.ravel() cv2.circle(img, (x, y), 3, (255, 0, 0), -1) # resulting image plt.imshow(img) # De-allocate any associated memory usage if cv2.waitKey(0) & 0xff == 27: cv2.destroyAllWindows()

ORB – ORIENTED FAST & ROTATED BREIF: Input:

Output:

ORB – ORIENTED FAST & ROTATED BREIF: Program:

import numpy as np import cv2 as cv from matplotlib import pyplot as plt img = cv.imread(r"E:\6th SEM\AIVS LAB\Resources\Spanners.jpg", cv.IMREAD_GRAYSCALE) # Initiate ORB detector orb = cv.ORB_create() # find the keypoints with ORB kp = orb.detect(img,None) # compute the descriptors with ORB kp, des = orb.compute(img, kp) # draw only keypoints location,not size and orientation img2 = cv.drawKeypoints(img, kp, None, color=(0,255,0), flags=0) plt.imshow(img2), plt.show()

Get in touch

Social

© Copyright 2013 - 2024 MYDOKUMENT.COM - All rights reserved.