aboutsummaryrefslogtreecommitdiff
path: root/gerbolyze.py
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2019-03-26 02:11:09 +0900
committerjaseg <code@jaseg.net>2019-03-26 02:11:09 +0900
commitcb4761f7e45bd9f80a94712316bfa67d37747d60 (patch)
tree8d4e1b50cafab9fec7f69d55ae899f1c986b8523 /gerbolyze.py
parentb87480afa9fd6b54ff1e523393196640d82518b5 (diff)
downloadgerbolyze-cb4761f7e45bd9f80a94712316bfa67d37747d60.tar.gz
gerbolyze-cb4761f7e45bd9f80a94712316bfa67d37747d60.tar.bz2
gerbolyze-cb4761f7e45bd9f80a94712316bfa67d37747d60.zip
gerbolyze.py: Fix cv2.findContours to work with cv2 4.0
Diffstat (limited to 'gerbolyze.py')
-rwxr-xr-xgerbolyze.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gerbolyze.py b/gerbolyze.py
index 9ed30d4..6991a3e 100755
--- a/gerbolyze.py
+++ b/gerbolyze.py
@@ -228,7 +228,8 @@ def plot_contours(
# Extract contour hierarchy using OpenCV
status_print('Extracting contours')
- img_cont_out, contours, hierarchy = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_KCOS)
+ # See https://stackoverflow.com/questions/48291581/how-to-use-cv2-findcontours-in-different-opencv-versions/48292371
+ contours, hierarchy = findContoursHack(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_KCOS)[-2:]
aperture = list(layer.apertures)[0]