How can I remove the background noise of this image from the mat file?
3 次查看(过去 30 天)
显示 更早的评论
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
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
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1492897/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1492902/image.png)
You can refer to the following links for more information.
Hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!