#pylint:disable=no-member

import cv2 as cv
import numpy as np

img = cv.imread('/Users/webileapp/Desktop/niharika_files/projects/opencv_course_master/Resources/Photos/cats.jpg')
cv.imshow('Cats', img)
#
blank = np.zeros(img.shape[:2], dtype='uint8')
cv.imshow('Blank', blank)

gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow('Gray', gray)
#
blur = cv.GaussianBlur(gray, (5,5), cv.BORDER_DEFAULT)
cv.imshow('Blur', blur)

canny = cv.Canny(blur, 125, 175)
cv.imshow('Canny Edges', canny)
#
ret, thresh = cv.threshold(gray, 125, 255, cv.THRESH_BINARY)
cv.imshow('Thresh', thresh)
#
contours, hierarchies = cv.findContours(canny, cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)
print(f'{len(contours)} contour(s) found!')
#
cv.drawContours(blank, contours, -1, (200,120,100), 1)
cv.imshow('Contours Drawn', blank)

cv.waitKey(0)
[(6, 'cv2.imread', 'cv.imread', True, 'import cv2 as cv\n'), (7, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (9, 'numpy.zeros', 'np.zeros', True, 'import numpy as np\n'), (10, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (12, 'cv2.cvtColor', 'cv.cvtColor', True, 'import cv2 as cv\n'), (13, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (15, 'cv2.GaussianBlur', 'cv.GaussianBlur', True, 'import cv2 as cv\n'), (16, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (18, 'cv2.Canny', 'cv.Canny', True, 'import cv2 as cv\n'), (19, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (21, 'cv2.threshold', 'cv.threshold', True, 'import cv2 as cv\n'), (22, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (24, 'cv2.findContours', 'cv.findContours', True, 'import cv2 as cv\n'), (27, 'cv2.drawContours', 'cv.drawContours', True, 'import cv2 as cv\n'), (28, 'cv2.imshow', 'cv.imshow', True, 'import cv2 as cv\n'), (30, 'cv2.waitKey', 'cv.waitKey', True, 'import cv2 as cv\n')]