Nekshay commited on
Commit
d7ee77e
·
verified ·
1 Parent(s): 570d958

Update tempo.txt

Browse files
Files changed (1) hide show
  1. tempo.txt +6 -2
tempo.txt CHANGED
@@ -6,6 +6,7 @@ def detect_half_circles(binary_image, threshold=80):
6
  contours, _ = cv2.findContours(binary_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
7
 
8
  detected_shapes = []
 
9
 
10
  for contour in contours:
11
  # Approximate the contour
@@ -31,9 +32,12 @@ def detect_half_circles(binary_image, threshold=80):
31
 
32
  # Draw a bounding rectangle around the detected half-circle
33
  x, y, w, h = cv2.boundingRect(contour)
34
- cv2.rectangle(binary_image, (x, y), (x + w, y + h), (255, 255, 255), 2)
 
 
 
35
 
36
- return binary_image, detected_shapes
37
 
38
  # Example usage
39
  # Load the binary masked image (make sure it's a binary image)
 
6
  contours, _ = cv2.findContours(binary_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
7
 
8
  detected_shapes = []
9
+ output_image = cv2.cvtColor(binary_image, cv2.COLOR_GRAY2BGR)
10
 
11
  for contour in contours:
12
  # Approximate the contour
 
32
 
33
  # Draw a bounding rectangle around the detected half-circle
34
  x, y, w, h = cv2.boundingRect(contour)
35
+ cv2.rectangle(output_image, (x, y), (x + w, y + h), (0, 255, 0), 2)
36
+
37
+ # Draw the contour with a different color
38
+ cv2.drawContours(output_image, [approx], -1, (0, 0, 255), 2)
39
 
40
+ return output_image, detected_shapes
41
 
42
  # Example usage
43
  # Load the binary masked image (make sure it's a binary image)