function [videoscale] = convertUint8(video) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Converts a video to uint8 by linearly scaling the values of the pixels to %map onto values 0-255 % Inputs: % - video: the MxNxF matrix of the video % Output: % - videoscale: The video scaled to uint8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [d1 d2 d3] = size(video); minvid = min(video(:)); maxvid = max(video(:)); for fn = 1:d3 videoscale(:, :, fn) = uint8(floor(((video(:, :, fn)-minvid)./(maxvid-minvid))*2^8-1)); end end