result = results[0] for i in range(1, 8): result[:] = np.maximum(result, results[i]) return normalize(result).round().astype(np.uint8) if __name__ == '__main__': # test = np.asarray([[255, 255, 255, 255, 255, 255, 255, 255], # [255, 255, 255, 255, 255, 255, 255, 255], # [255, 255, 0, 0, 0, 0, 255, 255], # [255, 255, 0, 0, 0, 0, 255, 255], # [255, 255, 0, 0, 0, 0, 255, 255], # [255, 255, 0, 0, 0, 0, 255, 255], # [255, 255, 255, 255, 255, 255, 255, 255], # [255, 255, 255, 255, 255, 255, 255, 255]]) # sobel(test) # img = gambar.read('D:\\Kuliah\\pola\\527C868C9284958A22F9E4D448BDDA12.JPG') img = gambar.read('C:\\Users\\user all\\Downloads\\532fd38d-1.jpg') gray = gambar.to_gray(img) # gambar.show(gray) result = derajat1(gray, 'prewitt') gambar.show(result) # kernel = [ # [1, 2, 1], # [2, 4, 2], # [1, 2, 1], # ] # gray = np.array(kernel) # convolve(gray, kernel)