Logo elodees  elodees

A caring AI for a better world













Only alphabetic characters accented or not as well as the space are accepted

Logo IA




SUSAN Feature Detection





No account yet ?

Sign up to access all content


Tested in Anaconda and Python 3.7

import cv2 as cv
import matplotlib.pyplot as plt
 
def susan_mask():
    mask=np.ones((7,7))
    mask[0,0]=0
    mask[0,1]=0
    mask[0,5]=0
    mask[0,6]=0
    mask[1,0]=0
    mask[1,6]=0
    mask[5,0]=0
    mask[5,6]=0
    mask[6,0]=0
    mask[6,1]=0
    mask[6,5]=0
    mask[6,6]=0
    return mask
 
def susan_corner_detection(img1, img2):
 
    g = 3
 
    circularMask = susan_mask()
 
    for i in range(3, img1.shape[0] - 3):
        for j in range(3, img1.shape[1] - 3):
 
            ir=np.array(img1[i - 3: i + 4, j - 3: j + 4])
 
            ir =  ir[circularMask == 1]
 
            ir0 = img1[i, j]
 
            a = np.sum(np.exp(-((ir - ir0) / 10)**6))
 
            if a <= g:
                a = g - a
                cv.circle(img2, (j, i), 5, (0, 0, 255))
            else:
                a = 0
 
    return img2
 
img1 = cv.imread("carre-04.jpg", 0)
img2 = cv.imread("carre-04.jpg")
 
plt.imshow(img1, 'gray')
plt.axis('off')
plt.show()
 
img2 = susan_corner_detection(img1, img2)
 
plt.imshow(img2)
plt.axis('off')
plt.show()
 
Free image provided by pexel.com
Free image provided by pexel.com










Susan-Corner-Detection - GitHub











Welcome, my name is Eric Soupet and I am the administrator of the site elodees.com. elodees.com is a state of the art of Artificial Intelligence and aims to be collaborative, you can now offer content such as articles, events, tutorials, ... so don't hesitate !

Platform images credit : Pixabay - Pixabay License | Pexels - Pexels License