Skip to content

Instantly share code, notes, and snippets.

@bmiles
Created July 17, 2014 11:38
Show Gist options
  • Save bmiles/ab3804be20d22e66a93e to your computer and use it in GitHub Desktop.
Save bmiles/ab3804be20d22e66a93e to your computer and use it in GitHub Desktop.
rebinning a matrix
b = a; #original image
[L W] = size(a); % get dimensions of matrix
% define bin factor
BinW = 8;
BinL = 8;
% chaning the size of matrix b, to binL by ?? then adding 1
b=sum(reshape(b,BinL,[]) ,1 );
% changing the size of the matrix b to be binned length by ?? then (.')?
b=reshape(b,L/BinL,[]).';
b=sum( reshape(b,BinW,[]) ,1);
b=reshape(b,W/BinW,[]).';
@bmiles
Copy link
Author

bmiles commented Jul 17, 2014

Unsure of the meaning of

[]

and

.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment