@@ -49,15 +49,6 @@ image_np = np.array(input_image)
4949# Using formula:
5050# Y' = 0.299 R + 0.587 G + 0.114 B
5151image_GrayScale = image_np[:, :, 0 ] * 0.299 + image_np[:, :, 1 ] * 0.587 + image_np[:, :, 2 ] * 0.114
52- # Checking the type of the array
53- print (type (image_GrayScale)) # <class 'numpy.ndarray'>
54- # Checking the shape of the array
55- print (image_GrayScale.shape) # (270, 480)
56- # Giving the name to the window with figure
57- plt.figure(' GrayScale image from RGB' )
58- # Showing the image by using obtained array
59- plt.imshow(image_GrayScale, cmap = plt.get_cmap(' gray' ))
60- plt.show()
6152```
6253
6354Setting Hyperparameters and applying Pad frame for input image.
@@ -85,13 +76,10 @@ Declaring filters for **Edge Detection**.
8576<br />Consider following part of the code:
8677
8778``` py
88- # Declaring standard filters (kernel ) with size 3x3 for edge detection
79+ # Declaring standard filters (kernels ) with size 3x3 for edge detection
8980filter_1 = np.array([[1 , 0 , - 1 ], [0 , 0 , 0 ], [- 1 , 0 , 1 ]])
9081filter_2 = np.array([[0 , 1 , 0 ], [1 , - 4 , 1 ], [0 , 1 , 0 ]])
9182filter_3 = np.array([[- 1 , - 1 , - 1 ], [- 1 , 8 , - 1 ], [- 1 , - 1 , - 1 ]])
92- # Checking the shape
93- print (filter_1.shape, filter_2.shape, filter_3.shape)
94- # ((3, 3) (3, 3) (3, 3)
9583```
9684
9785Creating function to delete negative values from resulted image.
0 commit comments