【图像处理】使用空间滤镜增强图像(Matlab实现)

本文介绍了如何在Matlab中使用空间滤镜(如Laplacian和Sobel算子)对图像进行增强,包括去噪、边缘检测和锐化,通过示例展示了从原始图像到最终增强图像的步骤和代码实现。
摘要由CSDN通过智能技术生成

 💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

使用空间滤镜增强图像是一种常见的图像处理方法,旨在改善图像的质量、增强图像的特征以及减少图像中的噪声。这种方法基于对图像中每个像素及其周围像素的数学运算,以便在输出图像中产生某种视觉效果。空间滤镜通常通过在图像的局部区域内进行像素值操作来实现,这些操作可以是加权平均、差分运算、中值计算等。使用空间滤镜增强图像可以改善图像的对比度、锐化边缘、平滑噪声等。常见的空间滤镜包括均值滤波器、高斯滤波器、中值滤波器等。这些滤波器在图像处理中被广泛应用于去除噪声、边缘检测、图像平滑等方面,是图像处理中的基础技术之一。

📚2 运行结果

主函数部分代码:

clc; clear;
%% Read the original image
% (a) The original image
fig_original = double(imread('data/skeleton_orig.tif')) / 255;
figure;
subplot(2, 4, 1);
imshow(fig_original);
imwrite(fig_original, 'data/skeleton_orig.png');

% (b) The Laplacian of the original image
laplace_result = imfilter([-1 -1 -1; -1 8 -1; -1 -1 -1], fig_original);
subplot(2, 4, 2);
imshow(remap(laplace_result, 0, 1));
imwrite(remap(laplace_result, 0, 1), 'data/laplace_result.png');

% (c) The sharpened image using Laplacian
sharpened_laplace_result = fig_original + laplace_result;
subplot(2, 4, 3);
imshow(sharpened_laplace_result);
imwrite(sharpened_laplace_result, 'data/sharpened_laplace_result.png');

% (d) The Sobel gradient of the original image
sobel_grad = abs(imfilter([-1 -2 -1; 0 0 0; 1 2 1], fig_original)) + abs(imfilter([-1 0 1; -2 0 2; -1 0 1], fig_original));
subplot(2, 4, 4);
imshow(sobel_grad);
imwrite(sobel_grad, 'data/sobel_grad.png');

% (e) The smoothed Sobel gradient
smoothed_sobel_grad = imfilter(ones(5)/25, sobel_grad);
subplot(2, 4, 5);
imshow(smoothed_sobel_grad);
imwrite(smoothed_sobel_grad, 'data/smoothed_sobel_grad.png');

% (f) Mask image formed by the product of (c) and (e)
product_laplace_sobel = sharpened_laplace_result .* smoothed_sobel_grad;
subplot(2, 4, 6);
imshow(product_laplace_sobel);
imwrite(product_laplace_sobel, 'data/product_laplace_sobel.png');

% (g) Sharpened image obtained by the sum of (a) and (f)
sharpened_image = max(fig_original + product_laplace_sobel, 0);
subplot(2, 4, 7);
imshow(sharpened_image);
imwrite(sharpened_image, 'data/sharpened_image.png');

🎉3 参考文献

文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。

[1]李辉,刘姁升,蒋金豹等.基于冬小麦高光谱图像的天然气微泄漏胁迫区域提取[J].光谱学与光谱分析,2024,44(03):770-776.

🌈4 Matlab代码实现

  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

荔枝科研社

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值