matlab实现矩阵的高通滤波
时间: 2023-11-02 15:13:44 浏览: 65
在MATLAB中,可以使用函数`fspecial('high')`来创建一个高通滤波器模板,然后将其与原始图像进行卷积,从而得到高通滤波后的图像。以下是一个简单的示例代码:
```matlab
% 读取原始图像
img = imread('path/to/image.jpg');
% 创建高通滤波器模板
filter = fspecial('high');
% 对原始图像进行卷积操作
filtered_img = imfilter(img, filter);
% 显示原始图像和滤波后的图像
subplot(1,2,1), imshow(img), title('Original Image');
subplot(1,2,2), imshow(filtered_img), title('High-pass Filtered Image');
```
这个示例代码中,`imread`函数用于读取原始图像,`fspecial`函数用于创建高通滤波器模板,`imfilter`函数用于对原始图像进行卷积操作,`subplot`和`imshow`函数用于显示原始图像和滤波后的图像。你可以根据自己的需要调整代码中的输入参数和输出参数。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_lunwen.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![text/plain](https://img-home.csdnimg.cn/images/20210720083646.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)