• 大小: 2.49MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-09-07
  • 语言: Matlab
  • 标签: matlab  图像处理  

资源简介

本程序时用matlab写的,主要是军用自动报靶仿真。 代码仅供参考

资源截图

代码片段和文件信息

function varargout = shoot_system(varargin)
% SHOOT_SYSTEM M-file for shoot_system.fig
%军用报靶系统主函数

gui_Singleton = 1;
gui_State = struct(‘gui_Name‘       mfilename ...
                   ‘gui_Singleton‘  gui_Singleton ...
                   ‘gui_OpeningFcn‘ @shoot_system_OpeningFcn ...
                   ‘gui_OutputFcn‘  @shoot_system_OutputFcn ...
                   ‘gui_LayoutFcn‘  []  ...
                   ‘gui_Callback‘   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State varargin{:});
else
    gui_mainfcn(gui_State varargin{:});
end



function shoot_system_OpeningFcn(hobject eventdata handles varargin)

handles.output = hobject;
guidata(hobject handles);


% ---输出返回到命令行.
function varargout = shoot_system_OutputFcn(hobject eventdata handles) 

varargout{1} = handles.output;


% ---  载入图像,这张靶图像没有弹点痕迹
function pushbutton1_Callback(hobject eventdata handles)
  
global before
global num
num=0;
B=imread(‘b1.jpg‘);
axes(handles.axes1);
imshow(B)
before=B;



% --- 在图像处理,去除噪声,圆心坐标与各个靶环间隔的检测.
function pushbutton2_Callback(hobject eventdata handles)

global before
global rc
global x_center
global y_center
global lamda


J=im2bw(before0.5);
J=medfilt1(J4);
B=[0 1 0;1 1 1;1 0 1];
A=imdilate(JB);
[xy]=size(A);

[Lm] = bwlabel(A8);
zuobiao=zeros(m2);
n=1;
for i=1:m
    [rc] = find(L==i);
    rc=[r c];   
    a1=max(r);
    a2=min(r);
    a=a1-a2;%
    r1=a/2;
    test1=(a1+a2)/2;
    b1=max(c);
    b2=min(c);
    b=b1-b2;%
    r2=b/2;
    test2=(b1+b2)/2;
    deta=abs(b-a);%
    if(deta/((a+b)/2)<1/100 && (a1-a2)/x<0.8)               
        zuobiao(n1)=test1;
        zuobiao(n2)=test2;
        banjing(n1)=r1;
        banjing(n2)=r2;
        n=n+1;
    end
end
n=n-1;         
x_count=0;
y_count=0;
for j=1:n
    x_count=x_count+zuobiao(j1);
    y_count=y_count+zuobiao(j2);
end

x_center=x_count/n;
y_center=y_count/n;


banjing_1=zeros(1n);
for i=1:n
    banjing_1(i)=(banjing(i1)+banjing(i2))/2;
end
banjing_2=sort(banjing_1);
count=0;
for i=1:(n-1)
    count=count+abs(banjing_2(i)-banjing_2(i+1));
end

lamda=count/(n-1);   
msgbox(‘处理完成!‘)



% --- 模拟打靶,方法是把有弹点图像叠加到源图像中
function pushbutton3_Callback(hobject eventdata handles)

global num
global after
num=num+1;
 NUM=7;
  for i=1:NUM
     switch num
         case{1}
             after=imread(‘project\b2.jpg‘);
             axes(handles.axes1);
             imshow(after);
             break
         case{2}
             after=imread(‘project\b3.jpg‘);
             axes(handles.axes1);
             imshow(after);
               break
         case{3}
             after=imread(‘project\b4.jpg‘);
             axes(handles.axes1);
             imshow(after);
               break
         case{4}
             after=imread(‘project\b5.jpg‘);
             axes(handles.axes1);
             imshow(after);
               break
         case{5}
             afte

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     353524  2009-04-04 15:59  project1\b1.jpg

     文件     249767  2010-01-11 15:02  project1\b2.JPG

     文件     249905  2010-01-11 15:33  project1\b3.JPG

     文件     250030  2010-01-11 15:33  project1\b4.JPG

     文件     250188  2010-01-11 15:33  project1\b5.JPG

     文件     250385  2010-01-11 15:34  project1\b6.JPG

     文件     250621  2010-01-11 15:34  project1\b7.JPG

     文件     250767  2010-01-11 15:34  project1\b8.JPG

     文件       4803  2010-01-18 00:31  project1\shoot_system.asv

     文件       4320  2010-01-11 17:08  project1\shoot_system.fig

     文件       4747  2010-01-18 00:33  project1\shoot_system.m

     文件     661504  2010-01-19 18:02  project1\军用自动报靶系统.doc

     目录          0  2010-01-19 18:02  project1

----------- ---------  ---------- -----  ----

              2780561                    13


评论

共有 条评论