Skip to content

Commit 31d8dbe

Browse files
authored
Additional suggestions from code review
1 parent f79aa12 commit 31d8dbe

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

episodes/07-thresholding.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ Thus, this image is a good candidate for thresholding with Otsu's method.
352352
The mathematical details of how this works are complicated (see
353353
[the scikit-image documentation](https://scikit-image.org/docs/dev/api/skimage.filters.html#threshold-otsu)
354354
if you are interested),
355-
but the outcome is that Otsu's method finds a threshold value between
356-
the two peaks of a grayscale histogram.
355+
but the outcome is that Otsu's method finds a threshold value between the two peaks of a grayscale histogram which might correspond well to the foreground and background depending the data and application.
357356
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
358357
The histogram of the maize root image may prompt questions from learners about the interpretation of the peaks and the broader region around 0.6. The focus here is on the separation of background and foreground pixel values. We note that Otsu's method does not work well for the image with the shapes used earlier in this episode, as the foreground pixel values are more distributed. These examples could be augmented by a discussion of unimodal, bimodal, and multimodal histograms. While these points can lead to fruitful discussions, the text in this episode attempts to reduce cognitive load and deliberately simplifies the discussion.
359358
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -633,7 +632,7 @@ def enhanced_root_mass(filename, sigma):
633632
t = ski.filters.threshold_otsu(blurred_image[binary_mask])
634633

635634
# update binary mask to identify pixels which are both less than 0.95 and greater than t
636-
binary_mask = np.logical_and(binary_mask, blurred_image > t)
635+
binary_mask = binary_mask & (blurred_image > t)
637636

638637
# determine root mass ratio
639638
root_pixels = np.count_nonzero(binary_mask)

0 commit comments

Comments
 (0)