Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Minor fixes to image as arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Jul 9, 2024
1 parent 0673677 commit 97369d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tutorial/01_images_are_arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ A color image is a 3D array, where the last dimension has size 3 and represents

```{code-cell} ipython3
cat = ski.data.chelsea()
print("Shape:", cat.shape)
print("Values min/max:", cat.min(), cat.max())
Expand Down Expand Up @@ -248,7 +249,7 @@ for i, animal in enumerate(animals):
print('The animal in position {} is {}'.format(i, animal))
```

## <span class="exercize">Exercise 1: draw the letter H</span>
## Exercise 1: draw the letter H

Define a function that takes as input an RGB image (shape `MxNx3`) and a pair of coordinates, `(row, column)`, and returns a copy with a green letter H overlaid at those coordinates. The coordinates point to the top-left corner of the H.

Expand Down
9 changes: 5 additions & 4 deletions tutorial/solved/01_images_are_arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupytext:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.14.7
jupytext_version: 1.16.2
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -186,7 +186,7 @@ scikit-image conveniently wraps many of these in the `io` submodule, and will us
```{code-cell} ipython3
from skimage import io
image = io.imread('./data/balloon.jpg')
image = io.imread('../data/balloon.jpg')
print(type(image))
print(image.dtype)
Expand Down Expand Up @@ -307,7 +307,7 @@ Display the different color channels of the image along (each as a gray-scale im
# --- read in the image ---
image = plt.imread('./data/Bells-Beach.jpg')
image = plt.imread('../data/Bells-Beach.jpg')
# --- assign each color channel to a different variable ---
Expand Down Expand Up @@ -384,8 +384,9 @@ Change the coefficients to 1/3 (i.e., take the mean of the red, green, and blue
:tags: [raises-exception, remove-output]
from skimage import color, img_as_float
import skimage as ski
image = img_as_float(io.imread('./data/balloon.jpg'))
image = img_as_float(ski.io.imread('../data/balloon.jpg'))
gray = color.rgb2gray(image)
coefficients = [0.2126, 0.7152, 0.0722]
Expand Down

0 comments on commit 97369d7

Please sign in to comment.