日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

反锐化掩膜_光电图像处理 | 空域锐化滤波

發布時間:2023/12/4 编程问答 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 反锐化掩膜_光电图像处理 | 空域锐化滤波 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

銳化濾波

Sharpen filter

clc;close all;I = imread('圖片11.jpg');set(figure(1), 'name','不同梯度合成效果', 'numbertitle', 'off');subplot(221),imshow(I);title('原圖');I = rgb2gray(I);%% Roberts operatorH1x = [0 0 0;0 -1 0;0 0 1]; H1y = [0 0 0;0 0 -1;0 1 0];J1x = imfilter(I,H1x);J1y = imfilter(I,H1y);%% Prewitt operatorH2x = [-1 0 1;-1 0 1;-1 0 1]; H2y = [-1 -1 -1;0 0 0;1 1 1];J2x = imfilter(I,H2x);J2y = imfilter(I,H2y);%% Sobel operatorH3x = [-1 0 1;-2 0 2;-1 0 1]; H3y = [-1 -2 -1;0 0 0;1 2 1];J3x = imfilter(I,H3x);J3y = imfilter(I,H3y);%% 梯度合成原則[M1,M2,M3]=Combining_rules(J1x,J1y);%% 幅度增強策略T = double(20);I = double(I);[m1, m2, m3, m4, m5] = Amplitude_enhancement_strategy(I,M1,T);%% 顯示結果subplot(222),imshow(uint8(M1));title('合成的梯度直接取模長');subplot(223),imshow(uint8(M2));title('合成的梯度取絕對值之和');subplot(224),imshow(uint8(M3));title('合成的梯度取x方向和y方向最大值');set(figure(2), 'name','最終銳化效果', 'numbertitle', 'off');subplot(231),imshow(uint8(I));title('原圖');subplot(232),imshow(uint8(m1));title('合成的梯度直接幅值顯示');subplot(233),imshow(uint8(m2));title('合成的梯度背景保留');subplot(234),imshow(uint8(m3));title('合成的梯度背景保留,輪廓取單一灰度值');subplot(235),imshow(uint8(m4));title('合成的梯度輪廓保留,背景取單一灰度值');subplot(236),imshow(uint8(m5));title('合成的梯度輪廓/背景分別取單一灰度值');%% 函數定義function [M1,M2,M3]=Combining_rules(J1x,J1y) % 梯度合成原則JJJx = double(J1x);JJJy = double(J1y);M1 = 2 * sqrt((JJJx).^2 + (JJJy).^2); % 模長M2 = 2 * abs(JJJx) + abs(JJJy); % 絕對值之和M3 = 2 * max(abs(JJJx),abs(JJJy)); % 取最大值% 說明:2 * 完全是為了放大效果,原圖像素值實在是太低了endfunction [m1, m2, m3, m4, m5] = Amplitude_enhancement_strategy(I,M1,T) % 幅度增強策略% 直接幅值顯示m1 = M1;% 背景保留m2 = M1 .* (M1 >= T) + I .* (M1 < T);% 背景保留,輪廓取單一灰度值m3 = double(250) .* (M1 >= T) + I .* (M1 < T);% 輪廓保留,背景取單一灰度值m4 = M1 .* (M1 >= T) + double(200) .* (M1 < T);% 輪廓/背景分別取單一灰度值m5 = double(0) .* (M1 >= T) + double(255) .* (M1 < T);end

RESULT

神奇特效...

到此為止,把Roberts算子那個地方整明白了。

拉普拉斯算子

Laplace

%% 拉普拉斯算子銳化clc;close all;I = imread('圖片12.jpg');set(figure(1), 'name','BY ZH', 'numbertitle', 'off');subplot(131),imshow(I);title('原圖');% I = rgb2gray(I);H1 = [0 1 0;1 -4 1;0 1 0];H2 = [1 1 1;1 -8 1;1 1 1];I = im2double(I);J1 = imfilter(I,H1,'replicate');J2 = imfilter(I,H2,'replicate');subplot(132),imshow(I-J1);title('Laplacian processing 4')subplot(133),imshow(I-J2);title('Laplacian processing 8')

RESULT

空域高通濾波設計

Spatial high pass filtering design

While the high-pass filtering enhances the edge/contour, the noise may also be enhanced. As a result, the layers of the image will be lost and become rough.

clc;close all;I = imread('圖片12.jpg');set(figure(1), 'name','BY ZH', 'numbertitle', 'off');subplot(121),imshow(I);title('原圖');H1 = [-1 -1 -1 -1 -1;-1 1 1 1 -1;-1 1 8 1 -1;-1 1 1 1 -1;-1 -1 -1 -1 -1];I = rgb2gray(I);I = im2double(I);J1 = imfilter(I,H1,'replicate');subplot(122),imshow(J1),title('2')

RESULT

反銳化掩膜

Unsharp?masking

clc;close all;I = imread('圖片1.png');set(figure(1), 'name','BY ZH', 'numbertitle', 'off');subplot(221),imshow(I);title('原圖');I = rgb2gray(I);J = ordfilt2(I,1,ones(3,3));subplot(222),imshow(J),title('最小值濾波效果')subplot(223),imshow(I-J),title('反銳化模')subplot(224),imshow(I-J+I),title('銳化效果')

RESULT

so 空域結束

下次頻域見。

總結

以上是生活随笔為你收集整理的反锐化掩膜_光电图像处理 | 空域锐化滤波的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。