필터 지우기
필터 지우기

How can I remove the background noise of this image from the mat file?

조회 수: 3 (최근 30일)
Gulfam Saju
Gulfam Saju 2022년 6월 21일
댓글: Image Analyst 2023년 9월 26일
addpath(genpath('.\'))
ReduceFactor=4; % Facter: R = 1 - 8
R=ReduceFactor;
CoilNum = 16;
inter_num_VP = 4;%6;
inter_num = 30 ;%2;
ACSL=32;%16; % for reconstruction
order=7;
FOV=320;%252;%60;
row=FOV;
column=FOV;
afa=0.0;%0.0015;
% ****************************************************
%load recon_images;
load 01.mat
for s = 1 : CoilNum
Img(:,:,s) = ifftshift(ifftshift(raw_data(:,:,s)));
end
recon_images=Img;clear Img;
% *****************
a=ones(320,1);
b=[a -a];
c=repmat(b,[1 160]);
figure;imshow(abs(rot90(recon_images(:,:,1), 0)),[]);
% **************************
[D2,D2,CoilNum]=size(recon_images);
for s = 1 : CoilNum
%Img(:,:,s)=imresize(rot90(recon_images(:,:,s),-1),[row,column],'bilin');
Img(:,:,s)=rot90(recon_images(:,:,s),-1);
end
clear recon_images kspace_data
% ****************************************************
s_poly=zeros(order+1,order+1,CoilNum);
Img0=sqrt(sum([abs(Img)].^2,3));
[mask]=get_mask(Img0);
Img_NMSE=Img0/mean(mean(abs(Img0)));
figure;imshow(abs(rot90(Img0,0)),[0,1.3*max(max(abs(Img0)))]);title('SoS');
WeightingFunctions_standard=zeros(D2,D2,CoilNum);
for s=1:CoilNum
WeightingFunctions_standard(:,:,s)=(Img(:,:,s)./(Img0+eps));
end
figure;imshow(abs(rot90(WeightingFunctions_standard(:,:,1),0)),[]);title('Standard WeightingFunctions for Channel 1');
Here in the code I want to remove the background noise of the "Weightfunctions_standard". I want the background to be completely black. How can I do that?
I will send the drive link of the mat file. It is large file so can't upload it here.
  댓글 수: 1
Image Analyst
Image Analyst 2023년 9월 26일
Please attach 01.mat. Also, what is the point of calling fftshift twice on the blue channel of the image? And why are you rotating the image? Also removing noise doesn't necessarily mean setting the background to zero. Denoising the background just makes is smoother.

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

답변 (1개)

Pratyush Swain
Pratyush Swain 2023년 9월 25일
Hey Gulfam,
I understand you want to eliminate the background noise and make it fully black. I have tried removing background of a sample image as follows:
% Read and show original image
image = imread('horse.png');
imshow(image);
% Convert the image to grayscale
grayImage = rgb2gray(image);
% Apply a threshold to segment the foreground from the background
threshold = 0.25; % Adjust the threshold value as needed
binaryImage = imbinarize(grayImage, threshold);
% Perform morphological operations to remove noise and fill in gaps
se = strel('disk', 3); % Adjust the structuring element size as needed
cleanImage = imopen(binaryImage, se);
cleanImage = imclose(cleanImage, se);
cleanImage = imfill(cleanImage, 'holes');
% Create a mask of the cleaned image
mask = repmat(cleanImage, [1, 1, 3]);
% Convert the image to double
image = double(image);
% Apply the mask to the original image to remove the background
outputImage = image .* mask;
imshow(uint8(outputImage)); % Convert back to uint8 for display
You can refer to the following links for more information.
Hope this helps.

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by