Mercurial > hg > smallbox
annotate util/ksvd utils/add_dc.m @ 113:028599837f1d sup_158_IMG_Processing_toolbox_
Reimplementation of showdict.m function from KSVD toolbox - Image Processing toolbox independent.
author | Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk> |
---|---|
date | Tue, 24 May 2011 15:13:41 +0100 |
parents | c3eca463202d |
children |
rev | line source |
---|---|
idamnjanovic@70 | 1 function x = add_dc(y,dc,columns) |
idamnjanovic@70 | 2 %ADD_DC Add DC channel to signals. |
idamnjanovic@70 | 3 % X = ADD_DC(Y,DC) adds the specified DC value to the (possibly |
idamnjanovic@70 | 4 % multi-dimensional) signal Y, returning the result as X. DC should be a |
idamnjanovic@70 | 5 % scalar value. |
idamnjanovic@70 | 6 % |
idamnjanovic@70 | 7 % X = ADD_DC(Y,DC,'columns') where Y is a 2D matrix and DC is an array of |
idamnjanovic@70 | 8 % length size(Y,2), treats the columns of Y as individual 1D signals, |
idamnjanovic@70 | 9 % adding to each one the corresponding DC value from the DC array. X is |
idamnjanovic@70 | 10 % the same size as Y and contains the resulting signals. |
idamnjanovic@70 | 11 % |
idamnjanovic@70 | 12 % See also REMOVE_DC. |
idamnjanovic@70 | 13 |
idamnjanovic@70 | 14 % Ron Rubinstein |
idamnjanovic@70 | 15 % Computer Science Department |
idamnjanovic@70 | 16 % Technion, Haifa 32000 Israel |
idamnjanovic@70 | 17 % ronrubin@cs |
idamnjanovic@70 | 18 % |
idamnjanovic@70 | 19 % April 2009 |
idamnjanovic@70 | 20 |
idamnjanovic@70 | 21 |
idamnjanovic@70 | 22 if (nargin==3 && strcmpi(columns,'columns')), columns = 1; |
idamnjanovic@70 | 23 else columns = 0; |
idamnjanovic@70 | 24 end |
idamnjanovic@70 | 25 |
idamnjanovic@70 | 26 if (columns) |
idamnjanovic@70 | 27 x = addtocols(y,dc); |
idamnjanovic@70 | 28 else |
idamnjanovic@70 | 29 x = y + dc; |
idamnjanovic@70 | 30 end |
idamnjanovic@70 | 31 |
idamnjanovic@70 | 32 |
idamnjanovic@70 | 33 |