How to apply matched filter over surface of image instead of lines on 2d matrix: MATLAB
2 次查看(过去 30 天)
显示 更早的评论
I have a 2d matrix and want to implement a matched filter on this matrix(image) of size 360x360
a=360x360
I tried to read about the matched filter but still unsure about it?
MY ATTEMPT(But this is not desired as this makes matched filter over lines and not on my image)
img=a;
s = 1.5; %sigma
L = 7;
theta = 0:15:165; %different rotations
out = zeros(size(img));
m = max(ceil(3*s),(L-1)/2);
[x,y] = meshgrid(-m:m,-m:m); % non-rotated coordinate system, contains (0,0)
for t = theta
t = t / 180 * pi; % angle in radian
u = cos(t)*x - sin(t)*y; % rotated coordinate system
v = sin(t)*x + cos(t)*y; % rotated coordinate system
N = (abs(u) <= 3*s) & (abs(v) <= L/2); % domain
k = exp(-u.^2/(2*s.^2)); % kernel
k = k - mean(k(N));
k(~N) = 0; % set kernel outside of domain to 0
res = conv2(img,k,'same');
out = max(out,res);
end
out = out/max(out(:)); % force output to be in [0,1]
imagesc(out)
My expectation was to get a more clear and bright image but I didn't get that
I want to reduce noise and get a better image
I want to reduce noise and apply over image surface, not on lines get a better image
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!