19-1 MATLAB ������������

MATLAB ̱`Bzv榡޼v]Indexed Images^AܦvɡAϥλykpUG

image(X); colormap(map);

䤤 X NvƯx}Amap hOܦvҥݥΨ쪺uLx}v]Colormap Matrix^άOuCӪv C@ӨA K ؤPCALx}ݬO@ K3 x}A䤤C@CN@CAC@CѤTӤզAȥ 0 1AON R]RedA^AG]GreenA^AB]BlueAŦ^qCX Ƚd 1 KANC@ӹ]Pixel^CCyܻAY X (i, j) Ȭ pAh X (i, j) ICܧY map (p, :) ҨMwA䤤 map (p, 1)Amap (p, 2) map (p, 3) ONBŦ⪺qC

Hint
MATLAB {Lx}]CӪ^AаѦҥѲĥ|uTøϡvĤT`uC⪺vC

|ҨӻAMATLAB @ӤتpvAiܦpUG

Example 1: 19-vܻPŪg/image01.mload clown.mat % JpvơAtܼ X M map image(X); % ܼv colormap(map) % ΦLx}

ѩ X O޼vA]̤pȬO 1, ̤jȷ| map Cơ]YuiܤCƥءv^AipUG

Example 2: 19-vܻPŪg/image02.mload clown.mat % JpvơAtܼ X M map fprintf('min(min(X)) = %d\n', min(min(X))); fprintf('max(max(X)) = %d\n', max(max(X))); fprintf('size(map, 1) = %d\n', size(map, 1));min(min(X)) = 1 max(max(X)) = 81 size(map, 1) = 81

ѤWzdҥiApv@t 81 ؤPCC

Taܯ޼vAݦTLx}A_hܥXӪ㹳|H{AHWzpvҡApGΥHüƲͪLx}AhͤUCĪGG

Example 3: 19-vܻPŪg/image03.mload clown newmap = rand(size(map)); image(X); colormap(newmap); colorbar;

pGڭ̪Lx}u K ӾCAO X YǤȤp 1 Τj KApܳoӯx}OH²檺kAON X ̤pഫ 1A̤jন KALȫh̽uYഫ 1 P K ȡAA̦Lx}ܦx}Cഫu@i imagesc OFA|ҦpUG

Example 4: 19-vܻPŪg/imagesc01.mtemp=colormap(gray); newMap=temp(1:6:end, :); X = peaks; colormap(newMap); imagesc(X); colorbar; min(min(X)) % X ̤p max(max(X)) % X ̤j ans = -6.5466 ans = 8.0752

bWҤAM X ̤jȬ 8.0752A̤pȬ -6.5466A imagesc igѫezuഫL{ܼvC㦳WzSʪvƺ٬j׼v]Intensity Images^A@gѼƭȹBⲣͪx}ݦA]i imagesc ܡC

Hint
peaks OiHͤ@ӥWYoAԨѲĥ|uTøϡvC

F޼vαj׼v~Aimage O籵mv]Truecolor Images^CmviHܦ@ mn3 x} XA䤤 X (:, :, 1) N⪺jסCX (:, :, 2) N⪺jסAX (:, :, 3) hNŦ⪺jסCX ȥiHO 0 M 1 BIơAάO 0 M 255 8 줸BaŸơ]uint8AԱаѾ\ĤT`^C|ҨӻG

Example 5: 19-vܻPŪg/image04.m%X = imread('ngc6543a.jpg'); X = imread('annie19980405.jpg'); image(X) size(X) ans = 480 640 3

HWY@imϤAݭnΨLx}C]bWC{XAimread OΨŪJvɪOAԨ̫@`C^

Hint
WϬO̤k|bӤAbܥiRAԤWӡAЦUṲ̄nǡK


MATLAB{]pGJg