zoukankan      html  css  js  c++  java
  • 常用图像锐化算法

    %-----------------------------------------------------------------------常用图像锐化算法---------------------------------------------------------------------------------%

    clc;clear;close all

    ima=imread('F:\ZPB\1.jpg');%读入图像

    if isrgb(ima)

        ima=rgb2gray(ima);%如果是彩色图像,则转为灰度图像   

    end

    ima=double(ima);

     

    bw1 = edge(ima,'sobel'); 

    subplot(241);imshow(uint8(ima));title('原始图像');

    subplot(242);imshow(bw1);title('sobel算子锐化');

     

    bw2 = edge(ima,'prewitt');

    subplot(243);imshow(bw2);title('prewitt算子锐化');

     

    bw3 = edge(ima,'roberts');

    subplot(244);imshow(bw3);title('roberts算子锐化');

     

    bw4 = edge(ima,'log');

    subplot(245);imshow(bw4);title('log算子锐化');

     

    bw5 = edge(ima,'canny');

    subplot(246);imshow(bw5);title('canny算子锐化');

     

    h1=fspecial('gaussian',[9 9]);

    bw6 = imfilter(ima,h1);

    subplot(247);imshow(uint8(bw6));title('gaussian低通滤波器锐化');

     

    h2=fspecial('laplacian');

    bw7 = imfilter(ima,h1);

    subplot(248);imshow(uint8(bw7));title('laplacian算子锐化');

          

     

    --------------------------------------------------------------------------图像锐化-----------------------------------------------------------------------

    I = imread('F:\ZPB\1.jpg');

    Subplot(1,2,1);imshow(I); 

    title('Original Image');

    H = fspecial('unsharp');

    sharpened = imfilter(I,H,'replicate');

    Subplot(1,2,2);imshow(sharpened);

    title('Sharpened Image');

                                                  

  • 相关阅读:
    [CF340D]Bubble Sort Graph/[JZOJ3485]独立集
    [JZOJ3484]密码
    [HDU1756]Cupid's Arrow
    Luogu P4006 小 Y 和二叉树
    Luogu P4040 [AHOI2014/JSOI2014]宅男计划
    Luogu P3243 [HNOI2015]菜肴制作
    Luogu P3942 将军令
    Luogu P4823 [TJOI2013]拯救小矮人
    Luogu P3620 [APIO/CTSC 2007]数据备份
    BZOJ3709 [PA2014]Bohater
  • 原文地址:https://www.cnblogs.com/qxql2016/p/3843611.html
Copyright © 2011-2022 走看看