Skip to content

Commit

Permalink
Change 1s to 255s in mask_kmeans
Browse files Browse the repository at this point in the history
  • Loading branch information
k034b363 authored Nov 3, 2024
1 parent af3601f commit c014ef9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plantcv/plantcv/kmeans_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def mask_kmeans(labeled_img, k, cat_list=None):
mask_dict = {}
L = [*range(k)]
for i in L:
mask_light = np.where(labeled_img == i, 1, 0)
mask_light = np.where(labeled_img == i, 255, 0)
_debug(visual=mask_light, filename=os.path.join(params.debug_outdir, "_kmeans_mask_"+str(i)+".png"))
mask_dict[str(i)] = mask_light
return mask_dict
Expand All @@ -80,9 +80,9 @@ def mask_kmeans(labeled_img, k, cat_list=None):
params.debug = None
for idx, i in enumerate(cat_list):
if idx == 0:
mask_light = np.where(labeled_img == i, 1, 0)
mask_light = np.where(labeled_img == i, 255, 0)
else:
mask_light = pcv.logical_or(mask_light, np.where(labeled_img == i, 1, 0))
mask_light = pcv.logical_or(mask_light, np.where(labeled_img == i, 255, 0))
params.debug = debug
_debug(visual=mask_light, filename=os.path.join(params.debug_outdir, "_kmeans_combined_mask.png"))
return mask_light

0 comments on commit c014ef9

Please sign in to comment.