Skip to content

Commit

Permalink
Merge pull request #4 from anbergem/dev
Browse files Browse the repository at this point in the history
Fix finding contours in transistion to OpenCV 4.
  • Loading branch information
anbergem committed Apr 5, 2019
2 parents eb54e5f + f533a91 commit 7db4296
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions opencv_wrapper/image_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def find_external_contours(image: np.ndarray) -> Tuple[Contour, ...]:
:param image: The image in with to find the contours
:return: A tuple of Contour objects
"""
rets = cv.findContours(image, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)
contours = rets[1]
contours, _ = cv.findContours(image, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)[-2:]
contours = contours if contours is not None else ()
return (*map(Contour, contours),)

Expand Down

0 comments on commit 7db4296

Please sign in to comment.