|
a |
|
b/util/adjustFormat.m |
|
|
1 |
function [imagesCellTrain, meanAll, imageSize] = adjustFormat(imagesCellTrain) |
|
|
2 |
|
|
|
3 |
% %compute image size |
|
|
4 |
% %image size must be a power of 2 |
|
|
5 |
% im = imagesCellTrain{1}; |
|
|
6 |
% closPow2 = pow2(floor(log2(size(im,1)))); |
|
|
7 |
% imageSize = [closPow2 closPow2]; |
|
|
8 |
|
|
|
9 |
meanAll = zeros(numel(imagesCellTrain), 1); |
|
|
10 |
|
|
|
11 |
for i = 1 : numel(imagesCellTrain) |
|
|
12 |
|
|
|
13 |
%load |
|
|
14 |
im = imagesCellTrain{i}; |
|
|
15 |
|
|
|
16 |
%cast |
|
|
17 |
%im = double(im); |
|
|
18 |
|
|
|
19 |
%mean |
|
|
20 |
meanAll(i) = mean2(im); |
|
|
21 |
|
|
|
22 |
%subtract mean |
|
|
23 |
im = im - meanAll(i); |
|
|
24 |
|
|
|
25 |
%assign |
|
|
26 |
imagesCellTrain{i} = im; |
|
|
27 |
|
|
|
28 |
end %for i = 1 : numel(imagesCellTrain) |