hw12_stretch

hw12_stretch - pmin = double(pmin); % ---- Calculation...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function[new_vector]=hwk12_stretch(A,pmin,pmax) %This function stretches an image. % INPUT ARGUMENTS: A - image array % pmin - minimum pixel intensity % pmax - maximum pixel intensity % OUTPUT ARGUMENTS: new_vector - vector with values stretched to a range of 0 to 255. % % ---- Input Section ---- [r,c] = size(A); A = double(A); pmax = double(pmax);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pmin = double(pmin); % ---- Calculation Section ----for x=1:r for y=1:c if A(x,y) < pmin temp_vector(x,y) = pmin; elseif A(x,y) > pmax temp_vector(x,y) = pmax; else temp_vector(x,y) = A(x,y); end end end % ---- Output Section ---- new_vector = uint8(round(temp_vector-pmin)*(255/(pmax-pmin)))...
View Full Document

Ask a homework question - tutors are online