google / ffcc

Fast Fourier Color Constancy: an auto white balance solution with machine learning in Fourier space
https://jonbarron.info/
Apache License 2.0
203 stars 72 forks source link

Consult the problems about the function ChannelizeImage() and preconditioner.F_fft * model_precond.F_fft #16

Open lixiaohui2020 opened 3 years ago

lixiaohui2020 commented 3 years ago

Hi, @jonbarron , thanks for sharing the ffcc project.
I am researching the ffcc project and have met two problems as follows. First, I can not understand why use the MaskedLocalAbsoluteDeviation to compute the im_channels{2}, and i debug the computational process of the im_channel.

function im_channels = ChannelizeImage(im, mask)
% Generate feature images (color and gradient) and combine them into
% different cell channels.

assert(isa(mask, 'logical'));
im_channels = {};

im_channels{1} = cast(bsxfun(@times, double(im), mask), 'like', im);
im_channels{2} = cast(MaskedLocalAbsoluteDeviation(im, mask), 'like', im);
im_channels = ChannelizeImage(im, mask);  %  256*384*3, 256*384*3
......                                   % histrogram feature 
X = Xc ;                                 % 64*64*2
......                                   % get the fourier transformation(F_fft and X_fft) of the model param and X, 
FX_fft = sum(bsxfun(@times, X_fft, F_fft), 3)  

*Second, how to understand the computational preconditioner.F_fft model_precond.F_fft to get the model.F_fft. Why not just use the variable model_precond as model.F_fft. I disconver the values of the variable preconditioner.F_fft are approximate zeros.**

% the computational process of the preconditioner.F_fft  
u_variation_fft = abs(fft2([-1; 1]/sqrt(8), X_sz(1), X_sz(2))).^2;
v_variation_fft = abs(fft2([-1, 1]/sqrt(8), X_sz(1), X_sz(2))).^2;
total_variation_fft = u_variation_fft + v_variation_fft;

% A helper function for applying a scale and shift to a stack of images.
apply_scale_shift = @(x, m, b)bsxfun(@plus, bsxfun(@times, x, permute(m(:), [2,3,1])), permute(b(:), [2,3,1]));

@jonbarron,i will be looking forward to your reply!Thanks!

ToChangeBetter commented 2 years ago

hello!Do you reproduce this paper?