Skip to content
Snippets Groups Projects
Commit c2546bf7 authored by ac_fx's avatar ac_fx
Browse files

SSF.quantize8 -> [1,255]

parent 82cc7bd5
Branches
No related tags found
No related merge requests found
% clipLimits = [minVal,maxVal]; % clipLimits = [minVal,maxVal];
function [im, clipLimits] = quantize8(im_in,clipLimits) function [im, clipLimits] = quantize8(im_in,clipLimits)
im = im_in;
if isa(im,'uint8') if isa(im,'uint8')
return return
end end
im = im_in;
for c = 1:size(im,4) for c = 1:size(im,4)
im(:,:,:,c) = max(im(:,:,:,c),clipLimits(c,1)); im(:,:,:,c) = max(im(:,:,:,c),clipLimits(c,1));
im(:,:,:,c) = min(im(:,:,:,c),clipLimits(c,2)); im(:,:,:,c) = min(im(:,:,:,c),clipLimits(c,2));
im(:,:,:,c) = (im(:,:,:,c) - clipLimits(c,1)) ./ (clipLimits(c,2) - clipLimits(c,1)); im(:,:,:,c) = (im(:,:,:,c) - clipLimits(c,1)) ./ (clipLimits(c,2) - clipLimits(c,1));
end end
im = im2uint8(im); im = im2uint8(im);
im = max(im,1);
im(0 == im_in) = 0; im(0 == im_in) = 0;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment