DigitalImageProcessing4教学文案.docx
- 文档编号:26096477
- 上传时间:2023-06-17
- 格式:DOCX
- 页数:20
- 大小:703.33KB
DigitalImageProcessing4教学文案.docx
《DigitalImageProcessing4教学文案.docx》由会员分享,可在线阅读,更多相关《DigitalImageProcessing4教学文案.docx(20页珍藏版)》请在冰豆网上搜索。
DigitalImageProcessing4教学文案
Digital-Image-Processing-4
DigitalImageProcessing
ComputerProjectReportIV
ContrastEnhancement,HistogramEqualization,SpatialFiltering,&EdgeDetection
StudentID:
20091613310032
Name:
XiaopengJi
Date:
April13,2012
A.Objectives
i.Studytheeffectsofcontrastenhancementhistogramequalizationandhistogramstretching.
ii.StudytheeffectsofhistogramequalizationviaHISTEQfunction.
iii.UtilizingtheSUBPLOTfunctiontodisplayimages.
iv.StudytheeffectsofspatialfilteringusingIMNOISE,FSPECIAL,andMEDFILT2functions.
v.Studyimagenoiseandhowthemedianandaveragefiltersremovenoise.
vi.Studydifferentmethodsofedgedetectionforuseonnoisyimagesspecificallymotionblur,GaussiannoiseandfilteredGaussiannoiseviaaveraging.
vii.Formulatereal-worldapplicationswhichutilizetheabovefunctionsandconcepts.
B.Methods
ThisprojectwillutilizethefunctionsofMATLABImageProcessingToolboxtoperformContrastEnhancement,HistogramEqualization,SpatialFilteringusingaveragingandmedianfilters,andanEdgedetectionalgorithmexperiment.
1.IMRESIZEfunctionutilizationforimageexpansion.
2.ContraststretchingusingIMADJUSTandSTRETCHLIMfunctions.
3.HistogramequalizationusingHISTEQfunction.
4.DatadisplayutilizingSUBPLOTfunction.
5.SpatialfilteringusingIMNOISE,FSPECIAL,andMEDFILT2.
6.EdgedetectiononnoisyimagesusingMatlabnoiseandedgedetectionfunctions.
C.Results
1.LoadimagesaltAndPepper.gifandusetheIMRESIZEfunctiontointerpolatebyafactorof4using‘bi-cubic’interpolation.
Atthecommandpromptenter:
>>saltandpepper_filename='saltAndPepper.gif';
saltandpepper_image=imread(saltandpepper_filename);
picture_saltandpepper_scale=imresize(saltandpepper_image,[60*459*4],'bicubic');
imwrite(picture_saltandpepper_scale,'saltandpepper_bicubic.jpg','jpg');
Theoriginalimage,saltAndPepper.gif,wasspatiallyexpanded4xineachdimensionusingbi-cubicinterpolation.TheIMRESIZEfunctionwasutilizedtoperformtheoperation.
Figure1:
Originalimage.
Figure2:
saltAndPepper.gifspatiallyexpandedby4x.
2.ContrastStretching–UsetheMATLABfunctionIMADJUSTtoperformthecontraststretch.
a)Useimadjust(Image,[LOW_IN,HIGH_IN],[]);inthisformat.[LOW_IN,HIGH_IN]mustbeinthe[0,1]rangesothevectormustbescaledbythemaximumgraylevelthattheimageisquantizedto(i.e.8-bitsa256graylevels).
Atthecommandpromptenter:
>>saltandpepper_imadjust=imadjust(picture_saltandpepper_cale,[0(180/255)],[]);
imwrite(saltandpepper_imadjust,'saltandpepper_imadjust.jpg','jpg');
Figure3:
Adjustedfigure2suchthatthelowestandhighestintensitiesare0and255respectively.
b)Computethemeangraylevel(function:
MEAN2)andthestandarddeviation(function:
STD2)anddesignamappingfunctionforLOW_INandHIGH_INbasedonthefollowingequations:
LOW_IN=(mean-(standarddeviation)/2)/256
HIGH_IN=(mean+(standarddeviation)/2)/256
Atthecommandpromptenter:
>>saltandpepper_mean=mean2(picture_saltandpepper_scale)
saltandpepper_std=std2(picture_saltandpepper_scale)
low_in=(saltandpepper_mean-(saltandpepper_std)/2)/256
high_in=(saltandpepper_mean+(saltandpepper_std)/2)/256
saltandpepper_mean=imadjust(picture_saltandpepper_scale,[low_inhigh_in],[]);
imwrite(saltandpepper_mean,'saltandpepper_mean.jpg','jpg');
Figure2:
Thehistogramofcameraman.tif
saltandpepper_mean=60.8439
saltandpepper_std=30.3702
low_in=0.1784
high_in=0.2970
Figure4:
IMADJUSTperformedonFigure2withLOW_INandHIGH_INequaltoabovecalculations
c)UsethefunctionSTRETCHLIMtocomputethetolerancefortheIMADJUSTfunction.ThefunctionSTRETCHLIMwillcomputeavectorcorrespondingto[LOW_IN,HIGH_IN].UsethevectorcalculatedbySTRETCHLIMtointheIMADJUSTfunctiondescribedina.)andcomputetheimagetransformation.
Atthecommandpromptenter:
>>low_high=stretchlim(picture_saltandpepper_scale,0)
saltandpepper_stretchlim=imadjust(picture_saltandpepper_scale,low_high,[]);
imwrite(saltandpepper_stretchlim,'saltandpepper_stretchlim.jpg','jpg');
low_high=(0
0.7059)
Figure5:
STRETCHLIMperformedwithIMADJUSTonFigure2
3.HistogramEqualization–UsethefunctionHISTEQtocomputethehistogramequalizationoftheoriginalimage.
4.DataDisplay–UsetheSUBPLOTcommandtodisplayyourresults.
Atthecommandpromptenter:
>>imhist(picture_saltandpepper_scale);
saltandpepper_EqualizedImage=histeq(picture_saltandpepper_scale);
imwrite(saltandpepper_EqualizedImage,'saltandpepper_EqualizedImage.jpg','jpg');
colormap('gray');
subplot(2,2,1);
image(picture_saltandpepper_scale);
title('OriginalImage');
subplot(2,2,2);
image(saltandpepper_mean);
title('MeanandStdImage');
subplot(2,2,3);
image(saltandpepper_stretchlim);
title('StretchLimImage');
subplot(2,2,4);
image(saltandpepper_EqualizedImage);
title('EqualizedImage');
figure;
subplot(2,2,1);
imhist(picture_saltandpepper_scale);
title('OriginalImage');
subplot(2,2,2);
imhist(saltandpepper_mean);
title('MeanandStdImage');
subplot(2,2,3);
imhist(saltandpepper_stretchlim);
title('StretchLimImage');
subplot(2,2,4);
imhist(saltandpepper_EqualizedImage);
title('EqualizedImage');
Figure3:
Afterhistogramequalization
5.SpatialFiltering–UsethefunctionsIMNOISE,FSPECIAL,andMEDFILT2toperformspatialfilteringofnoisecorruptedimages.
a)Usingthehistogramequalizedimageof3)usetheIMNOISEfunctiontogeneratetwonoisecorruptedimages.
noise_gaussian=imnoise(Image,’gaussian’,0,0.05);noise_saltAndpepper=imnoise(Image,’salt&pepper’,0.02);
Usethedatadisplaytechniquein4)todisplaytheoriginalhistogramenhancedimage,andthetwonoisecorruptedimages.
At
noise_gaussian=imnoise(saltandpepper_EqualizedImage,'gaussian',0,0.05);
noise_saltAndpepper=imnoise(saltandpepper_EqualizedImage,'salt&pepper',0.02);
figure;
colormap('gray');
subplot(1,3,1);
imagesc(saltandpepper_EqualizedImage);
title('EqualizedImage');
subplot(1,3,2);
imagesc(noise_gaussian);
title('NoiseGaussian');
subplot(1,3,3);
imagesc(noise_saltAndpepper);
title('NoiseSaltandPepper');
b)UsethefunctionFSPECIALtodesignaveragingfiltersofsize(3x3),(5,5),and(7x7).
average_filter_3x3=fspecial('average',[33])
average_filter_5x5=fspecial('average',[55])
average_filter_7x7=fspecial('average',[77])
c)Usingthefiltermasksgeneratedinb),usethefunctionIMFILTERtoperformthetwo-dimensionalconvolutionfunctionofthemaskwiththenoise_gaussianimagethatwasgeneratedina).Usethedisplaytechniquein4)todisplaythenoise_gaussianimageandthethreeaveragingfilteredresults.
average_gaussian_3x3=imfilter(noise_gaussian,average_filter_3x3);
average_gaussian_5x5=imfilter(noise_gaussian,average_filter_5x5);
average_gaussian_7x7=imfilter(noise_gaussian,average_filter_7x7);
figure;
colormap('gray');
subplot(2,2,1);
imagesc(noise_gaussian);
title('NoiseGaussian');
subplot(2,2,2);
imagesc(average_gaussian_3x3);
title('AverageGaussian3x3');
subplot(2,2,3);
imagesc(average_gaussian_5x5);
title('AverageGaussian5x5');
subplot(2,2,4);
imagesc(average_gaussian_7x7);
title('AverageGaussian7x7');
d)UsetheMEDFILT2functiontoperformmedianfilteringonthenoise_saltAndpepperimagegeneratedina).Designthemedianfilterstoworkwithwindowsizesof(3x3),(5x5),and(7x7).Usethedisplaytechniquein4)todisplaythenoise_saltAndpepperimageandthethreemedianfilteredresults.
average_saltAndpepper_3x3=medfilt2(noise_saltAndpepper,[33]);
average_saltAndpepper_5x5=medfilt2(noise_saltAndpepper,[55]);
average_saltAndpepper_7x7=medfilt2(noise_saltAndpepper,[77]);
figure;
colormap('gray');
subplot(2,2,1);
imagesc(noise_saltAndpepper);
title('NoisesaltAndpepper');
subplot(2,2,2);
imagesc(average_saltAndpepper_3x3);
title('MediansaltAndpepper3x3');
subplot(2,2,3);
imagesc(average_saltAndpepper_5x5);
title('MediansaltAndpepper5x5');
subplot(2,2,4);
imagesc(average_saltAndpepper_7x7);
title('MediansaltAndpepper7x7');
6.EdgeDetection–UsethefunctionsEDGE,FSPECIAL,IMAGESCtoperformandevaluateeachdetectorsperformanceinseveraldifferentscenarios.Loadimagewheel.gif.
a.)OriginalImage:
UsetheEDGEfunctiontogeneratemasksforRoberts,Canny,Sobel,andPrewittoperators.UsetheIMAGESCfunctionandCOLORMAP(GRAY)toplottheresultofeachedgemask.Statewhichoperatorgivesthebestperformanceandwhyyouthinkso.
wheel_filename='wheel.gif';
wheel_image=imread(wheel_filename);
BW1=edge(wheel_image,'prewitt');
BW2=edge(wheel_image,'canny');
BW3=edge(wheel_image,'sobel');
BW4=edge(wheel_image,'roberts');
figure;
colormap('gray');
subplot(2,2,1);
imagesc(BW1);
title('Prewitt');
subplot(2,2,2);
imagesc(BW2);
title('Canny');
subplot(2,2,3);
imagesc(BW3);
title('Sobel');
subplot(2,2,4);
imagesc(BW4);
title('Roberts');
b.)MotionBlur:
UsethefunctionFSPECIAL(i.e.,fspecial('motion',50,45))togeneratemotionblur.Thiswillsimulateblurduetocameraorimageplatformmotion.Usethesameprocedureasina.)toevaluateyourresults.
motionfilter=fspecial('motion',50,45);
wheel_filter=imfilter(wheel_image,motionfilter);
BW1=edge(wheel_filter,'prewitt');
BW2=edge(wheel_filter,'canny');
BW3=edge(wheel_filter,'sobel');
BW4=edge(wheel_filter,'roberts');
figure;
colormap('gray');
subplot(2,2,1);
imagesc(BW1);
title('Prewitt');
subplot(2,2,2);
imagesc(BW2);
title('Canny');
subplot(2,2,3);
imagesc(BW3);
title('Sobel');
subplot(2,2,4);
imagesc(BW4);
title('Roberts');
c.)GaussianNoise:
UsethefunctionIMNOISE(i.e.,imnoise(Image,'gaussian',0,0.001);)togenerateanoisecorruptedimage.Thisexperiment
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- DigitalImageProcessing4 教学 文案
![提示](https://static.bdocx.com/images/bang_tan.gif)