Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update prune _debug to plot the other debug img #1619

Merged
merged 2 commits into from
Nov 4, 2024
Merged
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
12 changes: 6 additions & 6 deletions plantcv/plantcv/morphology/prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ def prune(skel_img, size=0, mask=None):
pruned_img = image_subtract(pruned_img, removed_barbs)
pruned_img = _iterative_prune(pruned_img, 1)

# Reset debug mode
params.debug = debug

# Make debugging image
if mask is None:
pruned_plot = np.zeros(skel_img.shape[:2], np.uint8)
Expand All @@ -81,10 +78,13 @@ def prune(skel_img, size=0, mask=None):
cv2.drawContours(pruned_plot, removed_segments, -1, (0, 0, 255), params.line_thickness, lineType=8)
cv2.drawContours(pruned_plot, pruned_obj, -1, (150, 150, 150), params.line_thickness, lineType=8)

_debug(visual=pruned_img, filename=os.path.join(params.debug_outdir, f"{params.device}_pruned.png"))
_debug(visual=pruned_img, filename=os.path.join(params.debug_outdir, f"{params.device}_pruned_debug.png"))

# Segment the pruned skeleton
segmented_img, segment_objects = segment_skeleton(pruned_img, mask)

# Reset debug mode
params.debug = debug

_debug(visual=pruned_img, filename=os.path.join(params.debug_outdir, f"{params.device}_pruned.png"))
_debug(visual=pruned_plot, filename=os.path.join(params.debug_outdir, f"{params.device}_pruned_debug.png"))

return pruned_img, segmented_img, segment_objects