Update findContours parameter type
This commit is contained in:
@@ -91,7 +91,7 @@ cv.imshow('Peaks', dist)
|
||||
dist_8u = dist.astype('uint8')
|
||||
|
||||
# Find total markers
|
||||
_, contours, _ = cv.findContours(dist_8u, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, _ = cv.findContours(dist_8u, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)
|
||||
|
||||
# Create the marker image for the watershed algorithm
|
||||
markers = np.zeros(dist.shape, dtype=np.int32)
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ def thresh_callback(val):
|
||||
|
||||
## [findContours]
|
||||
# Find contours
|
||||
_, contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
## [findContours]
|
||||
|
||||
## [allthework]
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ def thresh_callback(val):
|
||||
|
||||
## [findContours]
|
||||
# Find contours
|
||||
_, contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
## [findContours]
|
||||
|
||||
# Find the rotated rectangles and ellipses for each contour
|
||||
|
||||
@@ -13,7 +13,7 @@ def thresh_callback(val):
|
||||
canny_output = cv.Canny(src_gray, threshold, threshold * 2)
|
||||
|
||||
# Find contours
|
||||
_, contours, hierarchy = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, hierarchy = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
|
||||
# Draw contours
|
||||
drawing = np.zeros((canny_output.shape[0], canny_output.shape[1], 3), dtype=np.uint8)
|
||||
|
||||
@@ -13,7 +13,7 @@ def thresh_callback(val):
|
||||
canny_output = cv.Canny(src_gray, threshold, threshold * 2)
|
||||
|
||||
# Find contours
|
||||
_, contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
|
||||
# Find the convex hull object for each contour
|
||||
hull_list = []
|
||||
|
||||
@@ -17,7 +17,7 @@ def thresh_callback(val):
|
||||
|
||||
## [findContours]
|
||||
# Find contours
|
||||
_, contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, _ = cv.findContours(canny_output, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
## [findContours]
|
||||
|
||||
# Get the moments
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ for i in range(6):
|
||||
cv.line(src, vert[i], vert[(i+1)%6], ( 255 ), 3)
|
||||
|
||||
# Get the contours
|
||||
_, contours, _ = cv.findContours(src, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
contours, _ = cv.findContours(src, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
|
||||
|
||||
# Calculate the distances to the contour
|
||||
raw_dist = np.empty(src.shape, dtype=np.float32)
|
||||
|
||||
@@ -81,7 +81,7 @@ _, bw = cv.threshold(gray, 50, 255, cv.THRESH_BINARY | cv.THRESH_OTSU)
|
||||
|
||||
## [contours]
|
||||
# Find all the contours in the thresholded image
|
||||
_, contours, _ = cv.findContours(bw, cv.RETR_LIST, cv.CHAIN_APPROX_NONE)
|
||||
contours, _ = cv.findContours(bw, cv.RETR_LIST, cv.CHAIN_APPROX_NONE)
|
||||
|
||||
for i, c in enumerate(contours):
|
||||
# Calculate the area of each contour
|
||||
|
||||
Reference in New Issue
Block a user