我继续得到矩阵大小错误,因为'lin_bayer'是三维,而'mask'是两个维度。我正在考虑填充“掩码”以解决这个问题。我能想到的另一个解决方案是通过将RGB值设置为彼此相等来制作我自己的手动白平衡矩阵。您如何看待这两种解决方案?有什么建议吗?
wb_multipliers = [2.124023, 1, 1.558594];
xyz2cam = [ 6444 -904 -893;
-4563 12308 2535;
-903 2016 6728]/10000;
% - - - Read image into MATLAB - - -
raw = single(imread(filename));
% - - - Linearize - - -
lin_bayer = (raw-black)/(saturation-black);
lin_bayer = max(0,min(lin_bayer,1));
clear raw
% - - - White Balance - - -
mask = wbmask(size(lin_bayer,1),size(lin_bayer,2),...
wb_multipliers,'rggb');
balanced_bayer = lin_bayer .* mask;
clear lin_bayer mask