summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c19275)
raw | patch | inline | side by side (parent: 5c19275)
author | Manu Mathew <mathmanu@users.noreply.github.com> | |
Mon, 13 Mar 2017 11:32:14 +0000 (17:02 +0530) | ||
committer | Manu Mathew <mathmanu@users.noreply.github.com> | |
Mon, 13 Mar 2017 15:55:29 +0000 (21:25 +0530) |
channels/chnsCellSum.m | patch | blob | history | |
channels/chnsCompute.m | patch | blob | history | |
channels/chnsPyramid.m | patch | blob | history | |
channels/private/gradientFastMex.mexw64 | patch | blob | history | |
channels/private/gradientMex.mexw64 | patch | blob | history | |
channels/processInput.m | [new file with mode: 0644] | patch | blob |
channels/rgbConvert.m | patch | blob | history | |
detector/acfJacintoDemoInria.m | patch | blob | history |
diff --git a/channels/chnsCellSum.m b/channels/chnsCellSum.m
index 421f199be7d7eeeac8d62c0cfeffc3db081e04c4..1ab091fd2fafd5e21e6128c4ed13bf880bbb5fea 100644 (file)
--- a/channels/chnsCellSum.m
+++ b/channels/chnsCellSum.m
function cellSum = chnsCellSum(data, stepSize, cellSize, h, w)
+% Compute cell sum
+% Extension to Piotr's Computer Vision Matlab Toolbox Version 3.30
+% Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
+
if h==0 || w==0,
sz=size(data);
if length(sz)>2, ch=sz(3); else ch=1;end
end
cellSum = chnsCellSumMex(data, stepSize, cellSize, h, w);
end
-
-%function dataCellSum = chnsCellSum(data,stepSize,cellSize,h,w)
-%szData=size(data);
-%szCells=szData; szCells(1)=h; szCells(2)=w;
-%dataCellSum = zeros(szCells);
-%numC=1;if length(szData)>2,numC=szData(3);end
-%for c=1:numC,for i = 1:szCells(1),
-% iStart=((i-1)*stepSize)+1; iEnd=min(iStart+cellSize,szData(1));
-% for j=1:szCells(2),
-% jStart=((j-1)*stepSize)+1; jEnd=min(jStart+cellSize,szData(2));
-% blk=data(iStart:iEnd,jStart:jEnd,c);
-% dataCellSum(i,j,c) = sum(blk(:));
-% end
-%end;end
-%end
\ No newline at end of file
diff --git a/channels/chnsCompute.m b/channels/chnsCompute.m
index 13340febc54e09f67a080fad0d24f74347ec9839..22399578a64b10168d55b6f9aed749209bc7e632 100644 (file)
--- a/channels/chnsCompute.m
+++ b/channels/chnsCompute.m
pChns = getPrmDflt(varargin,{'shrink',4,'pColor',{},'pGradMag',{},...
'pGradHist',{},'pCustom',p,'complete',1,'pFastMode',{}},1);
pChns.pColor = getPrmDflt( pChns.pColor, {'enabled',1,...
- 'smooth',1, 'colorSpace','luv'}, 1 );
+ 'smooth',1, 'colorSpace','luv', 'adapthisteq',0, 'smoothInput',0 }, 1 );
pChns.pGradMag = getPrmDflt( pChns.pGradMag, {'enabled',1,...
'colorChn',0,'normRad',5,'normConst',.005,'full',0}, 1 );
pChns.pGradHist = getPrmDflt( pChns.pGradHist, {'enabled',1,...
if ~pChns.pFastMode.enabled,
% compute color channels
p=pChns.pColor; nm='color channels';
- I=rgbConvert(I,p.colorSpace); I=convTri(I,p.smooth);
+ I=rgbConvert(I,p.colorSpace,p.adapthisteq,p.smoothInput); I=convTri(I,p.smooth);
if(p.enabled), chns=addChn(chns,I,nm,p,'replicate',h,w); end
% compute gradient magnitude channel
% compute color channels
p=pChns.pColor; nm1='color channels';
- I=rgbConvert(I,p.colorSpace); I=convTri(I,p.smooth);
+ I=rgbConvert(I,p.colorSpace, p.adapthisteq,p.smoothInput);
+ I=convTri(I,p.smooth);
if ~isempty(I), I0 = I(:,:,1); else I0=I; end
% compute gradient magnitude channel
p=pChns.pGradHist; nm3='gradient histogram';
if( pChns.pGradHist.enabled )
binSize=p.binSize; if(isempty(binSize)), binSize=shrink; end
- H=gradientHistFast(M,Gx,Gy,p.nOrients, 1);
+ H=gradientHistFast(M,Gx,Gy,p.nOrients,1);
cellSumH=chnsCellSum(H, binSize,cellSize,h,w);
chns=addChn(chns,cellSumH,nm3,pChns.pGradHist,0,h,w);
end
diff --git a/channels/chnsPyramid.m b/channels/chnsPyramid.m
index 2c83bf79c20d0b85c3e3d83da91a3960c388db8f..8d78d636cb78d94d4cffc131d9c99ff9f9011f4b 100644 (file)
--- a/channels/chnsPyramid.m
+++ b/channels/chnsPyramid.m
if( ~isfield(p,'complete') || p.complete~=1 || isempty(I) )
dfs={ 'pChns',{}, 'nPerOct',8, 'nOctUp',0, 'nApprox',-1, ...
'lambdas',[], 'pad',[0 0], 'minDs',[16 16], ...
- 'smooth',1, 'concat',1, 'complete',1 };
+ 'smooth',1, 'concat',1, 'complete',1};
p=getPrmDflt(varargin,dfs,1); chns=chnsCompute([],p.pChns);
p.pChns=chns.pChns; p.pChns.complete=1; shrink=p.pChns.shrink;
p.pad=round(p.pad/shrink)*shrink; p.minDs=max(p.minDs,shrink*4);
cs=pChns.pColor.colorSpace; sz=[size(I,1) size(I,2)];
if(~all(sz==0) && size(I,3)==1 && ~any(strcmpi(cs,{'gray','orig'}))),
I=I(:,:,[1 1 1]); warning('Converting image to color'); end %#ok<WNTAG>
-I=rgbConvert(I,cs); pChns.pColor.colorSpace='orig';
+I=rgbConvert(I,cs,pChns.pColor.adapthisteq,pChns.pColor.smoothInput);
+pChns.pColor.colorSpace='orig';
% get scales at which to compute features and list of real/approx scales
[scales,scaleshw]=getScales(nPerOct,nOctUp,minDs,shrink,sz);
index 8a052acc2dfa820f478f8fc5e37b18383a74d1be..fb9176d6b836fcf7b57981cbdc0cb10750c6dbd1 100644 (file)
Binary files a/channels/private/gradientFastMex.mexw64 and b/channels/private/gradientFastMex.mexw64 differ
Binary files a/channels/private/gradientFastMex.mexw64 and b/channels/private/gradientFastMex.mexw64 differ
index c8e767a413656aa17c402be8071c5ee16ed9866e..6d2958b033b0f854b535ca6ff22b795ea3003f4f 100644 (file)
Binary files a/channels/private/gradientMex.mexw64 and b/channels/private/gradientMex.mexw64 differ
Binary files a/channels/private/gradientMex.mexw64 and b/channels/private/gradientMex.mexw64 differ
diff --git a/channels/processInput.m b/channels/processInput.m
--- /dev/null
+++ b/channels/processInput.m
@@ -0,0 +1,23 @@
+function I = processInput(I, colorSpace, adapthisteqFlag, smoothInput)
+% Pre-process input
+% Extension to Piotr's Computer Vision Matlab Toolbox Version 3.30
+% Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
+
+if (~strcmp(colorSpace, 'orig')) && (~isempty(I))
+ if adapthisteqFlag && ~isempty(I),
+ if strcmp(colorSpace, 'yuv8')
+ I(:,:,1)=adapthisteq(I(:,:,1)/255.0,'ClipLimit',2.0/255.0)*255.0;
+ elseif strcmp(colorSpace, 'yuv')
+ I(:,:,1)=adapthisteq(I(:,:,1),'ClipLimit',2.0/255.0);
+ else
+ I=adapthisteq(I,'ClipLimit',2.0/255.0);
+ end
+ end
+
+ if smoothInput,
+ I=convTri(I,smoothInput);
+ end
+end
+
+end
+
diff --git a/channels/rgbConvert.m b/channels/rgbConvert.m
index dd0aaa1b8051e0d5eae83ca0c6a6df515d2ed0a5..50bdd97b4abffd25e4cbce75de5785eb53a55288 100644 (file)
--- a/channels/rgbConvert.m
+++ b/channels/rgbConvert.m
-function J = rgbConvert( I, colorSpace, useSingle )
+function J = rgbConvert( I, colorSpace, adapthisteqFlag, smoothInput, useSingle)
% Convert RGB image to other color spaces (highly optimized).
%
% If colorSpace=='gray' transforms I to grayscale. The output is within
% Copyright 2014 Piotr Dollar & Ron Appel. [pdollar-at-gmail.com]
% Licensed under the Simplified BSD License [see external/bsd.txt]
-if(nargin<3 || isempty(useSingle)), useSingle=true; end
+if(nargin<5 || isempty(useSingle)), useSingle=true; end
flag = find(strcmpi(colorSpace,{'gray','rgb','luv','hsv','orig','yuv','yuv8'}))-1;
if(isempty(flag)), error('unknown colorSpace: %s',colorSpace); end
if(useSingle), outClass='single'; else outClass='double'; end
if(isa(I,'uint8') && flag~=6),scale=1.0/256;
elseif(~isa(I,'uint8') && flag==6),scale=256.0;
end;
- J=single(J)*scale; return;
+ J=single(J)*scale;
end;
+else
+ J=rgbConvertMex(I,flag,useSingle);
+end
+
+if (~isempty(J)) && (~strcmp(colorSpace,'orig')) && (adapthisteqFlag||smoothInput)
+ J=processInput(J, colorSpace, adapthisteqFlag, smoothInput);
end
-J=rgbConvertMex(I,flag,useSingle);
index 59ec1e9aa6664b7eeb0ec79febecea9a99f7bf6b..c9f0c2aa110efe24f1a53119545c42b957f19b16 100644 (file)
%set eval range - optional
opts.pLoad = [opts.pLoad 'hRng',[opts.modelDs(1) inf], 'wRng',[opts.modelDs(2) inf] ];
opts.name='models/AcfJacintoInria';
-opts.pPyramid.pChns.pFastMode.enabled=1; %default: 0
-if opts.pPyramid.pChns.pFastMode.enabled,
- opts.pPyramid.smooth=0; %default: 1
- opts.pPyramid.pChns.pColor.colorSpace='yuv8';%default: luv
- opts.pPyramid.pChns.pColor.smooth=0; %default: 1, 0 seems much better in jacinto config
- opts.pPyramid.pChns.pGradMag.normRad=0; %default: 5, 0 is okay
- %opts.pPyramid.pChns.pGradMag.full=0; %default: 0, 0 is better than 1
- %opts.pPyramid.pChns.pGradHist.binSize=8; %doesn't work
- opts.pPyramid.pChns.pGradHist.softBin=-2; %default: 0(spatial soft bin), -2: no soft bin, other, trilinear soft bin (best quality: -1)
- %opts.pPyramid.pChns.pGradHist.useHog=0; %already set
+opts.pPyramid.pChns.pFastMode.enabled=1; %default: 0
+
+if opts.pPyramid.pChns.pFastMode.enabled,
+ opts.pPyramid.smooth=0; %default: 1
+
+ opts.pPyramid.pChns.pColor.smoothInput=0; %default: 0
+ opts.pPyramid.pChns.pColor.adapthisteq=0; %default: 0
+
+ opts.pPyramid.pChns.pColor.colorSpace='yuv8'; %default: luv
+ opts.pPyramid.pChns.pColor.smooth=0; %default: 1, 0 seems much better in jacinto config
+ opts.pPyramid.pChns.pGradMag.normRad=0; %default: 5, 0 is okay
+ %opts.pPyramid.pChns.pGradMag.full=0; %default: 0, 0 is better than 1
+ %opts.pPyramid.pChns.pGradHist.binSize=8; %doesn't work
+ opts.pPyramid.pChns.pGradHist.softBin=-2; %default: 0(spatial soft bin), -2: no soft bin, other, trilinear soft bin (best quality: -1)
+ %opts.pPyramid.pChns.pGradHist.useHog=0; %already set
+
show=2;%2 or 0
end