2017-03-28 37 views
0

我從圖像中分離出高頻(HF)分量和低頻(LF)分量。在這一步之後,我對HF和LF應用了一些去噪技術。之後我想將它們結合在一起。我怎麼能這樣做?如何將圖像的HF和LF組件組合起來?

我用下面的代碼進行分解

%// Load an image 
Orig = double(rgb2gray(imread('lena.jpg'))); 
O=ROFdenoise(Orig, 12); 
O=uint8(O); 
figure, imshow(O) 
%// Transform 
Orig_T = dct2(Orig); 
%// Split between high - and low-frequency in the spectrum (*) 
cutoff = round(0.5 * 226); 
High_T = fliplr(tril(fliplr(Orig_T), cutoff)); 
Low_T = Orig_T - High_T; 
%// Transform back 
High = idct2(High_T); 

Low = idct2(Low_T); 
+1

'Low_T = Orig_T - High_T;'將它們分開。在這個等式中求解'Orig_T'來重新加入它們。或者你在尋找其他你沒有解釋的東西? –

+0

你能展示更多的代碼嗎?你使用了什麼分解方法? – Royi

+0

我添加了上面的代碼 –

回答

1

我註釋掉ROFdenoise,因爲我不知道它做什麼。如果你已經在頻域中分割了你的圖像,你也想把它重新組合在一起。也;我添加了一些繪圖,以便更容易地看到發生了什麼。

%// Load an image 
Orig = double(rgb2gray(imread('Lenna.png'))); 
%O=ROFdenoise(Orig, 12); 
O=Orig; % No denoising before DCT 
O=uint8(O); 

figure(1), subplot(2,2,1), imshow(O), title('Before') 
%// Discrete Cosine Transform 
T = dct2(Orig); 
%// Split between high - and low-frequency in the spectrum (*) 
cutoff = round(0.5 * 226); 
highT = fliplr(tril(fliplr(T), cutoff)); 
lowT = T - highT; 
%//Do some denoising 
highT = 0*highT; 
subplot(2,2,2), imshow(highT), title('High T') 
subplot(2,2,4), imshow(lowT), title('Low T') 
%// Combine back 
denoiseT = highT + lowT; 
%// Transform back 
denoiseO = uint8(idct2(denoiseT)); 
subplot(2,2,3), imshow(denoiseO), title('After') 

也;這裏是Lenna

相關問題