@@ -690,7 +690,7 @@ set the entries that belong to small objects to `0`.
690
690
object_areas = np.array([objf[" area" ] for objf in object_features])
691
691
object_labels = np.array([objf[" label" ] for objf in object_features])
692
692
small_objects = object_labels[object_areas < min_area]
693
- labeled_image[np.isin(labeled_image,small_objects)] = 0
693
+ labeled_image[np.isin(labeled_image, small_objects)] = 0
694
694
```
695
695
696
696
An even more elegant way to remove small objects from the image is
@@ -703,7 +703,7 @@ i.e, their pixel values are set to `False`.
703
703
We can then apply ` ski.measure.label ` to the masked image:
704
704
705
705
``` python
706
- object_mask = ski.morphology.remove_small_objects(binary_mask,min_area)
706
+ object_mask = ski.morphology.remove_small_objects(binary_mask, min_size = min_area)
707
707
labeled_image, n = ski.measure.label(object_mask,
708
708
connectivity = connectivity, return_num = True )
709
709
```
@@ -717,7 +717,7 @@ def enhanced_connected_components(filename, sigma=1.0, t=0.5, connectivity=2, mi
717
717
gray_image = ski.color.rgb2gray(image)
718
718
blurred_image = ski.filters.gaussian(gray_image, sigma = sigma)
719
719
binary_mask = blurred_image < t
720
- object_mask = ski.morphology.remove_small_objects(binary_mask,min_area)
720
+ object_mask = ski.morphology.remove_small_objects(binary_mask, min_size = min_area)
721
721
labeled_image, count = ski.measure.label(object_mask,
722
722
connectivity = connectivity, return_num = True )
723
723
return labeled_image, count
0 commit comments