Skip to content

Instantly share code, notes, and snippets.

@tonyfast
Created October 8, 2014 20:03
Show Gist options
  • Select an option

  • Save tonyfast/8a2bb4752e0cfc55c99f to your computer and use it in GitHub Desktop.

Select an option

Save tonyfast/8a2bb4752e0cfc55c99f to your computer and use it in GitHub Desktop.
ImAdjust and Normalize N-D Images in Matlab
normalize = @(A)( A-min(A(:)) ) ./ ( max(A(:)) - min(A(:)) )
adjust = @(A)reshape( ... back to original shape
imadjust( ... adjust image
reshape( ... flatten to 2-D image
normalize(A), ... normalize from zero to one
size(A,1), numel(A)./size(A,1))), ... Reshape to 2-D array
size(A) ... Reshape back to original size
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment