matlabカラー画像の鮮鋭化



Matlab Color Image Sharpening



シャープ化の目的は、画像の細部を強調することです。この記事では、シャープニングにラプラシアン演算子を使用していますが、他のシャープニング演算子も同様です。

研ぎのプロセスは次のとおりです。



  • RGBカラー画像を読む
  • R、G、およびBチャネルのコンポーネントを個別に抽出します
  • シャープテンプレートを設定する
  • 画像の3つのコンポーネントをシャープにしてフィルタリングします
  • フィルタリングされた3つのコンポーネントを組み合わせる
  • % Sharpen color image clc clear all close all rgb1= imread('football.jpg') rgb=im2double(rgb1) rgb_R=rgb(:,:,1) rgb_G= rgb(:,:,2) rgb_B= rgb(:,:,3) lapMatrix=[1 1 1 1 -8 1 1 1 1] %moldboard1 1*8 Matrix2=[1 0 1 0 -4 0 1 0 1] %moldboard21*4 %moldboard1*8 3Different third-parameter sharpening filters %replicate f_R=imfilter(rgb_R,lapMatrix,'replicate') f_G=imfilter(rgb_G,lapMatrix,'replicate') f_B=imfilter(rgb_B,lapMatrix,'replicate') %symmetric f_R2=imfilter(rgb_R,lapMatrix,'symmetric') f_G2=imfilter(rgb_G,lapMatrix,'symmetric') f_B2=imfilter(rgb_B,lapMatrix,'symmetric') %circular f_R3=imfilter(rgb_R,lapMatrix,'circular') f_G3=imfilter(rgb_G,lapMatrix,'circular') f_B3=imfilter(rgb_B,lapMatrix,'circular') %moldBoard 1*4 3Different third-parameter sharpening filters %replicate f2_R=imfilter(rgb_R,Matrix2,'replicate') f2_G=imfilter(rgb_G,Matrix2,'replicate') f2_B=imfilter(rgb_B,Matrix2,'replicate') %symmetric f2_R2=imfilter(rgb_R,Matrix2,'symmetric') f2_G2=imfilter(rgb_G,Matrix2,'symmetric') f2_B2=imfilter(rgb_B,Matrix2,'symmetric') %circular f2_R3=imfilter(rgb_R,Matrix2,'circular') f2_G3=imfilter(rgb_G,Matrix2,'circular') f2_B3=imfilter(rgb_B,Matrix2,'circular') %moldboard1 Sharpened3Weight rgb_tmp=cat(3,f_R,f_G,f_B) rgb_tmp2=cat(3,f_R2,f_G2,f_B2) rgb_tmp3=cat(3,f_R3,f_G3,f_B3) %moldboard2 Sharpened3Weight rgb2_tmp=cat(3,f2_R,f2_G,f2_B) rgb2_tmp2=cat(3,f2_R2,f2_G2,f2_B2) rgb2_tmp3=cat(3,f2_R3,f2_G3,f2_B3) %moldboard1 3The processing result of three parameters is subtracted from the original image rgb_sharped =imsubtract(rgb,rgb_tmp) rgb_sharped2=imsubtract(rgb,rgb_tmp2) rgb_sharped3=imsubtract(rgb,rgb_tmp3) %moldboard2 3The processing result of three parameters is subtracted from the original image rgb2_sharped =imsubtract(rgb,rgb2_tmp) rgb2_sharped2=imsubtract(rgb,rgb2_tmp2) rgb2_sharped3=imsubtract(rgb,rgb2_tmp3) figure subplot(341)imshow(rgb)title('Original') subplot(342)imshow(rgb_R)title('R') subplot(343)imshow(rgb_G)title('G') subplot(344)imshow(rgb_B)title('B') subplot(345)imshow(rgb_tmp)title('cat_r_g_b ') subplot(346)imshow(rgb_tmp2)title('cat_r_g_b2') subplot(347)imshow(rgb_tmp3)title('cat_r_g_b3') subplot(348)imshow(rgb_sharped)title('1*8 replicate') subplot(349)imshow(rgb_sharped2)title('1*8 symmetric') subplot(3,4,10)imshow(rgb_sharped3)title('1*8 3 circular') rgb_diff=imsubtract(rgb_sharped,rgb_sharped2)%replicate sub symmetric subplot(3,4,11)imshow(rgb_diff)title('replicateSubSymmetric') figure subplot(341)imshow(rgb)title('Original') subplot(342)imshow(rgb_R)title('R') subplot(343)imshow(rgb_G)title('G') subplot(344)imshow(rgb_B)title('B') subplot(345)imshow(rgb2_tmp)title('cat_r_g_b ') subplot(346)imshow(rgb2_tmp2)title('cat_r_g_b2') subplot(347)imshow(rgb2_tmp3)title('cat_r_g_b3') subplot(348)imshow(rgb2_sharped)title('1*4 replicate') subplot(349)imshow(rgb2_sharped2)title('1*4 symmetric') subplot(3,4,10)imshow(rgb2_sharped3)title('1*4 3 circular') rgb2_diff=imsubtract(rgb2_sharped,rgb2_sharped2)%replicate sub symmetric subplot(3,4,11)imshow(rgb2_diff)title('replicateSubSymmetric2') rgb3_diff=imsubtract(rgb2_sharped2,rgb_sharped2)%1*8Sub1*4 figure imshow(rgb3_diff)title('1*8Sub1*4')
    画像
    図1
    画像
    図2

    画像
    図3