@@ -68,7 +68,7 @@ fig, ax = plt.subplots()
6868ax.imshow(shapes01)
6969```
7070
71- ![ ] ( data /shapes-01.jpg) {alt='Image with geometric shapes on white background' .image-with-shadow}
71+ ![ ] ( fig /shapes-01.jpg) {alt='Image with geometric shapes on white background' .image-with-shadow}
7272
7373Now suppose we want to select only the shapes from the image.
7474In other words, we want to leave the pixels belonging to the shapes "on,"
@@ -214,7 +214,7 @@ ax.imshow(selection)
214214Now, it is your turn to practice. Suppose we want to use simple thresholding
215215to select only the coloured shapes (in this particular case we consider grayish to be a colour, too) from the image ` data/shapes-02.jpg ` :
216216
217- ![ ] ( data /shapes-02.jpg) {alt='Another image with geometric shapes on white background'}
217+ ![ ] ( fig /shapes-02.jpg) {alt='Another image with geometric shapes on white background'}
218218
219219First, plot the grayscale histogram as in the [ Creating
220220Histogram] ( 05-creating-histograms.md ) episode and
@@ -324,7 +324,7 @@ fig, ax = plt.subplots()
324324ax.imshow(maize_roots)
325325```
326326
327- ![ ] ( data /maize-root-cluster.jpg) {alt='Image of a maize root'}
327+ ![ ] ( fig /maize-root-cluster.jpg) {alt='Image of a maize root'}
328328
329329We use Gaussian blur with a sigma of 1.0 to denoise the root image.
330330Let us look at the grayscale histogram of the denoised image.
@@ -348,25 +348,25 @@ ax.set_xlim(0, 1.0)
348348
349349![ ] ( fig/maize-root-cluster-histogram.png ) {alt='Grayscale histogram of the maize root image'}
350350
351- The histogram has a significant peak around 0.2 and then a broader "hill" around 0.6 followed by a
351+ The histogram has a significant peak around 0.2 and then a broader "hill" around 0.6 followed by a
352352smaller peak near 1.0. Looking at the grayscale image, we can identify the peak at 0.2 with the
353353background and the broader peak with the foreground.
354354Thus, this image is a good candidate for thresholding with Otsu's method.
355355The mathematical details of how this works are complicated (see
356356[ the scikit-image documentation] ( https://scikit-image.org/docs/dev/api/skimage.filters.html#threshold-otsu )
357357if you are interested),
358358but the outcome is that Otsu's method finds a threshold value between the two peaks of a grayscale
359- histogram which might correspond well to the foreground and background depending on the data and
359+ histogram which might correspond well to the foreground and background depending on the data and
360360application.
361361
362362:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor
363363
364- The histogram of the maize root image may prompt questions from learners about the interpretation
365- of the peaks and the broader region around 0.6. The focus here is on the separation of background
366- and foreground pixel values. We note that Otsu's method does not work well
367- for the image with the shapes used earlier in this episode, as the foreground pixel values are more
364+ The histogram of the maize root image may prompt questions from learners about the interpretation
365+ of the peaks and the broader region around 0.6. The focus here is on the separation of background
366+ and foreground pixel values. We note that Otsu's method does not work well
367+ for the image with the shapes used earlier in this episode, as the foreground pixel values are more
368368distributed. These examples could be augmented with a discussion of unimodal, bimodal, and multimodal
369- histograms. While these points can lead to fruitful considerations, the text in this episode attempts
369+ histograms. While these points can lead to fruitful considerations, the text in this episode attempts
370370to reduce cognitive load and deliberately simplifies the discussion.
371371
372372::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -636,10 +636,10 @@ def enhanced_root_mass(filename, sigma):
636636
637637 # perform binary thresholding to mask the white label and circle
638638 binary_mask = blurred_image < 0.95
639-
639+
640640 # perform automatic thresholding using only the pixels with value True in the binary mask
641641 t = ski.filters.threshold_otsu(blurred_image[binary_mask])
642-
642+
643643 # update binary mask to identify pixels which are both less than 0.95 and greater than t
644644 binary_mask = (blurred_image < 0.95 ) & (blurred_image > t)
645645
@@ -677,7 +677,7 @@ The `&` operator above means that we have defined a logical AND statement. This
677677| False | True | False |
678678| True | False | False |
679679| True | True | True |
680-
680+
681681Knowing how to construct this kind of logical operation can be very helpful in image processing. The University of Minnesota Library's [ guide to Boolean operators] ( https://libguides.umn.edu/BooleanOperators ) is a good place to start if you want to learn more.
682682
683683::::::::::::::::::::::::::::::::::::::::::::::::::
0 commit comments