COMP 204
Introduction to image analysis with scikit-image (part two) Mathieu Blanchette, based on slides from Christopher J.F. Cameron and Carlos G. Oliver
1 / 24
COMP 204 Introduction to image analysis with scikit-image (part - - PowerPoint PPT Presentation
COMP 204 Introduction to image analysis with scikit-image (part two) Mathieu Blanchette, based on slides from Christopher J.F. Cameron and Carlos G. Oliver 1 / 24 Grayscaling Many image processing algorithms assume a 2D matrix not an
1 / 24
2 / 24
1 import
2 import
3 import
4 from
5 6 # read
7 image = i o . imread ( ”monkey . jpg ” ) 8 # c o n v e r t
9 gray image = rgb2gray ( image ) 10 11
12
13
14
15 i o . imsave ( ” monkey grayscale . jpg ” , gray image ) 3 / 24
4 / 24
1 import
2 import
3 import
4 from
5 import
6 7 image = i o . imread ( ”monkey . jpg ” ) 8 gray image = rgb2gray ( image ) 9 10 # t h i s
11 # with
12 b l a c k a n d w h i t e = np . where ( gray image >0.5 ,
13 14
15
16 i o . imsave ( ” monkey black and white . jpg ” , b l a c k a n d w h i t e ) 5 / 24
6 / 24
7 / 24
i i 5 3 5 6 3 3 4 3 5 2 5 5 5 2 4 i 3 7 6 3 8 i 3 8 9 3 5 7 12 9 7 3 5 6 2 5 3 5 6 3 2 5 6 5 7 9 9 2 5 7 3 6 7 2 3 3 5 5 6 7 9 8 7 4
Average ¡
8 / 24
1 def
2
3
4
5
6
7
8
9
10
11
12
13
14
15
9 / 24
10 / 24
11 / 24
12 / 24
13 / 24
14 / 24
15 / 24
16 / 24
17 / 24
18 / 24
1 def
2
3
4
5
6
7 8
9
10
11
12
13 14
15
16
19 / 24
20 / 24
21 / 24
22 / 24
23 / 24
24 / 24