#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)
[((70, 188), 'cv2.imread', 'cv.imread', (['"""/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    )\n", (79, 188), True, 'import cv2 as cv\n'), ((179, 201), 'cv2.imshow', 'cv.imshow', (['"""Cats"""', 'img'], {}), "('Cats', img)\n", (188, 201), True, 'import cv2 as cv\n'), ((212, 250), 'numpy.zeros', 'np.zeros', (['img.shape[:2]'], {'dtype': '"""uint8"""'}), "(img.shape[:2], dtype='uint8')\n", (220, 250), True, 'import numpy as np\n'), ((251, 276), 'cv2.imshow', 'cv.imshow', (['"""Blank"""', 'blank'], {}), "('Blank', blank)\n", (260, 276), True, 'import cv2 as cv\n'), ((285, 320), 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY'], {}), '(img, cv.COLOR_BGR2GRAY)\n', (296, 320), True, 'import cv2 as cv\n'), ((321, 344), 'cv2.imshow', 'cv.imshow', (['"""Gray"""', 'gray'], {}), "('Gray', gray)\n", (330, 344), True, 'import cv2 as cv\n'), ((354, 402), 'cv2.GaussianBlur', 'cv.GaussianBlur', (['gray', '(5, 5)', 'cv.BORDER_DEFAULT'], {}), '(gray, (5, 5), cv.BORDER_DEFAULT)\n', (369, 402), True, 'import cv2 as cv\n'), ((402, 425), 'cv2.imshow', 'cv.imshow', (['"""Blur"""', 'blur'], {}), "('Blur', blur)\n", (411, 425), True, 'import cv2 as cv\n'), ((435, 459), 'cv2.Canny', 'cv.Canny', (['blur', '(125)', '(175)'], {}), '(blur, 125, 175)\n', (443, 459), True, 'import cv2 as cv\n'), ((460, 491), 'cv2.imshow', 'cv.imshow', (['"""Canny Edges"""', 'canny'], {}), "('Canny Edges', canny)\n", (469, 491), True, 'import cv2 as cv\n'), ((508, 554), 'cv2.threshold', 'cv.threshold', (['gray', '(125)', '(255)', 'cv.THRESH_BINARY'], {}), '(gray, 125, 255, cv.THRESH_BINARY)\n', (520, 554), True, 'import cv2 as cv\n'), ((555, 582), 'cv2.imshow', 'cv.imshow', (['"""Thresh"""', 'thresh'], {}), "('Thresh', thresh)\n", (564, 582), True, 'import cv2 as cv\n'), ((609, 669), 'cv2.findContours', 'cv.findContours', (['canny', 'cv.RETR_LIST', 'cv.CHAIN_APPROX_SIMPLE'], {}), '(canny, cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)\n', (624, 669), True, 'import cv2 as cv\n'), ((716, 772), 'cv2.drawContours', 'cv.drawContours', (['blank', 'contours', '(-1)', '(200, 120, 100)', '(1)'], {}), '(blank, contours, -1, (200, 120, 100), 1)\n', (731, 772), True, 'import cv2 as cv\n'), ((771, 805), 'cv2.imshow', 'cv.imshow', (['"""Contours Drawn"""', 'blank'], {}), "('Contours Drawn', blank)\n", (780, 805), True, 'import cv2 as cv\n'), ((807, 820), 'cv2.waitKey', 'cv.waitKey', (['(0)'], {}), '(0)\n', (817, 820), True, 'import cv2 as cv\n')]