文字和自然图像的 abs(laplace)直方图


文字图像:




自然图像的: 






可见文字图像的直方图像是斜坡状的,而自然图像的下降比较陡


线条多的图像:




matlab脚本

clear all; 
clc
close all; 


imgpath = 'E:\img\lines3.jpg';
im = imread(imgpath);
[m,n,c] = size(im); 

ratio = 500/(min(m,n)); 
im = imresize(im, ratio); 

[m,n,c] = size(im);
if m>n
    y = round((m-n)/2);
    x = 0; 
else
    y = 0; 
    x = round((n-m)/2);
end 
w = min(m,n); 

%裁剪中间的正方形
im = imcrop(im, [x,y,w,w]); 
[m,n,c] = size(im);
figure; imshow(im);  title('im crop'); 

if 1 ~= c
    gray = rgb2gray(im);
else
    gray = im; 
end 
  
gray = double(gray);
 
f = fspecial('laplacian'); 
fim=imfilter(gray, f, 'replicate'); 
    
figure; imshow(fim,[]); title('fim'); 
figure; imshow(fim); title('fim'); colormap jet; colorbar; 
af = abs(fim);
figure; imshow(af,[]); title('abs fim'); 
afw = af > 30; 
figure; imshow(afw,[]); title('afw'); 
fs = fim(:);

[x,r] = hist(abs(fs), 50); 
%低频的去掉
x(1:3) = [];
r(1:3) = []; 
figure; bar(r,x);  title('abs(laplace) hist');  
xlabel('abs(laplace)'); 
ylabel('times'); 

varfs = var(double(fs));
abfs = abs(fs); 
mx = max(abfs);
mn = mean(abfs);
disp(sprintf('var:%.2f, max:%.2f, mean:%.2f, %s', varfs, mx, mn, imgpath));  



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值