April 2020
Intermediate to advanced
438 pages
12h 2m
English
Perform the following steps to implement edge detection with LoG and zero-crossing:
def any_neighbor_zero(img, i, j): for k in range(-1,2): for l in range(-1,2): if k == 0 and l == 0: continue # skip the input pixel if img[i+k, j+k] == 0: return True return False
def zero_crossing(img): img[img > 0] = 1 img[img < 0] = 0 out_img = np.zeros(img.shape) for i in range(1,img.shape[0]-1): for j in range(1,img.shape[1]-1): if img[i,j] > 0 and any_neighbor_zero(img, i, j): out_img[i,j] = 255 return out_img
Read now
Unlock full access