From 859bc90ab3b167ba6e2b6d7ed950bbe4e95b92bc Mon Sep 17 00:00:00 2001 From: Marat Nagayev Date: Wed, 5 Oct 2022 21:48:20 +0300 Subject: [PATCH 1/2] Fix find_countours for modern OPENCV --- part_4.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/part_4.py b/part_4.py index 7116bbb..011f025 100644 --- a/part_4.py +++ b/part_4.py @@ -25,7 +25,7 @@ def find_features(img1): def find_contours_of_cards(image): blurred = cv2.GaussianBlur(image, (3, 3), 0) T, thresh_img = cv2.threshold(blurred, 215, 255, cv2.THRESH_BINARY) - (_, cnts, _) = cv2.findContours(thresh_img, cv2.RETR_EXTERNAL, + (cnts, _) = cv2.findContours(thresh_img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) return cnts @@ -54,4 +54,4 @@ def draw_rectangle_aroud_cards(cards_coordinates, image): gray_main_image = cv2.cvtColor(main_image, cv2.COLOR_BGR2GRAY) contours = find_contours_of_cards(gray_main_image) cards_location = find_coordinates_of_cards(contours, gray_main_image) - draw_rectangle_aroud_cards(cards_location, main_image) \ No newline at end of file + draw_rectangle_aroud_cards(cards_location, main_image) From 6a74e0d606b04e554cb021ffc391cc5ec26879c3 Mon Sep 17 00:00:00 2001 From: Marat Nagayev Date: Wed, 5 Oct 2022 21:55:41 +0300 Subject: [PATCH 2/2] Add instructions how to install dependency --- README.md | 6 ++++++ requirements.txt | 1 + 2 files changed, 7 insertions(+) create mode 100644 requirements.txt diff --git a/README.md b/README.md index 4a1b700..83bf90d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Opencv Tutorial +## Install + +`pip install opencv-python` + +## Articles + I highly recommend to see my articles for better understanding: Part_1: https://habr.com/ru/post/519454/ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0e118d4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +opencv-python>=4.0 \ No newline at end of file