• 【图像处理】小波编码图像中伪影和纹理的检测(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 参考文献

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

     

  • 相关阅读:
    HuggingFace 国内下载 阿里云盘下载速度20MB/s
    新手小白学JAVA 泛型 Collection List Set
    npm install的-S和-D的区别
    生成验证码图片
    Kubernetes(k8s) Web-UI界面(二):部署和访问Kuboard
    Codesys 获取系统年、月、日、时、分、秒、星期几 +解决时区问题+ ST语言编程实现代码
    [Codeforces] number theory (R1200) Part.10
    数据库基础知识
    Linux基础教程:9、linux进程管理(2)
    再战sortablejs
  • 原文地址:https://blog.csdn.net/weixin_46039719/article/details/128049683