Last active
August 29, 2015 14:09
-
-
Save smithdanielle/808ac27e4381af590ce5 to your computer and use it in GitHub Desktop.
MATLAB function for normalising an image matrix between [X;Y]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function normalised = normaliseXY(array, x, y) | |
% Normalize to [0, 1]: | |
m = min(array(:)); | |
range = max(array(:)) - m; | |
array = (array - m) ./ range; | |
% Then scale to [x,y]: | |
rangeXY = y - x; | |
normalised = (array*rangeXY) + x; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment