www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱matlab程序源码 > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I2_09_0_myWashers7s.m
clc;close all;imtool close all;clear; %% 夋憸偺撉崬傒丒昞帵 I = imread('I2_09_0_washers7s.JPG'); % 夋憸偺撉崬傒 imtool(I); % 昞帵 %% 墌偺専弌乮c:拞怱揰丄r:敿宎乯丄幆暿 [c, r] = imfindcircles(I, [30 45], 'Sensitivity', 0.9); %僨僼僅儖僩偱偼丄攚宨傛傝傕柧傞偄傕偺傪扵偡丅敿宎25~55僺僋僙儖 %% 寢壥偺昞帵 ind_l = r > 37 I3 = insertShape(I, 'Circle', [c(ind_l,:), r(ind_l)], 'Color','blue', 'LineWidth',3); I4 = insertShape(I3, 'Circle', [c(~ind_l,:), r(~ind_l)], 'Color','green', 'LineWidth',3); I5 = insertText(I4, [20, 1], ['Count: Large=' num2str(nnz(ind_l)) ', Small=' num2str(nnz(~ind_l))], 'TextColor','white', 'FontSize',24); figure;imshow(I5); %% 廔椆 % Copyright 2014 The MathWorks, Inc. % 撪晹偱丄rgb2gray偱僌儗乕僗働乕儖偵曄姺