Skip to content

Commit 7197e9e

Browse files
committed
markdown source builds
Auto-generated via {sandpaper} Source : 2b4a521 Branch : main Author : Toby Hodges <tobyhodges@carpentries.org> Time : 2023-12-08 15:19:39 +0000 Message : Merge pull request #312 from bear-rsg/histogram-episode-corrections Histogram episode corrections
1 parent e7830c2 commit 7197e9e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

05-creating-histograms.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ plt.imshow(plant_seedling, cmap="gray")
7373
Again, we use the `iio.imread()` function to load our image.
7474
Then, we convert the grayscale image of integer dtype, with 0-255 range, into
7575
a floating-point one with 0-1 range, by calling the function
76-
`ski.util.img_as_float`.
77-
We will keep working with images in the value range 0 to 1 in this lesson.
76+
`ski.util.img_as_float`. We can also calculate histograms for 8 bit images as we will see in the
77+
subsequent exercises.
7878

7979
We now use the function `np.histogram` to compute the histogram of our image
8080
which, after all, is a NumPy array:
@@ -90,7 +90,7 @@ the 256 possible values in the grayscale image.
9090

9191
The parameter `range` is the range of values each of the pixels in the image can have.
9292
Here, we pass 0 and 1,
93-
which is the value range of our input image after transforming it to grayscale.
93+
which is the value range of our input image after conversion to floating-point.
9494

9595
The first output of the `np.histogram` function is a one-dimensional NumPy array,
9696
with 256 rows and one column,
@@ -351,10 +351,10 @@ with the
351351
function call,
352352
and then add a histogram line of the correct colour to the plot with the
353353

354-
`plt.plot(bin_edges[0:-1], histogram, color=c)`
354+
`plt.plot(bin_edges[0:-1], histogram, color=color)`
355355

356356
function call.
357-
Note the use of our loop variables, `channel_id` and `c`.
357+
Note the use of our loop variables, `channel_id` and `color`.
358358

359359
Finally we label our axes and display the histogram, shown here:
360360

@@ -411,9 +411,9 @@ mask[circle] = 1
411411

412412
# just for display:
413413
# make a copy of the image, call it masked_image, and
414-
# use np.logical_not() and indexing to apply the mask to it
415-
masked_img = wellplate[:]
416-
masked_img[np.logical_not(mask)] = 0
414+
# zero values where mask is False
415+
masked_img = np.array(wellplate)
416+
masked_img[~mask] = 0
417417

418418
# create a new figure and display masked_img, to verify the
419419
# validity of your mask

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"episodes/02-image-basics.md" "30630cc141643700495c2038f2cc9f68" "site/built/02-image-basics.md" "2023-12-08"
88
"episodes/03-skimage-images.md" "063fa4bb5032702c0196b0d953d94474" "site/built/03-skimage-images.md" "2023-12-08"
99
"episodes/04-drawing.md" "9d78a765f5e9747ffc2aa43a4a5a414d" "site/built/04-drawing.md" "2023-09-05"
10-
"episodes/05-creating-histograms.md" "bdcf983127c242eb995605038598d09f" "site/built/05-creating-histograms.md" "2023-09-18"
10+
"episodes/05-creating-histograms.md" "59c07192c0a6217e8a42d3e7365025f9" "site/built/05-creating-histograms.md" "2023-12-08"
1111
"episodes/06-blurring.md" "8d109bb4c49f27f54857f6d35b4c6b9a" "site/built/06-blurring.md" "2023-12-08"
1212
"episodes/07-thresholding.md" "7ae5260f90e1df8e20a6226cce8ec6b6" "site/built/07-thresholding.md" "2023-09-05"
1313
"episodes/08-connected-components.md" "59d42797208c5bf569da2fa2e4dd05df" "site/built/08-connected-components.md" "2023-09-09"

0 commit comments

Comments
 (0)