⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a2008.m

📁 利用matlab对图像进行读入与处理(运用在仿真领域)
💻 M
字号:
%------------------------------------------------------------------------------------------------------
% center detect
% Designed by Zhengchun LIN. Start: 2008.9.19 Finished:
%------------------------------------------------------------------------------------------------------
clear;clc;
filename='A2008.bmp';
A=imread(filename);
A=rgb2gray(A);
image_size=size(A);
B=A;
t=100;
centers=[];
for i=1:image_size(1)
    for j=1:image_size(2)
        if A(i,j)<=t
            [near_points,A]=near_area_detect(A,[i,j],t);
            temp_center=[sum(near_points(:,1)),sum(near_points(:,2))]/size(near_points,1);
            centers=[centers;temp_center];
        end        
    end
end
disp('圆心坐标为:');disp(centers);
B_colormap=colormap(gray(256));
center_color=[1,0,0];center_gray=101;
B_colormap(center_gray,:)=center_color;
centers=round(centers);
for i=1:size(centers,1)
        for ii=-3:3
            x=centers(i,1);y=centers(i,2);
            xx=x+ii;yy=y+ii;
            if xx>0 & xx<=image_size(1)
                B(xx,y)=center_gray;
            end
            if yy>0 & yy<=image_size(2)
                B(x,yy)=center_gray;
            end
        end
end
figure;imshow(B,B_colormap);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -