Professional Documents
Culture Documents
1
Question:
Write a program for edge detection to extract edge based features from a sample image.
[]: a.shape
O/P: (280,450,3)
2
O/P: <matplotlib.image.AxesImage at 0x7fb39c921d30>
3
[]: rgb.shape
O/P: (280,450,3)
[]: b.shape
O/P: (280,450)
4
[]: # Converting a BGR Image to HSV Image
c = cv2.cvtColor(a, cv2.COLOR_BGR2HSV)
plt.imshow(c)
O/P: <matplotlib.image.AxesImage at 0x7fb39cba87f0>
[]: c.shape
O/P: (280,450,3)
[]: edges.shape
O/P: (1000,1600)
5
[]: d = cv2.imread("img2.jpeg")
# Using Sobel Filter on Images
sx = cv2.Sobel(src=d, ddepth=cv2.CV_64F, dx=0, dy=1,
ksize=3) plt.imshow(sx)
O/P: WARNING:matplotlib.image:Clipping input data to the valid range for imshow with
RGB data ([0..1] for floats or [0..255] for integers).
<matplotlib.image.AxesImage at 0x7fb39ca92790>
6
[]: sxy = cv2.Sobel(src=d, ddepth=cv2.CV_64F, dx=0, dy=1,
ksize=3) plt.imshow(sxy)
O/P: WARNING:matplotlib.image:Clipping input data to the valid range for imshow with
RGB data ([0..1] for floats or [0..255] for integers).
<matplotlib.image.AxesImage at 0x7fb39c192700>