source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vlutil/toolbox/histmarg.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.4 KB
Line 
1function H = histmarg(H, dims)
2% HISTMARG  Marginal of histogram
3%  H = HISTMARG(H, DIMS) marginalizes the historgram HISTMARG w.r.t
4%  the dimensions DIM. This is done by summing out all dimensions
5%  not listed in DIM and deleting them.
6%
7%  REMARK. If DIMS lists only one dimension, the returned H is a
8%  column vector. This way of deleting dimensions is not always
9%  consistent with the SQUEEZE function.
10
11% AUTORIGHTS
12% Copyright (C) 2006 Andrea Vedaldi
13%       
14% This file is part of VLUtil.
15%
16% VLUtil is free software; you can redistribute it and/or modify
17% it under the terms of the GNU General Public License as published by
18% the Free Software Foundation; either version 2, or (at your option)
19% any later version.
20%
21% This program is distributed in the hope that it will be useful,
22% but WITHOUT ANY WARRANTY; without even the implied warranty of
23% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24% GNU General Public License for more details.
25%
26% You should have received a copy of the GNU General Public License
27% along with this program; if not, write to the Free Software Foundation,
28% Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
30sz = size(H) ;
31
32for d=setdiff( 1:length(sz), dims(:) )
33  H = sum(H, d) ;
34end
35
36% Squeeze out marginalized dimensions
37sz = sz(dims(:)) ;
38sz = [sz ones(1,2-length(dims(:)))] ;
39H = reshape(H, sz) ;
Note: See TracBrowser for help on using the repository browser.