-
Notifications
You must be signed in to change notification settings - Fork 9
/
patch2feat.m
23 lines (23 loc) · 916 Bytes
/
patch2feat.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function res=patch2feat(trpatches,conf)
global ds;
extrparams=ds.conf.params;
%extrparams.imageCanonicalSize=[max(min(size(trpatches{1}(:,:,1))),min(extrparams.patchCanonicalSize))];
extrparams.basePatchSize=size(trpatches{1}(:,:,1));
tmp=constructFeaturePyramidForImg(im2double(trpatches{1}),extrparams,1);
%res(1,:)=tmp.features{1}(:)';
if(isfield(ds.conf.params,'padcells'))
pc=ds.conf.params.padcells;
else
pc=1;
end
pcs=round(ds.conf.params.patchCanonicalSize/ds.conf.params.sBins)-2*pc;
[res(1,:), levels, indexes,gradsums] = unentanglePyramid(tmp, ...
pcs,conf);
res(2:numel(trpatches),:)=0;%=zeros(numel(trpatches),numel(tmp.features{1}));
for(i=2:numel(trpatches))
tmp=constructFeaturePyramidForImg(im2double(trpatches{i}),extrparams,1);
%res(i,:)=tmp.features{1}(:)';
[res(i,:), levels, indexes,gradsums] = unentanglePyramid(tmp, ...
pcs,conf);
end
end