การซ้อนภาพเพื่อลดสัญญาณรบกวนโดยใช้ MATLAB

ฉันเพิ่งเริ่มใช้การประมวลผลภาพและเริ่มใช้ MATLAB สำหรับการประมวลผลการถ่ายภาพดาราศาสตร์ ฉันกำลังพยายามประมวลผลภาพที่เสียหาย 10 ภาพ (ภาพเดียวกันแต่ผสมกับจุดรบกวนต่างกัน) ของดาวเคราะห์ดาวเสาร์โดยใช้ MATLAB ฉันได้เรียนรู้ว่าการซ้อนภาพทั้ง 10 ภาพเข้าด้วยกันจะทำให้ภาพมีสัญญาณรบกวนน้อยลงและมี PSNR สูง และลองใช้โค้ดด้านล่างนี้เพื่อให้ใช้งานได้

แต่เอาต์พุตดูเหมือนภาพที่อิ่มตัวไม่ชัดเจนและไม่มีการลดสัญญาณรบกวน

ป้อนคำอธิบายรูปภาพที่นี่

คุณช่วยดูรหัสด้านล่างและแสดงให้ฉันเห็นว่าฉันผิดตรงไหน?

%% We are going to stack the 10 corrupted images and finally calculate the PSNR SSIM
clearvars;% Clear all the variables
close all;

load('planetdata.mat'); %to load the corrupted Image set (4-D uint8)
Clean = imread('Clean Image of Saturn.jpg');%Clean Image of Saturn.600x800x3 uint8
planet1(: , :, :)   = planetdata(1, :, :, :);%One corrupted Image as reff

% Set the number of images to stack is 10
stack_number = 10;

% Lets use Clean image as reference of dimensions required
im_x = size(Clean, 1);
im_y = size(Clean, 2);
im_z = size(Clean, 3);

% Lets Generate a blank image for image stacking
resultIM = uint8(zeros(im_x, im_y, im_z));

% Iterate through the images to stack
for i = 1:1:stack_number

% Read in the target object image
 CorruptIM(: , :, :)   = planetdata(i, :, :, :);

% Perform image stacking using the target object image
 resultIM = resultIM + CorruptIM;

end

% resultIM = resultIM / stack_number; 

%% Lets Display Results
workspace;  % to Make sure the work space panel is showing.
fontSize = 15;
figure;
subplot(1, 3, 1);
imshow(Clean);
title('Clean Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Position', get(0,'Screensize')); 
% Give a name to the title bar.
set(gcf,'name','Stacking','numbertitle','off')

% Display one corrupt image as reference
subplot(1, 3, 2);
imshow(planet1);
title('Corrupt Image 1 : Ref', 'FontSize', fontSize);

% Display Stacked image
subplot(1, 3, 3);
imshow(resultIM);
title('Stacked Image', 'FontSize', fontSize);

%% PSNR AND SSIM Calculation
%Lets Find PSNR for For Resultant Image

[row,col]   = size(Clean);
size_host   = row*col;
o_double    = double(Clean);
w_double    = double(resultIM);

s=0;
for j = 1:size_host % the size of the original image

s = s+(w_double(j) - o_double(j))^2 ; 
end

mes     =s/size_host;
psnr    =10*log10((255)^2/mes);
fprintf('The PSNR value for Stacked Image is %0.4f.\n',psnr);


%Lets Find SSIM for resultant Image
[ssimval, ssimmap] = ssim(uint8(resultIM),Clean);
fprintf('The SSIM value for Stacked Image is %0.4f.\n',ssimval);

person ncbdrck    schedule 08.05.2017    source แหล่งที่มา


คำตอบ (1)


ฉันคิดว่าข้อความเดียวนี้บอกได้ทุกอย่าง (เน้นของฉัน):

แต่เอาต์พุตดูเหมือนภาพ อิ่มตัว ไม่ชัดเจน และไม่มีการลดจุดรบกวน

ดูเหมือนว่ารูปภาพของคุณกำลังอิ่มตัวที่ขีดจำกัดบนสำหรับ uint8 ซึ่งเป็นประเภทข้อมูลสำหรับรูปภาพผลลัพธ์ resultIM และเมทริกซ์ข้อมูลของคุณ planetdata เมื่อคุณเพิ่มรูปภาพไปเรื่อยๆ ค่าพิกเซลจะอิ่มตัวที่ค่าสูงสุด 255 สำหรับประเภทจำนวนเต็ม 8 บิตที่ไม่ได้ลงนาม

สิ่งที่คุณต้องทำคือแปลงเป็นประเภทข้อมูลที่ใหญ่ขึ้นสำหรับการคำนวณขั้นกลาง เช่น ประเภทจำนวนเต็ม หรือ floating ประเภทจุด จากนั้น เมื่อการคำนวณของคุณเสร็จสิ้น (เช่น หารผลรวมด้วยขนาดกลุ่มรูปภาพเพื่อให้ได้ภาพโดยเฉลี่ย) คุณสามารถปรับขนาดและ/หรือปัดเศษข้อมูลของคุณได้ตามต้องการ และแปลงกลับเป็นประเภท uint8

person gnovice    schedule 08.05.2017
comment
ขอบคุณสำหรับคำแนะนำ. ฉันเปลี่ยนพวกมันเป็นสองเท่าและเปลี่ยนกลับเป็น uint8 ฉันได้รับผลลัพธ์ที่ดี - person ncbdrck; 08.05.2017