visualization (human) - tauturkel/notes/introduction1.pdf · visualization (human) enhancement,...
TRANSCRIPT
2
3
Dr. Yoram Tal
� � � � � � � � � � � � � � �� ! " # $ $ % & '
Visualization (human)Enhancement, Restoration
Analysis (computer)Documents, Textures, Biometrics,Object recognition
There are fundamental differences between them
4
Dr. Yoram Tal
( ) * * +
3
5
Dr. Yoram Tal , - . . /
6
Dr. Yoram Tal , - . . / 0 1 1 2
Lena Soderberg (ne Sjooblom) was last reported living in her native Sweden, happily married with three kids and a job with the state liquor monopoly. In 1988, she was interviewed by some Swedish computer related publication, and she was pleasantly amused by what had happened to her picture. That was the first she knew of the use of that picture in the computer business.
4
7
Dr. Yoram Tal 3 4 5 5 6 7 8 4 9 : 6 5 ;Thomas Colthurst
O dear Lena, your beauty is so vastIt is hard sometimes to describe it fast.I thought the entire world I would impressIf only your portrait I could compress.Alas! First when I tried to use VQI found that your cheeks belong to only you.Your silky hair contains a thousand linesHard to match with sums of discrete cosines.And your lips, sensual and tactualThirteen Crays found not the proper fractal.And while these setbacks are all quite severeI might have fixed them with hacks here or thereBut when filters took sparkle from your eyesI said, Damn all this, I l l just digitize.
8
Dr. Yoram Tal
< = > ? @ A > B C D B
5
9
Dr. Yoram Tal E F G H I J K L F G M N K O
External IrradiationElectromagneticAcoustic
X-Rays
Reflected
Emitted
Transmitted
Sensor ArrayA/D
File
Focus Object
VisibleIRUVMW
Degradation
10
Dr. Yoram Tal
P Q R Q S T U V W T R X Y
A digital image is an ordered set of pixels (picture elements, also called pels).A pixel is actually a point that has two components: position and color. Further, pixel position has two components (X,Y) while color is represented by three components, which makes a total of five independent components.The screen representation of an image pixel may contain more (sometimes less) than a single screen point (or screen pixel) per image pixel
Stretch your brain « I have my own little world. But that’s OK, they know me here!
file:///D|/Courses/Image/Introductions/illusions/illusions.html[11/3/2011 8:52:46 AM]
« Forrest Gump goesto Heaven
Kids on the Subject of Love»
I have my own little world. But that’sOK, they know me here!
Plus, my mail is delieved here!
Stretch your brainThis is not a test - just a phenomenon. All readings are explained. Readout loud the text inside the triangle below.
More than likely you said, “A bird in the bush,” and if this is what yousaid, then you failed to see that the word THE is repeated twice! Sorry,look again.
Next, let’s play with some words. What do you see?
Stretch your brain « I have my own little world. But that’s OK, they know me here!
file:///D|/Courses/Image/Introductions/illusions/illusions.html[11/3/2011 8:52:46 AM]
In black you can read the word GOOD, in white the word EVIL (insideeach black letter is a white letter). It’s all very physiological too, becauseit visualizes the concept that good can’t exist without evil (or the absenceof good is evil). Now, what do you see?
You may not see it at first, but the white spaces read the word optical,the blue landscape reads the word illusion. Look again! Can you see whythis painting is called an optical illusion?
What do you see here?
This one is quite tricky! The word TEACH reflects as LEARN.
Last one. What do you see?
Stretch your brain « I have my own little world. But that’s OK, they know me here!
file:///D|/Courses/Image/Introductions/illusions/illusions.html[11/3/2011 8:52:46 AM]
You probably read the word ME in brown, but when you look through MEyou will see YOU! Do you need to look again?
Test your brain. This is really cool. The second one is amazing so pleaseread all the way though.
ALZHEIMERS’ EYE TEST
Count every “F” in the following text:
FINISHED FILES ARE THE RESULT OF YEARS OF SCIENTIFIC STUDYCOMBINED WITH THE EXPERIENCE OF YEARS… (SEE BELOW)
How many? Wrong! There are 6 - no joke! Read it again! Really, go Backand Try to find the 6 F’s before you scroll down.
The reasoning behind is further down. The brain cannot process “OF”.Incredible or what? Go back and look again! Anyone who counts all 6“F’s” on the first go is a genius. Three is normal, four is quite rare.
More Brain Stuff From Cambridge University
Olny srmat poelpe can raed tihs.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. Thephaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch atCmabrigde Uinervtisy, it deosn’t mttaer in waht oredr the ltteers in awrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in thergh it pclae. The rset can be a taotl mses and you can sitll raed it wouthita porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter byistlef, but the wrod as a wlohe. Amzanig huh? Yaeh and I awlyas tghuhotslpeling was ipmorantt!
Possibly related posts: (automatically generated)
» So you think you know everything?
» Mind Boggles
» Your Eye Is Slower Than Your Brain
» O lny Srmat Poelpe Can Raed Tihs.
Stretch your brain « I have my own little world. But that’s OK, they know me here!
file:///D|/Courses/Image/Introductions/illusions/illusions.html[11/3/2011 8:52:46 AM]
Tags: brain, illusions, test
This entry was posted on October 15, 2007 at 11:32 pm and is filed under Random. Youcan follow any responses to this entry through the RSS 2.0 feed. You can leave aresponse, or trackback from your own site.
2 Responses to “Stretch your brain”
kaidee33 Says: October 16, 2007 at 6:17 pm
I like the f one. I counted it a zillion times, before realising about of. lol
godslilrocker7 Says: October 16, 2007 at 6:28 pm
Haha, me too! Actually I couldn’t figure it out so I started to read down and readabout “of”.
Leave a Reply
You must be logged in to post a comment.
Blog at WordPress.com . Entries (RSS) and Comments (RSS).
10
19
Dr. Yoram Tal B C D E F G H I J
Dr. Yoram Tal B C D K F G H I J
Three intensity matrices: R, G, and B
11
21
Dr. Yoram Tal
L M N O P Q R S T U N Vimage - Create and display image object.
imagesc - Scale data and display as image.
imshow - Display image.
colorbar - Display colorbar .
getimage - Get image data from axes.
truesize - Adjust display size of image.
warp - Display image as texture - mapped surface.
zoom - Zoom in and out of image or 2 - D plot.
22
Dr. Yoram Tal
L M N O P W X Yimread - Read image type files.
imwrite - Write image type files.
imshow - Load and display an image.Z [ [ \ ] ^ _ `Z [ [ \ ] ^ _ `- Interactive loading of different files
(MATLAB 6).a b a c da b a c d e e- image file info (IP toolbox 3)
12
23
Dr. Yoram Talf g h i j k l m n o p q r s t q s r n.tif .bmp .jpg .png .pcx .gif
Header
Image Data
raster fieldsblocksu
Magic number v Heightwidth
colormap
comments
Compression info
Formats: .tif .bmp .jpg .png .pcx .gif
Bits per pixel
24
Dr. Yoram Tal wx y z { | } ~ � { � � � } ~
gray2ind - intensity image to indexed image.
im2bw - image to binary image by thresholding .
Im2double - image to double precision.
im2uint8 - image to 8- bit unsigned integers.
Im2uint16 - image to 16- bit unsigned integers.
ind2gray - indexed image to intensity image.
ind2rgb - indexed image to RGB image.
mat2gray - matrix to intensity image.
rgb2gray - RGB image or colormap to grayscale .
rgb2ind - RGB image to indexed image.
15
29
Dr. Yoram Tal
� � � � � � � � � � � � � � � �
30
Dr. Yoram Tal� � � � � � � � � ! " � # $ � %
Core
Interpreter& ' ( ) & '* + , - . / 0
User
1 2 3 4 2 56 7 7 8 9 : ; <
= > ? @ A BC D E F G H H I J
16
31
Dr. Yoram Tal
K L M N O P Q R P S N R T U M P V
SelectionVectorizationSparse Matrices
32
Dr. Yoram Tal W X Y X Z [ \ ] ^ _ ` ab c d e f g h i c e h i d j e h k g j l m n o p f i h qr s t u s v r w x u x y z { z u | } ~ � u t � y
� � �� ��� � �� � � � � � � � �
� � � � � � �
� � � � � � �
17
33
Dr. Yoram Tal � � � ¡ ¢ £ ¤ ¥ ¦ § ¨© ª ª© ª ª « « ¬ ¬ ® ® ¯ ° ± ² ³ ¯ ° ± ² ³ « « ª ª ª ª ³ ³ ´ ´ ³ ª³ ª ³ ³ ² µ ³² µ ³
¶ · ¸ ¹ º » ¼ ½¾ ¿ À Á Â Ã Ä ÅÆ Ç È É Ê ÈË Ì Í Î Ï Ð Ñ Ò Ó Î Í Î Ô ÕË Ì Ï Î Ö Ð Ñ Í×Ø
Ù Ú Û Ü Ý Þ ß Û à áâ ã ä å æ ç èæ ç è å â ã ä
é ê ë ì í î ï ï ð ï ð ñ ð ò ó ô õ ö ÷ø ù ú û ü ý þ ÿ ù � � û � ü �
[ ]
� � �� � � � �
34
Dr. Yoram Tal � � � � � � � � � � � �� � �� � � � � � �� � � � � � ! " # $! " # $ � � � � � � $ $ % % $ �$ � $ $ # & $# & $
' ( )* + ,- . /0 1
2 3 4 ( / 5 6 * 7 8 ),2 3 4 ( / 5 6 4 / * 5 7 8 ( )+ ,
2 3 ( 9 / 9 , 7 8 4 ' 6 - 6 + 6 ) 52 3 4 ( / 5 6 4 * * * 5 7 8 ) ) ), , ,[ [] ]
[ ]
18
Dr. Yoram Tal : ; < ; = > ? @ A B C D
E F GH I JK L MN O PQ QRS TU VW X YZ YWW
[ \ ] ^ _ ` a b c d e f g
a h i j k l m l i n o j p q r i l o l s j h p t u v w x y z { x x | } ~ � z � � � {
� � �� � � � �� � � � �� �
Dr. Yoram Tal � � � � � � � � � � � � � � � �� � � � � � � � ¡ ¢ £ � ¤
. . . .
.
.
.
.
.
.
.
.
.
x y
1. 0.0804 0.7751
2. 0.0986 0.8062
3. 0.1626 0.8206
4. 0.2311 0.8206
5. 0.3361 0.8182
6. 0.3498 0.9211
7. 0.3817 0.8206
8. 0.4114 0.7632
9. 0.4091 0.7081 ( )∑=
++ −=n
iiiii yxyxS
1112 ¥ ¦ § ¨ © ª « § ¬ ® ¯ ° ± ² ³ ® ± ²´ µ ¶ · ¸ ¹ º ´ µ ¸ ¹
19
37
Dr. Yoram Tal » ¼ ½ ¾ ¿ À Á Â Ã ¾ Á ¿ Ä Å Æ ÇÈ É Ê Ë È Ì Í Î Ï Ð È È É
Ñ Ò Ó Ô Õ Ö × Ô Ó Ø Ù Ô Ú Û Ü Ý Ú Ô Þ Ò Ó Ô Õ Ö ß à Ó á Ö à ß Ø âã ä å æ ç è é ê ë ì í é ê îï í ð ñ ò è é ê ë ï í é ê îó ë ô îõ ö ÷ ÷ øù ÷ ú û ë é ü ñ ýþ ÿ þ � � � � � � � � � � � � � � � � � � � � � � � � �� � � � �
38
Dr. Yoram Tal � � � � � � � � � � � � � � � �� � ! � " # $ % & ' & ( & " ) * & ' & ( & " � + � , - .
/ 0 1 2 3 4 5 4 6 7 8 9 : ; < = > ? @ A B C D E F G E H I F J K L M E F G N O P Q R S T U V W W XY Z Y [ \ ]
^ _` ab `
` ab `
b c d ^ b _ ` e ^ f _ b e ^ g _ f h ^ ` _ b h ^ b _ f h ^ f _ g
20
39
Dr. Yoram Tal i j k l m n o p q l o m r s t uv w x y v z { | } y z z ~ � w � v � � � x
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� � � � � �� �� �� � �
�
�
�
40
Dr. Yoram Tal
� � � � � �
21
41
Dr. Yoram Tal � � ¡ ¢ £ ¤ ¥ ¡ ¦ § £ ¢
42
Dr. Yoram Tal � � ¡ ¢ £ ¤ ¥ ¡ ¦ § £ ¢¨ ¨ © © ª ª « « ¬ ¬ ® ¯® ¯ ° ± ² ² ³ ´ ±° ± ² ² ³ ´ ± µ µ ¶ ¶
- - . .-
- .
- .
- .
- .
.
.
.
.
- - . .-
- .
- .
- .
- .
.
.
.
.
( Buck mi nst er Ful l er - ar chit ect , mat hemat ic i an, in vento r , .. .)
[B v] = bucky ;gplot (B,v);
h a l f bucky
22
43
Dr. Yoram Tal · ¸ ¹ º » ¼ ½ » ¾ ¿ º À Á Â » ¼ Ã
nz =
B is the adjacency (connect i vity) matrix of the Bucky - ball.
1 i f i a nd j ar e connect ed
0 oth er wis e
B(i,j)=
spy(B)
Sparsity = 5%
44
Dr. Yoram Tal Ä Å Æ Ç È É Ê Æ Ë Ç Ì Í É È ÎÏ Ð Ñ Ò Ð Ó Ð Ô Õ Ö Õ × Ø Ô Ù Ú Û Ô Õ Ö Ü
S = sparse(A) S = sparse(i,j,s,m,n) S = sparse(i,j,s)
0 2 1 0 0 0 0 0 0 0 0 0 5 0 0 0 2 0 0 30 0 0 7 0 0 1 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 8 0 0 0
i j s1 2 21 3 12 3 53 4 7
.2 10 3
Any elements of S that have duplicate values of i and jare added together .
Full Sparse Syntax
i.e., (i=2, j=5, s=10) and (i=2, j=5, s=11) yield S(2,5) = 21
23
45
Dr. Yoram TalÝ Þ ß à á â ã ß ä à å æ ç Þ Þ è å é ß ä å ê ë áì í î ï ð ñ ò ó ô õ ö ðThe value of each pixel in this image is an integer in the range [0, 255].Compute the number of pixels for each gray-level
S = sparse( im (:),1,1);
bar(S)
÷ ø÷ ø(image matrix)
46
Dr. Yoram Tal
ù ú û ü ý þ ÿ � � û
24
47
Dr. Yoram Tal � � � � � � � �Given an array of numbers: �� �� ��� ��������� �������� !� �""��# $#�"�����
A = { }Find the frequency of each number:
%&'()*+,-. /01223/202Number:
Count:
48
Dr. Yoram Tal4 5 6 7 8 9 : ; < = > 8 : < ; ? @x image matr ix (intensity)
imhist (x) display histogram[count, bin] = imhist (x) ;
Gray level
Count# pixels
25
49
Dr. Yoram Tal A B C D E F G H I C J K L M N O PThe histogram of an image contains valuable informationconcerning the distr ibution of gray levels
I t does not contain any spatial information
All the following images have exactly the same histograms!
50
Dr. Yoram Tal
Q R S T U V W X Y S X S Z U T R [ VA histogram is a result of voting it counts the number of supporters (i.,e., pixels) of each candidate (graylevel)
In the simple case of a binary image there are only two candidates: Mr zero and Ms one.
Voting has many useful applications in image processing (as well as in democracy).
26
51
Dr. Yoram Tal
\ ] ^ _ ` _ a b c ^ a d ` e b f ] ^ g h b i j k l m
Too dark
Too bright
52
Dr. Yoram Tal
n o p q r q s t u p s v r w t x o p y z t { | } ~ �
Low contrast
High contrast
27
53
Dr. Yoram Tal� � � � � � � � � � � � � � � � � � �I
I = imread('pout.tif');a = min(I(:));b = max(I(:));J = 255*(I-a)/(b-a);J = uint8(J);
a = 74 b = 224
Histogram of I
255minmax
min ⋅−
−=II
IIJ
54
Dr. Yoram Tal
� � � � � � � � � � � � � � � � � � � � � � � � � �J Histogram of J
Histogram of I
28
55
Dr. Yoram Tal� � � � � � � � � � � � � � � � � � � ¡¢ £ ¤ ¥ £ ¤ ¦ ¦ § ¨ § © ª« ¬ ® ¯ ° ± ² ³ ± °´ µ ¶ ® ¯ ±· ° ¸ ¬ ¹ ± ¬ º ¶ ° ® ¯
The minimum is 0 and the maximum is 255
56
Dr. Yoram Tal» ¼ ½ ¾ ¿ À Á Â Ã Â Ä Å Æ ½ ¾ Ã Ç È ¾
a = 74
Histogram of I
255 if I i >= b
255*(I-a)/(b-a) if a <= I i < b
0 if I i < a
b = 170
K =
K = imadjust(I,[0.3 0.67],[]);
This is a non-linearoperation
29
57
Dr. Yoram TalÉ Ê Ë Ì Í Î Ï Ð Ñ Ð Ò Ó Ô Ë Ì Ñ Õ Ö Ì × Ø Ù Ú Û Ü ÝI J K
58
Dr. Yoram TalÞ ß à á â ã ä å æ ç è é å ê ß ë å á ß â ìy = histeq(x,256);
30
59
Dr. Yoram Tal í î ï ð ñ ò ó î ô õ ð ö ÷ ø ù ðOriginal Histogram
Equalized Histogram
n = prod(size(x))tf = cumsum(255*h/n )
h
tf
60
Dr. Yoram Talú û û ü ý þ ÿ � � � � � ú ý ÿ �
X (in [0 255])
Linear approx. of tf
L(1:150) = 0;L(151:240) = linspace (0,255 , 90) ;L(241:255) = 255;
y = L(x+1);
y
tf
L
31
61
Dr. Yoram Tal � � � � � � � � � � � � � �� � � � � � � � � � � � � !
"minmax
min255
−
−⋅=II
IIIout
brighten darken
62
Dr. Yoram Tal# $ % & ' ( ) * + , - . * / $ 0 * & $ ' 1 2 3 4Adam
32
63
Dr. Yoram Tal5 6 7 8 9 : ; < = > ? @ < A 6 B < 8 6 9 C D E FPout
64
Dr. Yoram Tal
G H I J K L M N O P Q R N S H T N J H K U V W XY Z [ Z \ ] ^Y Z [ Z \ ] ^ _ _ ^ _ ` [ a Z ` \ b c d^ _ ` [ a Z ` \ b c d e e b f Z g \ Z e ^ d ^ h _ h ib f Z g \ Z e ^ d ^ h _ h i b b d e b _ _ Z \d e b _ _ Z \
paper Histogram of paper
33
65
Dr. Yoram Talj k l m n o p q r s t u q v k w s x y z { z | } ~
xeq
plot(sum(xeq))
66
Dr. Yoram Tal� � � � � � � � � � � � � � � � � � � � � � � � � � � � �Lenna 1) y = 1 + floor ( Lenna /64) ;
2) L = repmat (0:3,64,1);L = L( :);y = L( Lenna );
y
-
L
Reducing the number of bits/pixel - compression
34
67
Dr. Yoram Tal � � � � � � � � � � � � ¡ ¢ £ ¤ ¥ ¦ ¤ § ¨ © ¥ ª ¢ « « ¢ £ ¦
2D sine funct i on
68
Dr. Yoram Tal ¬ ® ¯ ° ± ² ® ° ± ³ ¯´ µ ¶ · ¸ ¹ º » µ ¼ º ½ ¾ ¾ ¿ · ¶ À ¹ º ¸ ¸ º Á Â
Sure, Add som e noise t hen quantize
35
69
Dr. Yoram TalÃ Ä Å Æ Ç È É È Ç Ê Ë Ì Í Ì Î Ï Ð Ñ Ò Ó Î Ð Ô Õ
References:
R. W. Floyd and L. Steinberg, "An Adaptive Algorithm for Spatial Gray Scale, International Symposium Digest of Technical Papers, Society for Information Displays, 36. 1975.
Spencer W. Thomas, "Efficient Inverse Color Map Computation", Graphics Gems II , (ed. James Arvo), Academic Press: Boston. 1991. (includes source code)
Optimal representation of graylevel (or color) images using a small number of graylevels (or colors)
70
Dr. Yoram Tal Ö × Ø Ù × Ú Û Ü Ý Þ ß à Ü á â
rgb2ind converts RGB images to indexed images using one of three different methods:uniform quantization, minimum variance quantization, and colormap mapping. For all ofthese methods, rgb2ind also dithers the image unless you specify 'nodither' fordither_option.
X = dither (RGB,map) creates an indexed image approximation of the RGB image in thearray RGB by dithering the colors in colormap map. map can not have more than 65,536colors.
BW = dither (I) converts the intensity image in the matrix I to the binary (black andwhite) image BW by dithering.
[Y,newmap] = imapprox(X,map,n) approximates the colors in the indexed image Xand associated colormap map by using minimum variance quantization. imapprox returnsindexed image Y with colormap newmap, which has at most n colors. (additional options)
36
71
Dr. Yoram Tal
ã ä å æ ç ä è é ê ë ì í
72
Dr. Yoram Tal ã ä å æ ç ä è é ê ë ì íî ï ð ñ ò ñ ó ï ô õ ö ï ÷ ó î ø ò ô ù õ ñ ÷ ú û ò ô ü ý þ
37
73
Dr. Yoram Tal ÿ � � � � � � � � � � � �
T = 90
T = 100T = 120T = 165
imagesc (t > T)t
74
Dr. Yoram Tal � � � � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � ! " # $ ! � % ! # & � � �
T = 70 T = 80 T = 90
T = 100
Letter
imagesc(Letter > T)
38
75
Dr. Yoram Tal' ( ) * + , - . / 0 1 2 3 ( , ( 4 5 - / 6 7 8Histogram of Letter3D map of Letter
Meshz(Letter)Colormap coppe r
Histogram equalization does notHelp here!
76
Dr. Yoram Tal9 : ; < = > ? @ A B : C C > ? D E F : G E ? Abg = blkproc(x,[10 10],'mean2(x)*ones(size(x))');
Block processingbg
Better approximations may be used (e.g., splines)
39
77
Dr. Yoram TalH I J K L M N O P Q R O S T M I J T U N P
Letter - bg Thresholding
78
Dr. Yoram TalH I J K L M N O P Q I V V M N W U X I T U N P Y Z [bg = blkproc(x,[20 20],'mean2(x)');
Surf( bg); axis ij
bg is smaller than Letter
bge = imresize(bg,size(Letter), bilinear );
40
79
Dr. Yoram Tal
\ ] ^ _ ` a b c d e f c g h a ] ^ h i b d j k lLetter - bge Thresholding
80
Dr. Yoram Talm b a n o b p b ` i ^ ] p q i p h r a i d `s t u v v w x y u z { | z z x ys t u v v w x y u z { | z z x y v v } ~ x � �} ~ x � �
(Top hut filter 7x7)
Filtered Letter Thresholding
41
81
Dr. Yoram Tal
� � � � � � � � � � � � � � �
- .
- .
.
.
.
82
Dr. Yoram Tal
� � � � � � � � � � � � � � � � �
Conv2 Perform 2-D convolution. (This is a MATLAB function)
convmtx2 Compute 2-D convolution matrix
convn Perform N-D convolution. (This is a MATLAB function)
filter2 Perform 2-D filtering. (This is a MATLAB function.)
fspecial Create predefined filters
imfilter Multidimensional image filtering
42
83
Dr. Yoram Tal �� � � � � � � �
Linear filtering is a transformation of a source(image) matrix into a target matrix such that each element of the target matrix is a linear combination of some elements of the source matrix.In MATLAB, linear filtering is realized through convolution:
84
Dr. Yoram Tal ¡ ¢ £ ¤ ¥ ¦ § ¢ ¨ © ¤ ¦ ¢ £ ª
« ¬ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ · ¹ º ¸ » ¹ ¼ ¸ » ¹ ½ ¸ » » ¸ · ¹ ¼ ¸ ¾ ¶ » ½
43
85
Dr. Yoram Tal ¿À Á Â À Ã Ä
Fil ter2 uses a correlation kernel (the kernel as is )Conv2 uses a convolution kernel (rotated 180 )
Kconvolution= rot90(Kcorrelation,2);
86
Dr. Yoram TalÅ Æ Ç È É Ê Ë Æ Ì Í È Ê Æ Ç Î Ï Ð Ñ Ò È Ó Æ É Ì
Ôgaussian' Gaussian lowpass filter
'sobel' Sobel horizontal edge - emphasizing filter Ôprewitt' Prewitt horizontal edge - emphasizing filter Ôlaplacian' 2D Laplacian operator filterÔlog' Laplacian of Gaussian filterÔaverage' Averaging filterÔunsharp' Unsharp contrast enhancement filter
h = fspecial ( Type,{siz e},{si gma})
44
87
Dr. Yoram Tal
Õ Ö × Ø Ù Ú Û Û Ü Ù Ý Þ Ú Ý ß à Ü á Ý
- .
- .
.
.
.
88
Dr. Yoram Tal Õ Ö × Ø Ù Ú Û Û Ü Ù Ý â Ü ã à × äh = fspecial ( gauss');freqz2 (h)
0.0113 0.0838 0.01130.0838 0.6193 0.08380.0113 0.0838 0.0113
h
Frequency response of h a lowpass fil ter
45
89
Dr. Yoram Tal
å æ ç è é ê æ ë ì í î æ ç è é ê ïy = filter2 (h , x, { s hape } )
Shape { f ul l , s ame , v ali d }ð ñ ò ó ô ñ õ ö ÷ ñ ø ù ú ô û ü ý þ ÿ ù ô û ó ö ó ù ô õSpeedup features:
Automatically identifies separabilityRealized via a mex (dll ) fi le
90
Dr. Yoram Tal
å æ ç è é ê æ ë ì í � � ë � ïy = conv2 (h,x , { s hape } )y = conv2 ( ver t , horz ,x, { s hape } )
vert is a vertical column-vector [e.,g., ones(21,1)]horz is a horizontal line-vector [e.,g., ones(1,21)]
shape is the same as in filter2. Zero padding is applied where necessary.
46
91
Dr. Yoram Tal
� � � � � � � � � � �When shape = { f ul l , s ame }
a border padding is required
Filter2 and conv2 use zero padding
Other choices are:Constant, non-zero valueReplications of the border pixelsMirror image of the near border pixelsCircular (periodic) padding
border
Intensity profile
zero
constant
replicate
mirror
92
Dr. Yoram Tal
� � � � � � � � � � � � �y = imfilter ( X, H, opt 1, opt 2, )
X and H are multidimensiomalThe class of y is the same as the class of x
Boundary options: zero, const. value, replicate , and symmetricOutput size: same and fullKernel: correlation or convolution
47
93
Dr. Yoram Tal
� � � � � � � � � � � � � � � ! " # " $ %
=
111
111
111
h Is separable into
=
1
1
1
1h
[ ]1112 =hFollowed by
tmp = filter2( ,x) 1h
y = filter2( , tmp)2h
Therefore : y = fi l ter2(h,x)
Is the same as:
94
Dr. Yoram Tal
& " # $ � " ' ( � � � � � � ! " # " $ % ) * + , - . /
The same is true for any function which can be written as a product:
h is separabl e if h(x,y) = h(x) * h(y)
For example, the Gaussian filter is separable since:
exp( - x^2 y ^ 2) =
exp( - x^2)*exp ( - y^2)
48
95
Dr. Yoram Tal
0 1 2 3 4 5 1 6 7 8 9 4 : ; 5 ; < 1 2 1 3 = > ? @ A B C D
Separabili ty saves time!
A separable 20x20 filter r equires 40operations (multipication-addition) per pixel
The same, non-separable fi lter requires 400operations per pixel 10 times as much
96
Dr. Yoram Tal
E F G H I G J K L M I N N O P I F GN I H Q J L I G R
49
97
Dr. Yoram Tal S T U V T W X Y Z [ \ ] ^ _ U \` a b c d e f g a h c i j b
uDj ∇⋅−=
( )jdivut −=∂
Fick s law: The concentration (or heat) gradient u∇causes a flux j which aims to compensate it.
Continuity equation: Diffusion does not create/destroys mass (heat)
||î
∇canisotropino
isotropicyesuj
98
Dr. Yoram Tal
k l m n o p p q r o s t m u q v w o s t
( )uDdivut ∇⋅=∂
Combining Fick s law with the continuity equation yields the Diffusion equation:
( ) ( )xfxu xx =0,
with the initial condition:
D is the diffusion tensor (a positive definite symmetric matrix)
50
99
Dr. Yoram Tal
y z { | | } z ~ � � ~ � � � { � } � ~
The solution of this equation (D = 1) is given by the Convolution Integral:
( ) ( ) ( )( )( ) ( )î
>=
=⊗ 0t
0 ,
2xfG
txftxu
t ���
( )
−⋅=
2
2
2 2exp
2
1
σπσσx
xG ��where
RR →2:f
100
Dr. Yoram Tal
� � �� � � � �� � � � � � � � � �� � � � � � � � � �� � � � � � � � � � � � � � � � � �� �
� � � � � � � � ¡ ¢ £ ¤ ¥ ¥ ¥ ¢ ¦ § ¡ ¨ ¦ © ª ¢ « ¬ ® ¨ « ¯ ° ± ² § ¡ ¨ ¦ © ª ¢ « ¬ ³ ¦ ± ª ´ µ ¡ ¶ · ¦ ° ¸¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Å Æ Ç È É É Ê Ë Ì Í Ë Î Ï Ð Ñ Ò Ó Ô Õ Ö Ñ Ò × Ø Ô Õ Ù Ð Ñ Ú Û