【图像处理】小波编码图像中伪影和纹理的检测(Matlab代码实现)

 👨‍🎓个人主页:研学社的博客 

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

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

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

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

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码及文章讲解


💥1 概述

文献来源:

 

本文描述了一种小波编码图像的分割和分析算法

该算法构成了图像后处理方案的一部分,该方案可以成功地恢复遭受模糊伪影的压缩图像中的纹理。该算法包括提取纹理、强度(或颜色)和空间特征。kmeans算法的变体被用于有效地分割大图像。分析阶段使用基于规则的启发式方法将片段分类为可用于恢复它们的潜在伪影或相邻纹理。这种新颖的图像后处理方法需要最少的用户交互,并且可以成功地利用压缩图像中的纹理级别相关性。

📚2 运行结果

部分代码:

clear all; clc; clf; warning off; close all hidden;
totalt = 0; % Total time spent on segmentation.

% PRE-PROCESS the image to produce a feature set.
%   1. Texture processing using DOOG filters
%   2. Principle component analysis to reduce dimensionality
%   3. Random sampling of image

img = im2double(imread('4.bmp')); % Read gray image
%img = im2double(imread('girl.bmp')); % Read color image


disp('Preprocessing...');tic;
% Preprocess all
[allfeatures, rDims, cDims, depth] = preprocfast(img);
[samples,olddimensions] = size(allfeatures);
gallfeatures = allfeatures;

% Combine all texture features to use for later thresholding
% Also save all low pass features for later adjacency processing
if depth == 1
    texturefeature = max(allfeatures(:,4:11), [], 2);
    lowpassfeature = allfeatures(:,3);
    lowpassimage = reshape(lowpassfeature, [cDims rDims])';
else
    texturefeature = max(allfeatures(:,6:13), [], 2);
    lowpassfeature = allfeatures(:,3:5);
    lowpassimage(:,:,1) = reshape(lowpassfeature(:,1), [cDims rDims])';
    lowpassimage(:,:,2) = reshape(lowpassfeature(:,2), [cDims rDims])';
    lowpassimage(:,:,3) = reshape(lowpassfeature(:,3), [cDims rDims])';
end
textures = reshape(texturefeature, [cDims rDims])';

% Principle component based dimensionality reduction of all features
allfeatures = pca(allfeatures, 0.05); 

% Choose 10% of samples randomly and save in DATASET
[samples, dimensions] = size(allfeatures);
% We work on ~WORKSAMPLES pixels. If the image has less we use all pixels. 
% If not then the appropriate portion of pixels is randomly selected.
worksamples = samples/10;
if worksamples < 10000
    worksamples = 10000;
end
if samples < worksamples
    worksamples = samples;
end
choose = rand([samples 1]); choose = choose < (worksamples/samples); 
dataset = zeros([sum(choose), dimensions]);
dataset(1:sum(choose),:) = allfeatures(find(choose),:); % find(choose) returns array where choose is non zero

disp('Preprocessing done.');t = toc; totalt = totalt + t;
disp(['     Original dimensions: ' int2str(olddimensions)]);
disp(['     Reduced dimensions by PCA: ' int2str(dimensions)]);
disp(['     Image has ' int2str(rDims * cDims) ' pixels.']);
disp(['     Using only ' int2str(size(dataset,1)) ' pixels.']);
disp(['Elapsed time: ' num2str(t)]);
disp(' ');

% SEGMENTATION
%   1. k-means (on sampled image)
%   2. Use centroids to classify remaining points
%   3. Classify spatially disconnected regions as separate regions

% Segmentation Step 1. 
%   k-means (on sampled image)
% Compute k-means on randomly sampled points
disp('Computing k-means...');tic;
% Set number of clusters heuristically.
k = round((rDims*cDims)/(100*100)); k = max(k,8); k = min(k,16);

% Uncomment this line when MATLAB k-means unavailable
%[centroids,esq,map] = kmeanlbg(dataset,k);
[map, centroids] = kmeans(dataset, k);  % Calculate k-means (use MATLAB k-mean
disp('k-means done.');t = toc; totalt = totalt + t;

🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

荔枝科研社

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

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

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

打赏作者

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

抵扣说明:

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

余额充值