#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', (['"""/Users/webileapp/Desktop/niharika_files/projects/opencv_course_master/Resources/Photos/cats.jpg"""'], {}), True, 'import cv2 as cv\n'), (7, 'cv2.imshow', 'cv.imshow', (['"""Cats"""', 'img'], {}), True, 'import cv2 as cv\n'), (9, 'numpy.zeros', 'np.zeros', (['img.shape[:2]'], {'dtype': '"""uint8"""'}), True, 'import numpy as np\n'), (10, 'cv2.imshow', 'cv.imshow', (['"""Blank"""', 'blank'], {}), True, 'import cv2 as cv\n'), (12, 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY'], {}), True, 'import cv2 as cv\n'), (13, 'cv2.imshow', 'cv.imshow', (['"""Gray"""', 'gray'], {}), True, 'import cv2 as cv\n'), (15, 'cv2.GaussianBlur', 'cv.GaussianBlur', (['gray', '(5, 5)', 'cv.BORDER_DEFAULT'], {}), True, 'import cv2 as cv\n'), (16, 'cv2.imshow', 'cv.imshow', (['"""Blur"""', 'blur'], {}), True, 'import cv2 as cv\n'), (18, 'cv2.Canny', 'cv.Canny', (['blur', '(125)', '(175)'], {}), True, 'import cv2 as cv\n'), (19, 'cv2.imshow', 'cv.imshow', (['"""Canny Edges"""', 'canny'], {}), True, 'import cv2 as cv\n'), (21, 'cv2.threshold', 'cv.threshold', (['gray', '(125)', '(255)', 'cv.THRESH_BINARY'], {}), True, 'import cv2 as cv\n'), (22, 'cv2.imshow', 'cv.imshow', (['"""Thresh"""', 'thresh'], {}), True, 'import cv2 as cv\n'), (24, 'cv2.findContours', 'cv.findContours', (['canny', 'cv.RETR_LIST', 'cv.CHAIN_APPROX_SIMPLE'], {}), True, 'import cv2 as cv\n'), (27, 'cv2.drawContours', 'cv.drawContours', (['blank', 'contours', '(-1)', '(200, 120, 100)', '(1)'], {}), True, 'import cv2 as cv\n'), (28, 'cv2.imshow', 'cv.imshow', (['"""Contours Drawn"""', 'blank'], {}), True, 'import cv2 as cv\n'), (30, 'cv2.waitKey', 'cv.waitKey', (['(0)'], {}), True, 'import cv2 as cv\n')]