I am trying to build a function that denoises every channel of an image using DCT, and outputs the clean channel. My function so far:
function denoised_ch = sliding_dct(channel, variance)
% choose window size as 8x8
fun1 = @(block_struct) dct2(block_struct.data(:));
dct_ch = blockproc(channel, [8 8], fun1);
[r, c] = size(dct_ch);
% threshold the DCT coeff with threshold = 3xvariance of the channel
fun2 = @(block_struct) idct2(block_struct.data(:));
denoised_ch = blockproc(channel, [8 8], fun2);
How can I implemement the part about thresholding? (The commented part)