www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱matlab程序源码 > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I2_00f_coins_rice.m
% 夋憸偐傜偍暷偺柺愊傗悢傪媮傔傞 % 弶婜壔 clear; clc, close all, imtool close all; % 堦峴偯偮弴斣偵幚峴 %% 夋憸偺2抣壔張棟 %%%%% I = imread('coins.png'); % 僼傽僀儖偐傜夋憸撉崬傒 (曄悢I傊) figure; imshow(I); % Window傪嶌惉偟丄夋憸偺昞帵 figure; imhist(I); % 僸僗僩僌儔儉昞帵 I2 = I > 100; % 戝彫斾妑墘嶼偵傛傞夋憸偺擇抣壔 figure; imshow(I2); I3 = imfill(I2, 'holes'); % 寠偺揾傝偮傇偟 figure; imshow(I3); %% 暿偺2抣壔張棟偲丄"埵抲"傗丄"柺愊"偺暯嬒偺嶼弌 %%%%% clear all; clc, close all, imtool close all; I = imread('rice.png'); % 僼傽僀儖偐傜夋憸撉崬傒 figure; imshow(I); % 夋憸偺昞帵 figure; imhist(I); % 僸僗僩僌儔儉昞帵 %% a = 79; imshow(I>a);shg; % 懳榖揑偵揔愗側鑷抣偺扵嶕 %% figure; imshow(I>150); figure; surf(double(I));shading interp; % 昞柺僾儘僢僩 % 昞帵傪傒傗偡偔 Ierode=imerode(I, ones(15)); % 廂弅張棟偵傛傞暷棻偺徚嫀 figure;imshow(Ierode); figure; ... surf(double(Ierode),'EdgeColor','none');% 攚宨昞柺僾儘僢僩 I2 = I-Ierode; % 攚宨偺彍嫀 figure; surf(double(I2));shading interp; % 昞柺僾儘僢僩 figure; imtool(I2); % imtool偱僸僗僩僌儔儉妋擣 Ibw = I2 > 50; figure; imshow(Ibw); Ibw=bwareaopen(Ibw, 4); % 嵶偐側僲僀僘偺彍嫀 figure; imshow(Ibw); Iclr=imclearborder(Ibw); % 愗傟偰偄傞(奜廃愙怗)暷偺彍嫀 figure; imshow(Iclr); stat=regionprops('table', Ibw, 'Area', 'Centroid') % struct/table, 柺愊丄[x嵗昗, y嵗昗] A=[stat.Area] % 媮傑偭偨奺柺愊 mean(A) % 柺愊偺暯嬒 hist(A); % 傕偟偔偼A傪儚乕僋僗儁乕僗偱慖戰屻丄 % 僣乕儖僗僩儕僢僾偺hist慖戰 title('柺愊暘晍', 'FontSize',16); %% 廔椆 %% Copyright 2013 The MathWorks, Inc. % This is a demo for thresholding, morphological image processing, blob analysis % % Original version can be found by the following command % web([docroot '/images/examples/correcting-nonuniform-illumination.html']) % or in the following URL. % http://www.mathworks.com/help/releases/R2012b/images/examples/correcting-nonuniform-illumination_ja_JP.html