@@ -349,22 +349,15 @@ For instance, let's look for the intensities of the pixels along the horizontal
349
349
line at ` Y=150 ` :
350
350
351
351
``` python
352
- import imageio.v3 as iio
353
- import matplotlib.pyplot as plt
354
- import skimage as ski
355
-
356
352
# read colonies color image and convert to grayscale
357
- #
358
353
image = iio.imread(' data/colonies-01.tif' )
359
354
image_gray = ski.color.rgb2gray(image)
360
355
361
356
# define the pixels for which we want to view the intensity (profile)
362
- #
363
357
xmin, xmax = (0 , image_gray.shape[1 ])
364
- ymin = ymax = 150
358
+ Y = ymin = ymax = 150
365
359
366
360
# view the image indicating the profile pixels position
367
- #
368
361
fig, ax = plt.subplots()
369
362
ax.imshow(image_gray, cmap = ' gray' )
370
363
ax.plot([xmin, xmax], [ymin, ymax], color = ' red' )
@@ -379,17 +372,11 @@ alt='Bacteria colony image with selected pixels marker'
379
372
The intensity of those pixels we can see with a simple line plot:
380
373
381
374
``` python
382
- # rename our "Y" variables for better reading
383
- #
384
- Y = ymin = ymax
385
-
386
375
# select the vector of pixels along "Y"
387
- #
388
376
image_gray_pixels_slice = image_gray[Y, :]
389
377
390
378
# guarantee the intensity values are in the [0:255] range (unsigned integers)
391
- #
392
- image_gray_pixels_slice = img_as_ubyte(image_gray_pixels_slice)
379
+ image_gray_pixels_slice = ski.img_as_ubyte(image_gray_pixels_slice)
393
380
394
381
fig = plt.figure()
395
382
ax = fig.add_subplot()
@@ -410,15 +397,11 @@ And now, how does the same set of pixels look in the corresponding *blurred* ima
410
397
411
398
``` python
412
399
# first, create a blurred version of (grayscale) image
413
- #
414
- import skimage as ski
415
-
416
400
image_blur = ski.filters.gaussian(image_gray, sigma = 3 )
417
401
418
402
# like before, plot the pixels profile along "Y"
419
- #
420
403
image_blur_pixels_slice = image_blur[Y, :]
421
- image_blur_pixels_slice = img_as_ubyte(image_blur_pixels_slice)
404
+ image_blur_pixels_slice = ski. img_as_ubyte(image_blur_pixels_slice)
422
405
423
406
fig = plt.figure()
424
407
ax = fig.add_subplot()
0 commit comments