day 2 - unibas.ch · plan day 1 - 'look at the data' • scale, calibrate, re-size,...

122
day 2

Upload: others

Post on 18-May-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

day 2

Page 2: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

plan

DAY 1 - 'look at the data'• scale, calibrate, re-size, visualize• histograms, profiles, LUTs• morphological operations• from element maps to phase maps• volume estimates

DAY 2 - 'image analysis basics'• segmentation image → bitmap

POP, NOP, edge detectors• image analysis of segments, best fit ellipses• re-direct sampling• property mapping• texture mapping

DAY 3 - 'all about grain size'• 2D grain size / grain size distribution• 3D grain size / grain size distribution• fractal grain size distribution

DAY 4 - 'all about shape'• paror - orientation of particles• surfor - orientation of surface• ishapes - shapedescriptors

DAY 5 - 'spatial aspects'• FFT - spatial frequencies• ACF - neighbourhood relations• spatial distributions

Page 3: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

segmentation

Page 4: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

steps in image analysis

recording

analysis

1

23

4

etc.

Page 5: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

steps in image analysis

recording

analysis

1

2

34 etc.

segmentation

Page 6: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

recording

analysis

steps in image analysis

pre-processing

segmentation

post-processing

Page 7: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

image models

models

images

Page 8: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

thresholding

segmentation based on image model

grey levelslicing

edgedetection

Page 9: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

post-processingranking filters

structural filtering

Page 10: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

segmentation: point operation

step 1segmentationbasis = grey value (Z)⇒ bitmap

step 2 structural filtering

Z X

Y

Page 11: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

segmentation: neighboorhood operation

high

low

step 1 segmentationbasis = neighboorhood (X,Y)⇒ grey scale image

step 2 thresholding - structural filtering

Z X

Y

Page 12: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

ranking filters I

original

minimum median maximum

0 0 0 1 1 1 1 1 1

minimum median maximum

ranked grey values of 3x3 neighbourhood

Page 13: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

minimum median maximum

0 0 0 0 0 0 0 0 1

minimum median maximum

ranked grey values of 3x3 neighbourhood

ranking filters I

Page 14: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

0 1 1 1 1 1 1 1 1

minimum median maximum

ranked grey values of 3x3 neighbourhood

minimum median maximum

ranking filters I

Page 15: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

ranking filters I

median minimum maximum

Page 16: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

40 25 23

25 10 15

13 1 5

original

ranking filters I for gray scale images

ranked grey values of 3x3 neighbourhood

1 5 10 13 15 23 25 25 40

minimum median maximum

minimum median maximum

Page 17: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original median minimum maximum

ranking filters I for gray scale images

Page 18: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original set count:1 - erode if 1 is white2 - erode if 2 are whiteetc.

set count:1 - dilate if 1 is black2 - dilate if 2 are blacketc.

ranked grey values of 3x3 neighbourhood

ranking filters II

definition of neighbouring pixels

Page 19: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

Set Count:1 - erode if 1 of 9 is white2 - erode if 2 of 9 are white....8 - erode if 8 of 9 are white

Set Count:1 - dilate if 1 of 9 is black2 - dilate if 2 of 9 are black....8 - dilate if 8 of 9 are black

strength of operation:

WEAK

STRONG

ranking filters II

ranked grey values of 3x3 neighbourhood

Page 20: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

erode 7 erode 5 erode 3 erode 1

erosion

ranking filters II

Page 21: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

dilate 7 dilate 5 dilate 3 dilate 1

dilation

ranking filters II

Page 22: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

= opening = closing

1. erode2. dilate

1. dilate2. erode

morphological operations

Page 23: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original ultimate points

distance map watershed

morphological operations

Page 24: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

logical operations

Page 25: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Logical operations on bitmaps

AND1 0

1 1 00 0 0

1 01 1 10 1 0

1 01 0 10 1 0

1 01 1 00 1 0

image 1

image 1 image 2

imag

e 2

OR

XOR

COPY

(1∪2)

(1∩2)

(1|2)

image addition

1 + 2

1 to 2

Page 26: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

COPY 1 to 2

1 AND 2 1 OR 2 1 XOR 2

image 1

- copy & paste control- Image Math...

image 2

Adding two images

Page 27: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

shifted copy of 1

shift copy:Δx=+2 Δy=-2

image 1

Adding image and copy of image

1 AND 1 1 OR 1 1 XOR 1

Page 28: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exerciseerode dilate...

Page 29: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exercise

1. open Truzzo2. pre-process (noise) - background - re-size - crop3. background correction4. save

5. Lazy LUT: perform contiguous segmentation 6. make stack of 6 phases7. start pots-processing: morphological filtering

Page 30: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Lazy erodedilate

Page 31: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Macro: Jazy erodilate (imageJ)

Page 32: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

post-processingclean up

segmentation

Page 33: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

manual cleaning

Page 34: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase map

invert: phase mask

original

increase brightness

cleaning in stack using phase masks

Page 35: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase mask + brightness

added OR

continue manualcorrections

thresholdinvert

merge mask and light version

Page 36: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

grain maps

z-project/average: 1-5

procedure 1: separate grains ...

4

2 3

6

1

5

yields grain boundaries

Page 37: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

grain maps

... derive grain boundaries

4

2 3

6

1

5

Page 38: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

using colored grain maps

Page 39: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

minimum filter

phase map: no grain boundaries

grain map: grain boundaries = 'phase'

derive phase map from grain map

Page 40: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase maps

average all(incl. holes & unidentified)

procedure 2: separate phases ...

4

2 3

6

1

5

Page 41: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase maps

erode phasesaverage

... derive phase boundaries

4

2 3

6

1

5

Page 42: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase mapgrain map

Page 43: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

segmentation based on Z

25 78 106 158 200

originalDensity Slicing = contiguous grey values

Z X

Y

Segments and segment boundaryContiguous areas = spatially contiguous

phase map

10 63 18187 150

255

250 10 63 18187 150

255

250

grain mapphase map

post-processing yields:

Page 44: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

compare segmentations

qtz = 26.8%qtz = 28.8%qtz = 29.7%

Page 45: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase- grain- grain boundary maps

phase phase map6 phases (%)

grain + gb map 7 phases (%)

grain map 5 phases (%)

number of grains

biotite 7.7 6.6 7.3 15

K-feldspar 20.8 18.9 20.7 32

muscovite 2.4 2.0 2.2 7

plagioclase 40.1 36.9 40.4 66

quartz 28.8 26.8 29.4 47

rest 0.13 0.08

grain b 8.7

sum 100.0 100.0 100.0 167

Page 46: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

biotite K-feldspar muscovite

plagioclase quartz unidentified

phase boundaries

Page 47: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

phase vs. grain boundary maps

all boundaries phase boundaries only

grain boundaries sensu strictu

Page 48: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

neighbourhood operations

(NOP)

Page 49: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

i-1 / j-1 i / j-1 i+1 / j-1

i-1 / j i / j i+1 / j

i-1 / j+1 i / j+1 i+1 / j+1

3 x 3 neighborhood

Page 50: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

introductory example: moving average166 89 72 89 79 82 139 84 22 44 99 131 156 183 193 168

102 49 39 51 62 70 72 31 22 56 124 161 180 205 212 190

70 34 31 62 65 107 114 70 56 72 114 143 180 205 207 171

44 29 24 44 124 92 67 70 56 46 60 151 226 188 141 99

31 29 7 14 84 39 14 27 24 44 114 126 236 219 107 67

24 39 22 9 12 27 19 29 19 54 109 89 183 255 193 97

24 27 24 17 17 39 75 102 82 94 126 141 168 231 231 178

22 22 27 36 19 29 114 121 121 141 168 168 193 207 200 166

19 22 36 41 17 22 60 75 116 107 87 161 193 188 156 129

17 24 56 54 17 14 94 158 97 79 82 89 126 134 119 111

14 27 27 9 12 19 84 156 77 75 102 60 79 104 97 84

12 17 9 2 19 29 54 114 87 89 109 79 79 67 72 94

14 17 14 41 77 99 131 178 151 153 168 139 121 75 65 82

27 36 72 129 156 158 163 200 180 175 195 180 136 49 17 17

29 54 134 180 188 180 158 168 195 190 183 146 107 22 0 2

24 36 97 148 163 175 171 161 168 173 143 99 67 12 7 7

101 86 64 65 72 84 79 61 43 61 102 141 169 188 191 190

85 72 57 61 74 87 85 67 50 67 104 143 171 191 192 190

54 46 40 55 75 85 77 62 53 67 103 148 182 193 179 170

39 33 30 50 70 78 66 55 51 65 96 150 186 189 156 132

32 27 24 37 49 53 42 36 41 58 88 143 185 194 151 117

29 25 20 22 28 36 41 43 52 74 99 143 183 202 175 145

26 25 24 20 22 39 61 75 84 101 121 149 181 206 195 177

22 24 28 26 26 43 70 96 106 115 132 156 183 196 187 176

21 27 35 33 27 42 76 106 112 110 120 140 162 168 156 146

20 26 32 29 22 37 75 101 104 91 93 108 126 132 124 116

18 22 25 22 19 38 80 102 103 88 84 89 90 97 98 96

16 16 18 23 34 58 96 114 120 112 108 104 89 84 82 82

20 24 37 57 78 98 125 139 147 145 143 134 102 75 59 57

29 44 75 110 134 145 159 169 176 176 169 152 108 65 36 30

34 56 98 140 164 168 170 173 178 178 164 139 90 46 14 8

35 62 108 151 172 172 168 170 175 175 155 124 75 35 8 4

Page 51: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

30 25 23

25 10 15

13 1 5

10 15

1/9 1/9 1/9

1/9 1/9 1/9

1/9 1/9 1/9

= 1/9· [30 + 25 + ... 5] = 15

1 1 1

1 1 1

1 1 1

·1/9· =

30 25 23

25 10 15

13 1 5

example: moving average

neighborhood operations

Page 52: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

averaging filters

Page 53: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

3 by 3 moving average

1 1 11 1 11 1 1

≠ median

Page 54: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

moving average

0 1 0

1 1 1

0 1 0

1 0 1

0 1 0

1 0 1

influence of shape

1 1 1 1 1 1 1

1 1 1 1 1 1 11 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

influence of size

Page 55: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Gaussian

1 1 2 1 1

1 2 4 2 1

2 4 8 4 2

1 2 4 2 1

1 1 2 1 1

2 2 3 4 5 5 6 6 6 5 5 4 3 2 2

2 3 4 5 7 7 8 8 8 7 7 5 4 3 2

3 4 6 7 9 10 10 11 10 10 9 7 6 4 3

4 5 7 9 10 12 13 13 13 12 10 9 7 5 4

5 7 9 11 13 14 15 16 15 14 13 11 9 7 5

5 7 10 12 14 16 17 18 17 16 14 12 10 7 5

6 8 10 13 15 17 19 19 19 17 15 13 10 8 6

6 8 11 13 16 18 19 20 19 18 16 13 11 8 6

6 8 10 13 15 17 19 19 19 17 15 13 10 8 6

5 7 10 12 14 16 17 18 17 16 14 12 10 7 5

5 7 9 11 13 14 15 16 15 14 13 11 9 7 5

4 5 7 9 10 12 13 13 13 12 10 9 7 5 4

3 4 6 7 9 10 10 11 10 10 9 7 6 4 3

2 3 4 5 7 7 8 8 8 7 7 5 4 3 2

2 2 3 4 5 5 6 6 6 5 5 4 3 2 2

(5x5)

(15x15)

Page 56: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

linear filters

5.2 Linear Filters 107

L

L

M

N

KK

H

I

u

v

no coverage

full coverage

Figure 5.7 Border geometry. The filter can be applied only at locations (u, v) where thefilter matrix H of size (2K+1) × (2L+1) is fully contained in the image (inner rectangle).

0

0

0

1

0

1

1

0

1

1

0

0

0

0

0 0 0 0

0 1 1 1 0

0 1

0

1

0

3

1

9

5

2

5

3

1

2

1

0

1 2 1 0

1 3 5 3 1

2 5

0

0

0

-1

0

16

-2

-1

-2

-1

0

-1

0

0

0 -1 0 0

0 -1 -2 -1 0

-1 -2

(a) (b) (c)

Figure 5.8 Typical examples of linear filters, illustrated as 3D plots (top), profiles (center),and approximations by discrete filter matrices (bottom). The “box” filter (a) and the Gaussfilter (b) are both smoothing filters with all-positive coefficients. The “Laplace” or “Mexicanhat” filter (c) is a difference filter. It computes the weighted difference between the centerpixel and the surrounding pixels and thus reacts most strongly to local intensity peaks.

Page 57: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

gradient filters

Page 58: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

gradient filters

0 -.5 0

0 0 0

0 .5 0

0 0 0

-0.5 0 0.5

0 0 0

0 0 0

0.5 0 -0.5

0 0 0

0 .5 0

0 0 0

0 -.5 0

maxim

um o

f 4

(average of 4)

Page 59: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

0 0 00 1 -10 0 0

0 0 01 0 -10 0 0

influence of separation

E-W difference

Page 60: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

-1 0 1-1 0 1-1 0 1

-1 -1 -10 0 01 1 1

influence of direction

Shadows

Page 61: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

0 0 -10 1 00 0 0

0 -1 00 0 10 0 0

Robert's cross 2 x 2 (gradient / 1st derivative)

Page 62: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

- maximum of 4 gradient images- thresholding

Robert's cross 2 x 2 (gradient / 1st derivative)

Page 63: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

maximum of 8 directions

Sobel operator

1 2 10 0 0-1 -2 -1

1 0 -12 0 -21 0 -1

-1 -2 -10 0 01 2 1

-1 0 1-2 0 2-1 0 1

-2 -1 0-1 0 10 1 2

0 1 2-1 0 1-2 -1 0

2 1 01 0 -10 -1 -2

0 -1 -21 0 -12 1 0

(1st derivative)

Page 64: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Sobel 3x3

hand-made Sobel

Find edges 5x5

Roberts Cross

Page 65: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

0 1 0

1 -4 1

0 1 0

1 1 1

1 -8 1

1 1 1

Laplace operator (2nd derivative)

1 1 1 1 11 1 1 1 1

1 1 -24 1 11 1 1 1 1

1 1 1 1 1

Page 66: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

-1 -1 -1 -1 -1-1 -1 -1 -1 -1-1 -1 40 -1 -1-1 -1 -1 -1 -1-1 -1 -1 -1 -1

Laplace 5· 5

-1 -1 -1

-1 12 -1

-1 -1 -1

Laplace 3· 3

Laplace for sharpening

Page 67: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

1 1 2 1 11 2 4 2 12 4 8 4 21 2 4 2 11 1 2 1 1

-1 -1 -2 -1 -1-1 -2 -4 -2 -1-2 -4 44 -4 -2-1 -2 -4 -2 -1-1 -1 -2 -1 -1

Gauss 5x5

Laplace 5x5

-1 -1 -2 -1 -1-1 -2 -4 -2 -1-2 -4 88 -4 -2-1 -2 -4 -2 -1-1 -1 -2 -1 -1

-1 -1 -1 -1 -1-1 -1 -1 -1 -1-1 -1 24 -1 -1-1 -1 -1 -1 -1-1 -1 -1 -1 -1

-1 -1 -1 -1 -1-1 -1 -1 -1 -1-1 -1 48 -1 -1-1 -1 -1 -1 -1-1 -1 -1 -1 -1

Laplace for sharpening

Page 68: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Laplace for edge detection

-1 -1 -1-1 8 -1-1 -1 -1

-1 -1 -1-1 8 -1-1 -1 -1Laplace 3· 3

Laplace 3· 3

Page 69: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Difference: Gaussian - Original

original

Gauss 15 x 15

difference, equalized

Page 70: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

original

Gauss 15X15

difference

image horizontal traverse

Difference: Gaussian - Original

Page 71: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exerciseConvolve...

Page 72: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exercise

1. open Parrot_P_64.tif and parrot_test.tif2. enlarge window to 200%3. convolve with filter kernels4. watch little test figure5. watch histogram

Page 73: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Lazy grainboundaries

Page 74: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Lazy grain boundaries input

RGB colour image

Page 75: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Lazy grain boundariesearth.unibas.ch/micro

Uses different versions of same image.Originally written to analyze a • stack of misorientation images or• differently polarized imagesbut can also be used for any• multichannel image e.g. RGB stack

Page 76: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Image SXM and Fiji / imageJ

Page 77: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

'orientation' images (5 types)

crosspol crosspolcirpol

azi / inc misoredge

Lazy grain boundaries: input images

Page 78: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

use stack

set of misorientation images

Lazy grain boundaries

Page 79: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

cuo

Lazy grain boundaries

Page 80: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

cuog-z-m

Lazy grain boundaries

Page 81: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

cuog-z-m-ji-tji-tji

Lazy grain boundaries

Page 82: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

cuog-z-m-ji-tji-tji-t5y

Lazy grain boundaries

Page 83: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

typical artefactsof segmentation:

• corner of 4• oversegmentation• 45° diagonals

→ 2000_RH_Lazygbd_JSG.pdf

Lazy grain boundaries

Page 84: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exerciseLazy

grainboundaries

Page 85: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exercise

1. open RubyGap image2. try Lazy grainboundaries

3. open stack of misorientation images (2w920misor)4. try Lazy grainboundaries

Page 86: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Image SXMAnalyze

Page 87: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Analyze

define measurements

Page 88: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Area- no. of pixels- scaled area

Image SXM Analyze

Page 89: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

X-Y centercenter of gravity

Image SXM Analyze

Page 90: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Perimeter/Lengthlength of perimeter

Image SXM Analyze

Page 91: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Ellipse Major AxisEllipse Minor Axis

Image SXM Analyze

Page 92: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

AngleAngle of Major Axisw/r to horizontal

Image SXM Analyze

Page 93: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

A

A! ! = Arequ! (equivalent radius)! = √ (A / π)dequ! (equivalent diameter)! = 2· √ (A / π)Pequ! (equivalent perimeter)! = 2· √ (π· A)

A

requ

dequ

Pequ derived measures

Page 94: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

a (major diameter)

b (minor diameter)

P (perimeter length)

A (area)

"Len"

"Minr"

"Majr"

"Area"

φ (orientation of a)

positive x = 0°CCLW = positive

"Angle"

φ

best fit ellipse

Page 95: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

requ, a, b,! size (linear)

b / a ≤ 1! axial ratio, flattening, ..

a / b ≥ 1! aspect ratio, elongation, ...

P / Pequ ≥ 1! circularity, sphericity, ...! lobateness, angularity, convexity, ...! ("fractal dimension")

shape descriptors - shape factors

Page 96: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Image SXMAnalyze

Page 97: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Analyze

define measurements

Page 98: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

ImageJ Analyze

Page 99: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Fiji - Set Measurements

Page 100: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Area, Gray value distributionArea:Area of selection in square pixels or in calibrated units.

Mean (= Mean Gray Value):Average gray value within the selection (0-255) or calibrated units.

StdDev (= Standard Deviation):Standard deviation of the gray values used to generate the mean gray value.

Mode (= Modal Gray Value):Most frequently occurring gray value within the selection (highest peak in the histogram).

Min, Max (= Minium and Maximum Gray Level):Minimum and maximum gray values within the selection.

1 32

Page 101: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Shape & x-y coordinates of segmentsX, Y (= Centroid):Average of the x and y coordinates of all of the pixels in the image or selection.

XM, YM (= Center of Mass):Brightness-weighted average of the x and y coordinates all pixels in the image or selection.

Perim. (= Perimeter):The length of the outside boundary of the selection.

BY, BM, Width, Height (= Bounding Rectangle):The smallest rectangle enclosing the selection: BX and BY are the coordinates of the upper left corner of the rectangle.

1 32

Page 102: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

1 32

Best fit ellipseMajor, Minor, Angle (= Best Fit Ellipse):

Major is long diameter (2a)Minor is short diameter (2b)

Angle (0° - 180°) is the angle between the major axis and the x-axis (0°) counting counterclockwise.

The coordinates of the center of the ellipse are X and Y (= Centroid)

2

Edit>Selection>Fit Ellipse:

Page 103: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

1 32

Shape descriptorsCirc. (= Circularity): area / area of perimeter-equivalent circle.

AR (= Aspect ratio): major_axis / minor_axis.

Round (= Roundness): 4*area / (π*major_axis^2) = the inverse of the aspect ratio.

Solidity: area / convex area.

1

Edit>Selection>Convex Hull:

Page 104: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

1 32

Caliper diametersFeret (= Feret's Diameter) (= maximum caliper):The longest distance between any two points along the selection boundary.

FeretAngle (0°-180°):The angle between the Feret's diameter and the x-axis.

FeretX, FeretY:The starting coordinates of the Feret's diameter.

MinFeret (= minimum caliper):The minimum caliper diameter

Page 105: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Density measuresIntDen, RawIntDen (= Integrated Density):"IntDen" = the product of Area and Mean Gray Value"RawIntDen" = the sum of the values of the pixels in the image or selection

Median:The median value of the pixels in the image or selection.

Skewness, KurtosisThe third order moment about the mean.The fourth order moment about the mean.

Area FractionThe percentage of pixels in the image or selection that have been highlighted in red using Image>Adjust>Threshold. For non-thresholded images, the percentage of non-zero pixels.

Page 106: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Kaleidagraph plotting results

Page 107: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

deriving shape descriptors

Page 108: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

1:1

shape descriptors: axial ratio b/a

Page 109: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

mean of b/a: 0.62565

c8=c7/c6

slope of b vs. a: 0.63447

shape descriptors: axial ratio b/a

Page 110: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

c2=sqrt(c1/pi)

shape descriptor: b/a as f(requ)

Page 111: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

1.0

1.5

2.0

2.5

3.0

3.5

4.0

0 45 90 135 180

TruzzoHighMagNoSc100

a/b

Angle

Rf - φ diagram

shape descriptor

Page 112: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

fractal dimension: 1.2156

shape descriptor: P / Pequ

Page 113: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

b/a

comparison: quartz - plagioclase

Page 114: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

b/a(requ)

comparison: quartz - plagioclase

Page 115: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

Rf-φ

comparison: quartz - plagioclase

Page 116: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

P/Pequ

comparison: quartz - plagioclase

Page 117: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exerciseimage analysis

Page 118: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

exercise

1. open Meluzina M32. perform image analysis type 2 and 33. plot results

4. open TOSsedi EPI and TRANS5. make bitmap of TRANS6. perform image analysis type 2 and 3 using re-direct

Page 119: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

TOS sediMOTIVATION:

Use two scans of same sand:! transmission mode - for bitmap! incident light - color, grey values

Use Re-direct sampling to analyze all aspects of shape and surface texture (color)

1.! Open images!! RGB opens as stack and Index image

2.! Check scale!scale if necessary

3.! Extract Green Channel!! Stacks > Stack to Windows! keep 002 (G = green channel)! discard Index image! discard 001 (R) and 003 (B)

4.! Analyze > Options!check all ...!

5.! Analyze > Analyze Particles...

6.! Analyze > Show Results! File > Save As...

TOS_2_bit TOS_2_epiG (green channel of RGB)

Page 120: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

TOS sedi7.! Kaleidagraph! if applicable, delete last particle ( = scale bar)

7.1! Functions > Bin Data...!! make histogram of "Majr" (=long axis of best fit ellipse)

7.2! calculate Pequ ! Data > Insert Column after "Len" (=measured perimeter)! !! ⌘F = Formula Entry

7.3! plot Pequ against Len!! Gallery > Scatter Plot

7.4! make line fit! Curve Fit > Linear Plot! !7.5! force through zero! Curve Fit > Curve Fit Options...

Plot

Page 121: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

TOS sedi8.! Map Properties!! Macros > Load Macros: Lazy Grain Mapping!! if applicable, turn OFF Re-direct Sampling!! in Analyze > Options...!! Select area (ROI) without scale!! ⌘D Duplicate! File > Save As... TOS_2_bit_crop.tif

8.1! [B] Size Map! Max radius = 1.19 mm

8.2! [F] Shape factor Map! Max shape factor = 1.55

(Detail of TOS_2_bit_cropB)

(Detail of TOS_2_bit_cropF)

Page 122: day 2 - unibas.ch · plan DAY 1 - 'look at the data' • scale, calibrate, re-size, visualize • histograms, profiles, LUTs • morphological operations • from element maps to

TOS sedi8.3! Threshold maps! [B] Size Map at requ > 0.5mm (dequ > 1mm)! [F] Shape factor Map at SF1 > 1.25

8.4! Interesect! TOS_2_bit cropF>1.25.tif! TOS_2_bit crop B>05.tif

! =>! r > 0.5 mm AND P/Pequ > 1.25

SF1 > 1.25 requ > 0.5 mm