Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions processing/segmenter/planktoscope/segmenter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,35 @@ def __augment_slice(dim_slice, max_dims, size=10):
color=(150, 0, 200),
thickness=1,
)
equivalent_radius = math.sqrt(region.area/ math.pi)
tagged_image = cv2.ellipse(
tagged_image,
center=(int(region.centroid[1]), int(region.centroid[0])),
axes=(int(equivalent_radius), int(equivalent_radius)),
angle=0,
startAngle=0,
endAngle=180,
color=(0, 0, 255),
)
equivalent_radius_filled = math.sqrt(region.area_filled / math.pi)
tagged_image = cv2.ellipse(
tagged_image,
center=(int(region.centroid[1]), int(region.centroid[0])),
axes=(int(equivalent_radius_filled), int(equivalent_radius_filled)),
angle=0,
startAngle=180,
endAngle=360,
color=(0, 0, 255),
)
tagged_image = cv2.ellipse(
tagged_image,
center=(int(region.centroid[1]), int(region.centroid[0])),
axes=(int(region.axis_major_length / 2), int(region.axis_minor_length / 2)),
angle=(90 - math.degrees(region.orientation)),
startAngle=0,
endAngle=360,
color=(150, 0, 200),
)
contours, hierarchy = cv2.findContours(
np.uint8(region.image),
mode=cv2.RETR_TREE, # RETR_FLOODFILL or RETR_EXTERNAL
Expand Down