已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Digital Image ProcessingComputer Project Report IVContrast Enhancement, Histogram Equalization, Spatial Filtering, & Edge DetectionStudent ID: 20091613310032Name: Xiaopeng JiDate: April 13, 2012A. Objectivesi. Study the effects of contrast enhancement histogram equalization and histogram stretching.ii. Study the effects of histogram equalization via HISTEQ function.iii. Utilizing the SUBPLOT function to display images.iv. Study the effects of spatial filtering using IMNOISE, FSPECIAL, and MEDFILT2 functions.v. Study image noise and how the median and average filters remove noise.vi. Study different methods of edge detection for use on noisy images specifically motion blur, Gaussian noise and filtered Gaussian noise via averaging.vii. Formulate real-world applications which utilize the above functions and concepts.B. MethodsThis project will utilize the functions of MATLAB Image Processing Toolbox to perform Contrast Enhancement, Histogram Equalization, Spatial Filtering using averaging and median filters, and an Edge detection algorithm experiment.1. IMRESIZE function utilization for image expansion.2. Contrast stretching using IMADJUST and STRETCHLIM functions.3. Histogram equalization using HISTEQ function.4. Data display utilizing SUBPLOT function.5. Spatial filtering using IMNOISE, FSPECIAL, and MEDFILT2.6. Edge detection on noisy images using Matlab noise and edge detection functions.C. Results1. Load image saltAndPepper.gif and use the IMRESIZE function to interpolate by a factor of 4 using bi-cubic interpolation.At the command prompt enter : saltandpepper_filename=saltAndPepper.gif;saltandpepper_image=imread(saltandpepper_filename);picture_saltandpepper_scale=imresize(saltandpepper_image,60*4 59*4,bicubic);imwrite(picture_saltandpepper_scale,saltandpepper_bicubic.jpg, jpg);The original image, saltAndPepper.gif, was spatially expanded 4x in each dimension using bi-cubic interpolation. The IMRESIZE function was utilized to perform the operation.Figure 1: Original image.Figure2: saltAndPepper.gif spatially expanded by 4x.2. Contrast Stretching Use the MATLAB function IMADJUST to perform the contrast stretch.a) Use imadjust(Image, LOW_IN, HIGH_IN,); in this format. LOW_IN, HIGH_IN must be in the 0,1 range so the vector must be scaled by the maximum gray level that the image is quantized to (i.e. 8-bits a 256 gray levels).At the command prompt enter :saltandpepper_imadjust=imadjust(picture_saltandpepper_cale,0 (180/255),);imwrite(saltandpepper_imadjust,saltandpepper_imadjust.jpg,jpg);Figure 3: Adjusted figure 2 such that the lowest and highest intensities are 0 and 255 respectively.b) Compute the mean gray level (function: MEAN2) and the standard deviation (function: STD2) and design a mapping function for LOW_IN and HIGH_IN based on the following equations: LOW_IN=(mean-(standard deviation)/2)/256 HIGH_IN=(mean+(standard deviation)/2)/256At the command prompt enter : saltandpepper_mean=mean2(picture_saltandpepper_scale)saltandpepper_std=std2(picture_saltandpepper_scale)low_in=(saltandpepper_mean-(saltandpepper_std)/2)/256high_in=(saltandpepper_mean+(saltandpepper_std)/2)/256saltandpepper_mean=imadjust(picture_saltandpepper_scale,low_in high_in,);imwrite(saltandpepper_mean,saltandpepper_mean.jpg,jpg);Figure 2: The histogram of cameraman.tifsaltandpepper_mean = 60.8439saltandpepper_std = 30.3702low_in = 0.1784high_in = 0.2970Figure 4: IMADJUST performed on Figure 2 with LOW_IN and HIGH_IN equal to above calculationsc) Use the function STRETCHLIM to compute the tolerance for the IMADJUST function. The function STRETCHLIM will compute a vector corresponding to LOW_IN, HIGH_IN. Use the vector calculated by STRETCHLIM to in the IMADJUST function described in a.) and compute the image transformation.At the command prompt enter : 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)Figure 5: STRETCHLIM performed with IMADJUST on Figure 23. Histogram Equalization Use the function HISTEQ to compute the histogram equalization of the original image.4. Data Display Use the SUBPLOT command to display your results.At the command prompt enter: 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(Original Image);subplot(2,2,2);image(saltandpepper_mean);title(Mean and Std Image);subplot(2,2,3);image(saltandpepper_stretchlim);title(StretchLim Image);subplot(2,2,4);image(saltandpepper_EqualizedImage);title(Equalized Image);figure;subplot(2,2,1);imhist(picture_saltandpepper_scale);title(Original Image);subplot(2,2,2);imhist(saltandpepper_mean);title(Mean and Std Image);subplot(2,2,3);imhist(saltandpepper_stretchlim);title(StretchLim Image);subplot(2,2,4);imhist(saltandpepper_EqualizedImage);title(Equalized Image); Figure 3: After histogram equalization5. Spatial Filtering Use the functions IMNOISE, FSPECIAL, and MEDFILT2 to perform spatial filtering of noise corrupted images.a) Using the histogram equalized image of 3) use the IMNOISE function to generate two noise corrupted images. noise_gaussian=imnoise(Image,gaussian,0,0.05); noise_saltAndpepper=imnoise(Image,salt & pepper, 0.02);Use the data display technique in 4) to display the original histogram enhanced image, and the two noise corrupted images.Atnoise_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(Equalized Image);subplot(1,3,2);imagesc(noise_gaussian);title(Noise Gaussian);subplot(1,3,3);imagesc(noise_saltAndpepper);title(Noise Salt and Pepper);b) Use the function FSPECIAL to design averaging filters of size (3x3), (5,5), and (7x7).average_filter_3x3=fspecial(average,3 3)average_filter_5x5=fspecial(average,5 5)average_filter_7x7=fspecial(average,7 7)c) Using the filter masks generated in b), use the function IMFILTER to perform the two-dimensional convolution function of the mask with the noise_gaussian image that was generated in a). Use the display technique in 4) to display the noise_gaussian image and the three averaging filtered results.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(Noise Gaussian);subplot(2,2,2);imagesc(average_gaussian_3x3);title(Average Gaussian 3x3);subplot(2,2,3);imagesc(average_gaussian_5x5);title(Average Gaussian 5x5);subplot(2,2,4);imagesc(average_gaussian_7x7);title(Average Gaussian 7x7);d) Use the MEDFILT2 function to perform median filtering on the noise_saltAndpepper image generated in a). Design the median filters to work with window sizes of (3x3), (5x5), and (7x7). Use the display technique in 4) to display the noise_saltAndpepper image and the three median filtered results.average_saltAndpepper_3x3=medfilt2 (noise_saltAndpepper,3 3);average_saltAndpepper_5x5=medfilt2 (noise_saltAndpepper,5 5);average_saltAndpepper_7x7=medfilt2 (noise_saltAndpepper,7 7); figure;colormap(gray);subplot(2,2,1);imagesc(noise_saltAndpepper);title(Noise saltAndpepper);subplot(2,2,2);imagesc(average_saltAndpepper_3x3);title(Median saltAndpepper 3x3);subplot(2,2,3);imagesc(average_saltAndpepper_5x5);title(Median saltAndpepper 5x5);subplot(2,2,4);imagesc(average_saltAndpepper_7x7);title(Median saltAndpepper 7x7);6. Edge Detection Use the functions EDGE, FSPECIAL, IMAGESC to perform and evaluate each detectors performance in several different scenarios. Load image wheel.gif .a.) Original Image: Use the EDGE function to generate masks for Roberts, Canny, Sobel, and Prewitt operators. Use the IMAGESC function and COLORMAP(GRAY) to plot the result of each edge mask. State which operator gives the best performance and why you think so.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.) Motion Blur: Use the function FSPECIAL (i.e., fspecial(motion,50,45) to generate motion blur. This will simulate blur due to camera or image platform motion. Use the same procedure as in a.) to evaluate your results.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.) Gaussian Noise: Use the function IMNOISE (i.e., imnoise(Image,gaussian,0,0.001);) to generate a noise corrupted image. This experiment is in similar context to b.) as it illustrates how the gradient information degrades due to system parameters such as platform motion and signal to noise ratio. Use the same procedu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 科技职业技术学院单招职业倾向性测试题库附答案详解【模拟题】
- 安全员A证考试练习题附完整答案详解【典优】
- 安全员A证考试高分题库含完整答案详解(典优)
- 青联活动方案
- 房地产销售方案设计稿
- 安全员A证考试题库练习备考题及参考答案详解【达标题】
- 安全员A证考试考前冲刺分析含完整答案详解【各地真题】
- 安全员A证考试考试彩蛋押题及参考答案详解(基础题)
- 大学生文明劝导员策划方案范本
- 安全员A证考试通关训练试卷详解附参考答案详解【培优b卷】
- 2025年社区矫正法试题附答案
- 项目监理安全生产责任制度
- 广东电力市场交易系统 -竞价登记操作指引 新能源项目登记操作指引(居民项目主体)
- 地源热泵机房施工规划与组织方案
- 太仓市高一化学期末考试卷及答案
- 生活物资保障指南解读
- 2025年浙江省委党校在职研究生招生考试(社会主义市场经济)历年参考题库含答案详解(5卷)
- DB3704∕T0052-2024 公园城市建设评价规范
- 采购领域廉洁培训课件
- 2025年中国化妆品注塑件市场调查研究报告
- 小儿药浴治疗
评论
0/150
提交评论