@@ -73,8 +73,8 @@ plt.imshow(plant_seedling, cmap="gray")
73
73
Again, we use the ` iio.imread() ` function to load our image.
74
74
Then, we convert the grayscale image of integer dtype, with 0-255 range, into
75
75
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 .
78
78
79
79
We now use the function ` np.histogram ` to compute the histogram of our image
80
80
which, after all, is a NumPy array:
@@ -90,7 +90,7 @@ the 256 possible values in the grayscale image.
90
90
91
91
The parameter ` range ` is the range of values each of the pixels in the image can have.
92
92
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 .
94
94
95
95
The first output of the ` np.histogram ` function is a one-dimensional NumPy array,
96
96
with 256 rows and one column,
@@ -351,10 +351,10 @@ with the
351
351
function call,
352
352
and then add a histogram line of the correct colour to the plot with the
353
353
354
- ` plt.plot(bin_edges[0:-1], histogram, color=c ) `
354
+ ` plt.plot(bin_edges[0:-1], histogram, color=color ) `
355
355
356
356
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 ` .
358
358
359
359
Finally we label our axes and display the histogram, shown here:
360
360
@@ -411,9 +411,9 @@ mask[circle] = 1
411
411
412
412
# just for display:
413
413
# 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
417
417
418
418
# create a new figure and display masked_img, to verify the
419
419
# validity of your mask
0 commit comments