ʵÑéÒ»MatlabͼÏñ´¦Àí»ù´¡¼°Í¼Ïñ»Ò¶È±ä»» ÏÂÔØ±¾ÎÄ

ÄÚÈÝ·¢²¼¸üÐÂʱ¼ä : 2025/9/14 9:24:33ÐÇÆÚÒ» ÏÂÃæÊÇÎÄÕµÄÈ«²¿ÄÚÈÝÇëÈÏÕæÔĶÁ¡£

ʵÑéÒ» MatlabͼÏñ´¦Àí»ù´¡¼°Í¼Ïñ»Ò¶È±ä»»

Ò»¡¢ ʵÑéÄ¿µÄ

Á˽âMatlabƽ̨ϵÄͼÏñ±à³Ì»·¾³£¬ÊìϤMatlabÖеÄDIP (Digital Image Processing)¹¤¾ßÏ䣻կÎÕMatlabÖÐͼÏñµÄ±íʾ·½·¨£¬Í¼ÏñÀàÐÍ¡¢Êý¾ÝÀàÐ͵ÄÖÖÀ༰¸÷×ÔµÄÌØµã£¬²¢ÖªµÀÔõÑùÔÚËüÃÇÖ®¼ä½øÐÐת»»¡£ÕÆÎÕMatlab»·¾³ÏµÄһЩ×î»ù±¾µÄͼÏñ´¦Àí²Ù×÷£¬Èç¶ÁͼÏñ¡¢Ð´Í¼Ïñ¡¢²é¿´Í¼ÏñÐÅÏ¢ºÍ¸ñʽ¡¢³ß´çºÍ»Ò¶ÈµÄÉìËõµÈµÈ£»Í¨¹ýʵÑéÕÆÎÕͼÏñÖ±·½Í¼µÄÃè»æ·½·¨£¬¼ÓÉîÖ±·½Í¼ÐÎ×´ÓëͼÏñÌØÕ÷¼ä¹ØÏµ¼äµÄÀí½â£»¼ÓÉî¶ÔÖ±·½Í¼¾ùºâËã·¨µÄÀí½â¡£

¶þ¡¢ ʵÑéÄÚÈÝ

1£® ´ÓÓ²ÅÌÖжÁȡһ·ù»Ò¶ÈͼÏñ£»

2£® ÏÔʾͼÏñÐÅÏ¢£¬²é¿´Í¼Ïñ¸ñʽ¡¢´óС¡¢Î»ÉîµÈÄÚÈÝ£» 3£® ÓûҶÈÃæ»ý·¨±àдÇóͼÏñ·½Í¼µÄMatlab³ÌÐò£¬²¢»­Í¼£»

4£® °ÑµÚ3²½µÄ½á¹ûÓëÖ±½ÓÓÃMatlab¹¤¾ßÏäÖк¯ÊýhistogramµÄ½á¹û½øÐбȽϣ¬ÒÔºâÁ¿µÚ3²½ÖгÌÐòµÄÕýÈ·ÐÔ¡£

5£® ¶Ô¶ÁÈëµÄͼÏñ½øÐÐÖ±·½Í¼¾ùºâ»¯£¬»­³ö´¦ÀíºóµÄÖ±·½Í¼£¬²¢±È½Ï´¦ÀíǰºóͼÏñЧ¹ûµÄ±ä»¯¡£

Èý¡¢ ֪ʶҪµã

1. Matlab6.5Ö§³ÖµÄͼÏñͼÐθñʽ

TIFF, JEPG, GIF, BMP, PNG, XWD (X Window Dump)£¬ÆäÖÐGIF²»Ö§³Öд¡£ 2. ÓëͼÏñ´¦ÀíÏà¹ØµÄ×î»ù±¾º¯Êý

¶Á£ºimread; д£ºimwrite; ÏÔʾ£ºimshow; ÐÅÏ¢²é¿´£ºimfinfo; 3. Matlab6.5Ö§³ÖµÄÊý¾ÝÀà

double, unit8, int8, uint16, int16, uint32, int32, single, char (2 bytes per element), logical. 4. Matlab6.5Ö§³ÖµÄͼÏñÀàÐÍ

Intensity images, binary images, indexed images, RGB image 5. Êý¾ÝÀ༰ͼÏñÀàÐͼäµÄ»ù±¾×ª»»º¯Êý

Êý¾ÝÀàת»»£ºB = data_class_name(A); IPTͼÏñÊý¾ÝÀàÐÍת»»º¯Êý£º º¯ÊýÃû im2uint8 Êä³öͼÏñÊý¾ÝÀàÐÍ uint8 ÊäÈëͼÏñÊý¾ÝÀàÐÍ logical, uint8, uint16, double im2uint16 mat2gray im2doule im2bw uint16 double([0, 1]) double logical logical, uint8, uint16, double double logical, uint8, uint16, double logical, uint8, uint16, double ËÄ¡¢ ²Î¿¼³ÌÐòºÍ²Î¿¼½á¹û

1£®Çó»Ò¶ÈÖ±·½Í¼

=====================================================================

% Experiment 1: calculate the histogram of gray-scale through gray-scale area % function

f=imread('J:\\ebook and code_ex\\image processing\\digital image process2_Woods\\DIP using Matlab\\image database\\dipum_images_ch02\\dipum_images_ch02\\Fig0206(a)(rose-original).tif'); [m,n]=size(f);

gray_area=zeros(1,256);

% compute the area under certain gray level for k=0:255

ind = find(f == k);

gray_area(k+1) = length(ind); end

% compute the histogram by performing the difference for gray_area hist=zeros(1,256); for k=0:254

hist(k+1)=gray_area(k+2)-gray_area(k+1); end

% normalization hist=hist/numel(f); subplot(121); imshow(f);

subplot(122);stem([1:1:256],hist,'.'); axis([1 256 0 max(hist)]);

===============================================================================

0.090.080.070.060.050.040.030.020.01050100150200250 2. Ö±·½Í¼¾ùºâ»¯

f = imread('Fig0308(a)(pollen).tif'); subplot(221); imshow(f); title('the orignal image'); subplot(222); imhist(f); ylim('auto');

g = histeq(f, 256);

subplot(223); imshow(g);

title('image after equalization'); subplot(224); imhist(g); ylim('auto');

the orignal image2x 1041.510.50050100150200250image after equalization2x 1041.510.50050100150200250