Title: Digital Image Processing With MATLAB
1Digital Image ProcessingWith MATLAB
Earl Guenthner Glenn Jackson Brad Hartwig
2Pixels?
- Picture Element (pix-el)
- Pointillism
- The CRT monitor
3Pointillism
- Post-impressionism
- France, 1800s
- Few artists, most notably Seurat
- Use of Primaries
4Georges Pierre Seurat
5RGB, the good stuff
- Subpixels
- Arrays
- Matlab and numbers
6How it all looks in numbers
a double( imread(filename.jpg) )
a(,,)
Blue Layer values. a(,,3) 42 51 47 48 93
141 171 184 43 52 47 48 92 140 170 183 45 54 49
48 92 139 168 181 47 55 50 49 92 138 167 179 47
56 50 49 92 137 166 178 47 55 50 49 92 138 166
179 46 54 49 49 92 138 167 180 45 54 49 48 92 139
168 180 46 50 43 47 92 136 163 178 45 48 42 46 91
135 163 177 43 46 40 44 89 133 161 175 40 44 38
42 88 132 160 174
Green Layer values. a(,,2) 185 171 121 71
57 61 56 53 186 172 121 71 56 59 55 52 188 174
122 71 56 58 53 50 190 175 123 72 56 57 52 48 190
176 123 72 56 56 51 47 190 175 123 72 56 57 50
48 188 173 122 71 55 57 51 48 187 173 122 70 55
57 51 48 187 168 115 68 55 54 46 45 186 166 114
67 54 53 46 44 183 164 112 65 52 51 44 42 180 162
110 63 50 50 43 41
Red Layer values. a(,,1) 59 53 19 0 0 8 13
13 60 54 19 0 0 8 12 12 62 56 22 0 0 7 10 11 64
57 23 0 0 6 9 9 64 58 23 0 0 5 8 8 64 57
23 0 0 6 9 9 65 58 24 0 0 6 10 11 64 58 24 0 0
9 12 11 66 55 19 0 0 6 7 11 65 53 18 0 0 6 7
10 65 53 16 0 0 4 5 8 62 51 14 0 0 3 6 7
7Things to do with Arrays
- Invert (if square)?
- Determinant (if square)?
- Linear function operations
- Reduced row echelon form (RREF)
RREF
8One thing weve done Any Screen
- Imread image into MATLAB
- Draw silhouette mask.
- Cut image out of old background with mask.
- Put image onto new background.
- Output results.
9Drawing a silhouette
function Btrace(a)? Getting Size of a and
create new blank image SA size(a) B
zeros(SA(1),SA(2),3) Setting contrast
marker v 25 Cycling through image for
row21SA(1)-1 for col21SA(2)-1
Searching 3x3 box for i-111 for
j-111 Testing current pixel with
those around it against
contrast marker
if a(row,col,1)-a(row-i,col-j,1)gtv
a(row,col,2)- a(row-i,col-j,2)gtv
a(row,col,3)-a(row-i,col-j,3)gtv
B(row,col,) 255 end
end end end end
10Drawing a silhouette
Making a mask
- Take your trace image and fill it in.
function afiller2(a)? SAsize(a) for
x11SA(1)? start findwhite( a(x,,) )
finish SA(2) - findwhite( fliplr( a(x,,1) )
)-1 if start0 finish0 for
colstart1finish a(x, col, ) 255
end end end
11Putting it together
- Use the filled image as a template for cutting
the desired image out of its old background and
inserting it on the new background.
12(No Transcript)
13(No Transcript)
14(No Transcript)
15(No Transcript)
16(No Transcript)
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21(No Transcript)
22(No Transcript)
23(No Transcript)
24(No Transcript)
25Using non-convex figures
- Using non-convex figures presents a shortcoming
in our approach where it captures everything in
the outline of the figure.
26(No Transcript)
27Other parameters
28(No Transcript)
29(No Transcript)
30(No Transcript)
31(No Transcript)
32(No Transcript)
33(No Transcript)
34(No Transcript)
35(No Transcript)
36Future possibilities
- Decrease program run times to edit streaming
video - Image recognition
- Masking non-convex functions
- Plotting figure in background
37Questions?
Thank you.
38- More work
- Basics
- Adjust brightness
- Invert colors
- Convert to black and white
39(No Transcript)
40(No Transcript)
41(No Transcript)
42(No Transcript)
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47(No Transcript)
48(No Transcript)