Skip to content

Commit b4c5b49

Browse files
author
Robert (Bob) Turner
committed
remove 3 colour image
1 parent 55f257f commit b4c5b49

File tree

2 files changed

+9
-60
lines changed

2 files changed

+9
-60
lines changed

episodes/02-image-basics.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ questions:
77
objectives:
88
- "Define the terms bit, byte, kilobyte, megabyte, etc."
99
- "Explain how a digital image is composed of pixels."
10+
- "Explain how images are stored in NumPy arrays."
1011
- "Explain the left-hand coordinate system used in digital images."
1112
- "Explain the RGB additive colour model used in digital images."
13+
- "Explain the order of the three colour values in skimage images."
1214
- "Explain the characteristics of the BMP, JPEG, and TIFF image formats."
1315
- "Explain the difference between lossy and lossless compression."
1416
- "Explain the advantages and disadvantages of compressed image formats."
@@ -20,6 +22,9 @@ upper left corner, the x-axis running to the right, and the y-axis running
2022
down."
2123
- "Most frequently, digital images use an additive RGB model, with eight bits
2224
for the red, green, and blue channels."
25+
- "skimage images are stored as multi-dimensional NumPy arrays."
26+
- "In skimage images, the red channel is specified first, then the green, then
27+
the blue, i.e., RGB."
2328
- "Lossless compression retains all the details in an image, but lossy
2429
compression results in loss of some of the original image detail."
2530
- "BMP images are uncompressed, meaning they have high quality but also that

episodes/03-skimage-images.md

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
---
2-
title: "Image Representation in skimage"
2+
title: "Working with skimage"
33
teaching: 70
44
exercises: 50
55
questions:
6-
- "How are digital images stored in Python with the skimage computer vision library?"
6+
- "How can the skimage Python computer vision library be used to work with images?"
77
objectives:
8-
- "Explain how images are stored in NumPy arrays."
9-
- "Explain the order of the three colour values in skimage images."
108
- "Read, display, and save images."
119
- "Resize images with skimage."
1210
- "Perform simple image thresholding with NumPy array operations."
1311
- "Extract sub-images using array slicing."
1412
keypoints:
15-
- "skimage images are stored as multi-dimensional NumPy arrays."
16-
- "In skimage images, the red channel is specified first, then the green, then
17-
the blue, i.e., RGB."
1813
- "Images are read from disk with the `skimage.io.imread()` function."
1914
- "We create a window that automatically scales the displayed image
2015
with matplotlib and calling `show()` on the global figure object."
@@ -28,59 +23,8 @@ images, e.g., `clip = image[60:150, 135:480, :]`."
2823
- "Metadata is not retained when images are loaded as skimage images."
2924
---
3025

31-
Now that we know a bit about computer images in general,
32-
let us review and expand on the concepts we just learned.
33-
34-
## Images are represented as NumPy arrays
35-
36-
In [the Image Basics episode]({{page.root}}{% link _episodes/02-image-basics.md %}),
37-
we learned that images are represented as
38-
rectangular arrays of individually-coloured square pixels,
39-
and that the colour of each pixel can be represented as an RGB triplet of numbers.
40-
On import, skimage stores the information for each pixel in an n-dimensional NumPy arrays.
41-
42-
The rectangular shape of the array corresponds to the shape of the image,
43-
although the order of the coordinates are reversed.
44-
The "depth" of the array for a full-colour image in skimage image is three,
45-
with one layer for each of the three channels.
46-
The differences in the order of coordinates and the order of the channel
47-
layers can cause some confusion,
48-
so we should spend a bit more time looking at that.
49-
50-
When we think of a pixel in an image,
51-
we think of its (x, y) coordinates (in a left-hand coordinate system)
52-
like (113, 45) and its colour,
53-
specified as a RGB triple like (245, 134, 29).
54-
In an skimage image, the same pixel would be specified with
55-
*(y, x)* coordinates (45, 113) and *RGB* colour (245, 134, 29).
56-
57-
Let us take a look at this idea visually.
58-
Consider this image of a chair:
59-
60-
![Chair image](../fig/chair-original.jpg)
61-
62-
A visual representation of how this image is stored as a NumPy array is:
63-
64-
![Chair layers](../fig/chair-layers-rgb.png)
65-
66-
So, when we are working with skimage images,
67-
we specify the *y* coordinate first,
68-
then the *x* coordinate.
69-
And, the colours are stored as *RGB* values -
70-
red in layer 0,
71-
green in layer 1,
72-
blue in layer 2.
73-
74-
> ## Coordinate and colour channel order
75-
>
76-
> CAUTION: it is vital to remember the order of the coordinates and
77-
> colour channels when dealing with images as NumPy arrays.
78-
> *If* we are manipulating or accessing an image array directly,
79-
> we specifiy the y coordinate first, then the x.
80-
> Further, the first channel stored is the red channel,
81-
> followed by the green, and then the blue.
82-
>
83-
{: .callout}
26+
We have covered much of how images are represented in computer software. In this episode we will learn some more methods
27+
for accessing and changing digital images.
8428

8529
## Reading, displaying, and saving images
8630

0 commit comments

Comments
 (0)