#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, 6, 6, 114), 'cv2.imread', 'cv.imread', ({(6, 16, 6, 113): '"""/Users/webileapp/Desktop/niharika_files/projects/opencv_course_master/Resources/Photos/cats.jpg"""'}, {}), "(\n    '/Users/webileapp/Desktop/niharika_files/projects/opencv_course_master/Resources/Photos/cats.jpg'\n    )", True, 'import cv2 as cv\n'), ((7, 0, 7, 22), 'cv2.imshow', 'cv.imshow', ({(7, 10, 7, 16): '"""Cats"""', (7, 18, 7, 21): 'img'}, {}), "('Cats', img)", True, 'import cv2 as cv\n'), ((9, 8, 9, 46), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((10, 0, 10, 25), 'cv2.imshow', 'cv.imshow', ({(10, 10, 10, 17): '"""Blank"""', (10, 19, 10, 24): 'blank'}, {}), "('Blank', blank)", True, 'import cv2 as cv\n'), ((12, 7, 12, 42), 'cv2.cvtColor', 'cv.cvtColor', ({(12, 19, 12, 22): 'img', (12, 24, 12, 41): 'cv.COLOR_BGR2GRAY'}, {}), '(img, cv.COLOR_BGR2GRAY)', True, 'import cv2 as cv\n'), ((13, 0, 13, 23), 'cv2.imshow', 'cv.imshow', ({(13, 10, 13, 16): '"""Gray"""', (13, 18, 13, 22): 'gray'}, {}), "('Gray', gray)", True, 'import cv2 as cv\n'), ((15, 7, 15, 54), 'cv2.GaussianBlur', 'cv.GaussianBlur', ({(15, 23, 15, 27): 'gray', (15, 29, 15, 34): '(5, 5)', (15, 36, 15, 53): 'cv.BORDER_DEFAULT'}, {}), '(gray, (5, 5), cv.BORDER_DEFAULT)', True, 'import cv2 as cv\n'), ((16, 0, 16, 23), 'cv2.imshow', 'cv.imshow', ({(16, 10, 16, 16): '"""Blur"""', (16, 18, 16, 22): 'blur'}, {}), "('Blur', blur)", True, 'import cv2 as cv\n'), ((18, 8, 18, 32), 'cv2.Canny', 'cv.Canny', ({(18, 17, 18, 21): 'blur', (18, 23, 18, 26): '125', (18, 28, 18, 31): '175'}, {}), '(blur, 125, 175)', True, 'import cv2 as cv\n'), ((19, 0, 19, 31), 'cv2.imshow', 'cv.imshow', ({(19, 10, 19, 23): '"""Canny Edges"""', (19, 25, 19, 30): 'canny'}, {}), "('Canny Edges', canny)", True, 'import cv2 as cv\n'), ((21, 14, 21, 60), 'cv2.threshold', 'cv.threshold', ({(21, 27, 21, 31): 'gray', (21, 33, 21, 36): '125', (21, 38, 21, 41): '255', (21, 43, 21, 59): 'cv.THRESH_BINARY'}, {}), '(gray, 125, 255, cv.THRESH_BINARY)', True, 'import cv2 as cv\n'), ((22, 0, 22, 27), 'cv2.imshow', 'cv.imshow', ({(22, 10, 22, 18): '"""Thresh"""', (22, 20, 22, 26): 'thresh'}, {}), "('Thresh', thresh)", True, 'import cv2 as cv\n'), ((24, 24, 24, 84), 'cv2.findContours', 'cv.findContours', ({(24, 40, 24, 45): 'canny', (24, 47, 24, 59): 'cv.RETR_LIST', (24, 61, 24, 83): 'cv.CHAIN_APPROX_SIMPLE'}, {}), '(canny, cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)', True, 'import cv2 as cv\n'), ((27, 0, 27, 54), 'cv2.drawContours', 'cv.drawContours', ({(27, 16, 27, 21): 'blank', (27, 23, 27, 31): 'contours', (27, 33, 27, 35): '(-1)', (27, 37, 27, 50): '(200, 120, 100)', (27, 52, 27, 53): '(1)'}, {}), '(blank, contours, -1, (200, 120, 100), 1)', True, 'import cv2 as cv\n'), ((28, 0, 28, 34), 'cv2.imshow', 'cv.imshow', ({(28, 10, 28, 26): '"""Contours Drawn"""', (28, 28, 28, 33): 'blank'}, {}), "('Contours Drawn', blank)", True, 'import cv2 as cv\n'), ((30, 0, 30, 13), 'cv2.waitKey', 'cv.waitKey', ({(30, 11, 30, 12): '(0)'}, {}), '(0)', True, 'import cv2 as cv\n')]