zoukankan      html  css  js  c++  java
  • 实用的 Matlab

    1. Texture Segmentation

    2. 删除图像中的网格(removing grids in an image)

    Removing grids in an image - MATLAB Answers - MATLAB Central


    这里写图片描述

    • (1)通过阈值化的处理,识别亮的部分(也即网格的部分),
    • (2)对图像进行中值滤波,
    • (3)步骤 1 获得的网格的部分,由步骤(2)的结果所取代;
    clear, clc
    I = imread('./grid.png');
    grid = I > 125;
    filtered = medfilt2(I, [80, 80]);
                % 当然也不一定非得是中值滤波,也可以采用其他插值形式
    I(grid) = filtered(grid);
    imshow(I)

    3. 运动图像去模糊

    基于matlab运动模糊图像处理的源代码

    • 使用维纳滤波;
    function deblurred(im, a, b, NSPR)
    i = imread(im);
    f = im2double(i);
    PSF = fspecial('motion', a, b);
                            %  point spread function (PSF)
    frest1 = deconvwnr(f, PSF, NSPR);
                            % NSR is the noise-to-signal power ratio of the additive noise. 
                            % NSR can be a scalar or a spectral-domain array of the same size as I. 
    subplot(221),imshow(f); title('原图像');
    subplot(222),imshow(frest1); title('维纳滤波处理后图像'); 
    end
    • PSF = fspecial(‘motion’,len,ang); %建立扩散子,其中len是模糊长度,ang是模糊角度;
    • img2=deconvlucy(img,PSF,n); %用lucy-richardson方法复原图像,其中img是运动模糊图像,PSF是扩散子,n是迭代次数,img2是复原图像

    一般模糊图像的模糊距离和模糊角度不好判断,但也可以通过查看图像的频谱图和实部二维图来大致估:

    % 求角度
    img_fft=fftshift(fft2(img_gray));
    N=abs(img_fft);
    P=(N-min(min(N)))/(max(max(N))-min(min(N)))*225;
    figure;imshow(P);
    
    % 求长度
    h=fspecial('sobel');
    img_double=double(img_gray);
    J=conv2(img_double,h,'same');
    IP=abs(fft2(J));
    S=fftshift(real(ifft2(IP)));
    figure;plot(S);
  • 相关阅读:
    线程的补充
    线程
    进程
    操作系统和进程
    socketserver模块实现并发和连接合法性验证
    socketserver实例化过程
    粘包现象和解决方法
    网络通信协议
    初探网络
    Python网络编程
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9422982.html
Copyright © 2011-2022 走看看