Clc ; Clear ; Close all ; Img 1 = imread ( ‘ rice . png ‘ ) ; A = 1 ; W = ones ( 2 * a + 1 ) ; W = w / sum (w ( : ) ) ; img 2 = imfilter ( img 1 , w ) ; figure ; subplot ( 1 , 2 , 1 ) ; imshow ( img 1 ) ; title ( ‘original Image ‘ ) ; subplot ( 1 , 2 , 2 ) ; imshow (img 2 ) ; title (‘ After Average Filter ‘ ) ;
Img 1 = imread (‘ rice . png ‘ ) ; A= 15 ; W= ones ( 2* a + 1 ) ; W=w / sum ( w ( : ) ) ; Img 2 = imfilter ( img , w , ‘ circular ‘ , ‘ full ‘ ) ; Figure ; Subplot ( 1 , 2 , 1) ; Imshow ( img 1 ) ; Title ( ‘Original Image ‘ ) ; Subplot ( 1 , 2 , 2 ) ; Imshow ( img 2 ) ; Title ( ‘ After Average Filter ‘ ) ;
fspecial average Clc ; Clear ; Close all ; Img 1 = imread ( ‘ rice . png ‘ ) ; W = fspecial ( ‘ average ‘ , [ 1 10 ] ) ; Img 2 = imfilter ( img 1 , w , ‘ circular ‘ ) ; Figure ; Subplot ( 1 , 2 , 1 ) ; Imshow ( img 1 ) ; Title ( ‘ Original Image ‘ ) ; Subplot ( 1 , 2 , 2 ) ; Imshow ( img 2 ) ; Title ( After Average Filter ‘ ) ;
>> w = fspecial ( ‘ disk ‘ , 50 ) ; >> max ( w ( : ) ) Ans = 1.2732 e – 04 >> 1 / max ( w ( : ) ) Ans = 7.8540 e + 03 >> w = w / max ( w ( : ) ) ; >> imshow ( w )
Clc ; Clear ; Close all ; Img 1 = imread ( ‘ rice . png ‘ ) ; R = 3 ; Wa = fspecial ( ‘ average ‘ , 2 * r + 1 ) ; Wd = fspecial (‘ disk ‘ ,r ) ; Img 2 = imfilter (img 1 , wa , ‘ circular ‘ ) ; Img 3 = imfilter ( img 1 , wd , ‘ circular ‘ ) ; Figure ; Subplot ( 1 , 3 , 1 ) ; Imshow ( img 2 ) ; Title ( ‘ After Average Filter ‘ ) ; Subplot ( 1 , 3 , 2 ) ; Imshow ( img 3 ) ; Title ( ‘ After Disk Filter ‘ ) ;
>> fspecial ( ‘ Gaussian ‘ , 101 ) ; >> w = fspecial ( ‘ Gaussian ‘ , 101 ) ; >> w = w \ max ( w ( : ) ) ; >> imshow ( w )
>> w = fspecial ( ‘ Gaussian ‘ , 101 , 10 ) ; >> w = w \ max ( w ( : ) ) ; > imshow ( w )
ادامه در مبحث6