Phụ lục
316
if isrgb(a)
if isa(a(:,:,1),'uint8')
red = double(a(:,:,1));
green = double(a(:,:,2));
blue = double(a(:,:,3));
[u,s,v] = svds(red, singvals);
imred = uint8(u * s * transpose(v));
[u,s,v] = svds(green, singvals);
imgreen = uint8(u * s * transpose(v));
[u,s,v] = svds(blue, singvals);
imblue = uint8(u * s * transpose(v));
im(:,:,1) = imred;
im(:,:,2) = imgreen;
im(:,:,3) = imblue;
imwrite(im, outfile);
figure('Name','Output image');
imshow(im);
return;
end
if isa(a(:,:,1),'uint16')
red = double(a(:,:,1));
green = double(a(:,:,2));
blue = double(a(:,:,3));
[u,s,v] = svds(red, singvals);
imred = uint16(u * s * transpose(v));
[u,s,v] = svds(green, singvals);
imgreen = uint16(u * s * transpose(v));
[u,s,v] = svds(blue, singvals);
imblue = uint16(u * s * transpose(v));
im(:,:,1) = imred;
im(:,:,2) = imgreen;
im(:,:,3) = imblue;
imwrite(im, outfile);
figure('Name','Output image');
imshow(im);
return;
end
if isa(a(:,:,1),'double')
red = double(a(:,:,1));
green = double(a(:,:,2));