1.彩色图像的锐化处理
clc;
clear all;
close all;
f=imread(‘0.jpg’); %加载原图像
figure;imshow(f);title(‘原始图像’);
fb=tofloat(f); %将图像转化为浮点型
lapmask=[1 1 1;1 -8 1;1 1 1]; %拉普拉斯滤波模板
fen=fb-imfilter(fb,lapmask,’replicate’);
figure;imshow(fen);title(‘增强后’);
2.函数tofloat定义
function [out,revertclass] = tofloat(inputimage)
%Copy the book of Gonzales
identify = @(x) x;
tosingle = @im2single;
table = {‘uint8’,tosingle,@im2uint8
‘uint16’,tosingle,@im2uint16
‘logical’,tosingle,@logical
‘double’,identify,identify
‘single’,identify,identify};
classIndex = find(strcmp(class(inputimage),table(:,1)));
if isempty(classIndex)
error(‘不支持的图像类型’);
end
out = table{classIndex,2}(inputimage);
revertclass = table{classIndex,3};
彩色图像锐化
最新推荐文章于 2024-03-01 00:40:07 发布