matlab图像空域平滑 1.读出一幅图像,给这幅图像分别加入椒盐噪声和高斯噪声后并与前一张图像显示在同一图像窗口中。 2.对加入噪声图像选用不同的平滑模板(3×3邻域模板、5×5邻域模板、超限像素平滑法、最大均匀性平滑、中值滤波等)做运算,对比不同模板所输出的效果。 图像空域锐化 1.读出一幅图像,利用sobel和prewitt算子对图像进行锐化,观察采用不同的输出形式,获得的图像锐化处理效果。 2.分别采用5×5,9×9大小的二阶Laplacian算子1中原始图像进行锐化,比较处理效果,要求在同一窗口中显示。

时间: 2024-02-18 18:01:25 浏览: 30
图像空域平滑: 1.读出一幅图像,给这幅图像分别加入椒盐噪声和高斯噪声后并与前一张图像显示在同一图像窗口中。 ```matlab img = imread('lena.png'); gray_img = rgb2gray(img); % 添加椒盐噪声 salt_pepper_img = imnoise(gray_img, 'salt & pepper', 0.05); % 添加高斯噪声 gaussian_img = imnoise(gray_img, 'gaussian', 0.02); % 显示图像 figure; subplot(1,3,1); imshow(gray_img); title('Original Image'); subplot(1,3,2); imshow(salt_pepper_img); title('Salt & Pepper Noise Image'); subplot(1,3,3); imshow(gaussian_img); title('Gaussian Noise Image'); ``` 2.对加入噪声图像选用不同的平滑模板(3×3邻域模板、5×5邻域模板、超限像素平滑法、最大均匀性平滑、中值滤波等)做运算,对比不同模板所输出的效果。 ```matlab % 3x3邻域平均滤波 avg_3x3 = imfilter(salt_pepper_img, fspecial('average', [3 3])); % 5x5邻域平均滤波 avg_5x5 = imfilter(salt_pepper_img, fspecial('average', [5 5])); % 超限像素平滑法 lim_3x3 = adpmedian(salt_pepper_img, 3); % 最大均匀性平滑 max_3x3 = ordfilt2(salt_pepper_img, 5, ones(3,3)); % 中值滤波 med_3x3 = medfilt2(salt_pepper_img, [3 3]); % 显示图像 figure; subplot(2,3,1); imshow(salt_pepper_img); title('Salt & Pepper Noise Image'); subplot(2,3,2); imshow(avg_3x3); title('3x3 Avg Filter'); subplot(2,3,3); imshow(avg_5x5); title('5x5 Avg Filter'); subplot(2,3,4); imshow(lim_3x3); title('Adaptive Median Filter'); subplot(2,3,5); imshow(max_3x3); title('Max Uniformity Filter'); subplot(2,3,6); imshow(med_3x3); title('Median Filter'); ``` 图像空域锐化: 1.读出一幅图像,利用sobel和prewitt算子对图像进行锐化,观察采用不同的输出形式,获得的图像锐化处理效果。 ```matlab img = imread('lena.png'); gray_img = rgb2gray(img); % Sobel算子 sobel_img = imfilter(gray_img, fspecial('sobel')); sobel_img1 = imabsdiff(gray_img, sobel_img); sobel_img2 = imadd(gray_img, sobel_img); % Prewitt算子 prewitt_img = imfilter(gray_img, fspecial('prewitt')); prewitt_img1 = imabsdiff(gray_img, prewitt_img); prewitt_img2 = imadd(gray_img, prewitt_img); % 显示图像 figure; subplot(2,3,1); imshow(gray_img); title('Original Image'); subplot(2,3,2); imshow(sobel_img); title('Sobel Operator'); subplot(2,3,3); imshow(prewitt_img); title('Prewitt Operator'); subplot(2,3,4); imshow(sobel_img1); title('Sobel Operator (abs diff)'); subplot(2,3,5); imshow(sobel_img2); title('Sobel Operator (add)'); subplot(2,3,6); imshow(prewitt_img1); title('Prewitt Operator (abs diff)'); ``` 2.分别采用5×5,9×9大小的二阶Laplacian算子1中原始图像进行锐化,比较处理效果,要求在同一窗口中显示。 ```matlab % 5x5二阶Laplacian算子 laplacian_5 = fspecial('laplacian', 0.2); laplacian_img_5 = imfilter(gray_img, laplacian_5); % 9x9二阶Laplacian算子 laplacian_9 = fspecial('laplacian', 0.8); laplacian_img_9 = imfilter(gray_img, laplacian_9); % 显示图像 figure; subplot(1,3,1); imshow(gray_img); title('Original Image'); subplot(1,3,2); imshow(laplacian_img_5); title('5x5 Laplacian Operator'); subplot(1,3,3); imshow(laplacian_img_9); title('9x9 Laplacian Operator'); ```

相关推荐

最新推荐

recommend-type

matlab 计算灰度图像的一阶矩,二阶矩,三阶矩实例

主要介绍了matlab 计算灰度图像的一阶矩,二阶矩,三阶矩实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
recommend-type

图像增强和去噪的原理+实践操作+matlab代码.docx

本文档详细介绍了遥感图像增强和去噪的基本原理,以及在matlab里面如何去实现这些操作,代码已提供,可让你快速理解并掌握
recommend-type

数字图像处理实验报告-数字图像空间与频率滤波.docx

数字图像空间与频率滤波 word版本 可编辑 附带分析与总结 自己设计理想低通滤波转移函数H(u,v),并通过该转移函数进行低通滤波和高通滤波计算;参考matlab代码如下: 仅对相位部分进行傅立叶反变换后查看结果图像...
recommend-type

数字图像处理MATLAB实现知识点——个人笔记.docx

主要包含:数字图像处理概述,数字图像处理基础,图像基本运算,图像变换,图像增强,图像恢复,图像分割,彩色加强。
recommend-type

数字图像处理技术与应用.pdf

图像旋转、放缩、滤波、canny等等,MATLAB实现可运行,真的良心了,详解呀!!!
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

2. 通过python绘制y=e-xsin(2πx)图像

可以使用matplotlib库来绘制这个函数的图像。以下是一段示例代码: ```python import numpy as np import matplotlib.pyplot as plt def func(x): return np.exp(-x) * np.sin(2 * np.pi * x) x = np.linspace(0, 5, 500) y = func(x) plt.plot(x, y) plt.xlabel('x') plt.ylabel('y') plt.title('y = e^{-x} sin(2πx)') plt.show() ``` 运行这段
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。