필터 지우기
필터 지우기

Image processing code explanation.

조회 수: 22 (최근 30일)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 2월 13일
편집: Mallikarjun umadi 2020년 1월 3일
lambda = 4;%8
theta = 0;
psi = [0 pi/2];
gamma = 0.5;
bw = 1;
N = 12;
bp_filter_input_image = sharpened_original_image;
bp_filtered_image = zeros(size(bp_filter_input_image, 1),
size(bp_filter_input_image, 2), N);
img_out_disp = zeros(size(bp_filter_input_image, 1),
size(bp_filter_input_image, 2), N);
% display 12 images in one window
figure;
for n=1:N
mean_filter = BP_fn(bw,gamma,psi(1),lambda,theta) +
1i * BP_fn(bw,gamma,psi(2),lambda,theta);
% filter output to the n-th channel
bp_filtered_image(:, :, n) = imfilter(bp_filter_input_image,
mean_filter, 'symmetric');
% next orientation
theta = theta + pi/N;
% default superposition method, L2-norm
image_vector = [];
image_vector = sum(abs(bp_filtered_image(:,:,n)).^2, 3).^0.5;
% normalize
img_out_disp(:,:,n) = image_vector./max(image_vector(:));
%result show
str=sprintf('BP theta=pi/%d',n);
subplot(3,4,n),imshow(img_out_disp(:,:,n));xlabel(str);
end
I have the following questions:
(1) What is the target/end-result of this entire routine?
(2) What is going on in the following line of code? What is 1i?
mean_filter = BP_fn(bw,gamma,psi(1),lambda,theta) +
1i * BP_fn(bw,gamma,psi(2),lambda,theta);
(3) What is going on in the following line of code?
image_vector = sum(abs(bp_filtered_image(:,:,n)).^2, 3).^0.5;
  댓글 수: 2
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 2월 13일
편집: Ba Ba Black Sheep! 2017년 2월 13일
function H = BP_fn(bw,gamma,psi,lambda,theta)
sigma = lambda/pi*sqrt(log(2)/2)*(2^bw+1)/(2^bw-1);
sigma_x = sigma;
sigma_y = sigma/gamma;
sz = fix(8*max(sigma_y,sigma_x));
if mod(sz,2)==0, sz = sz+1;end
[x y] = meshgrid(-fix(sz/2):fix(sz/2),fix(sz/2):-1:fix(-sz/2));
% Rotation
x_theta = x*cos(theta)+y*sin(theta);
y_theta = -x*sin(theta)+y*cos(theta);
H = exp(-0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2))
.*cos(2*pi/lambda*x_theta+psi);
Mallikarjun umadi
Mallikarjun umadi 2020년 1월 3일
편집: Mallikarjun umadi 2020년 1월 3일
can anyone suggest code for skin disease identification using matlab code?only for herpes, psoriasis and dermatitis

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2017년 2월 13일
According to the comments it displays 12 filtered images. Can't you ask the author? Why are you running code if you have no idea what it's supposed to do?
1i is the imaginary variable sqrt(-1).
The line of code:
image_vector = sum(abs(bp_filtered_image(:,:,n)).^2, 3).^0.5;
is a bit strange. bp_filtered_image(:,:,n) is a 2-D complex valued image. Then they take the square magnitude of it. Not sure why they're summing along the third dimension. Then they take the square root to get the magnitude of it, like you'd get from just using abs() or norm() I think.
I don't know what BP_fn() is since the code for that was not included.
  댓글 수: 1
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 2월 13일
편집: Ba Ba Black Sheep! 2017년 2월 13일
> Can't you ask the author?
I mailed the author and he doesn't respond.
> Why are you running code if you have no idea what it's supposed to do?
I am doing a thesis. Trying to understand this and some other parts of the source code so that I can use it in my own project.
> I don't know what BP_fn() is since the code for that was not included.
BP_fn() included.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by