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

📄 windows_menu.m

📁 综合利用了图象处理和图象理解的基本函数
💻 M
字号:
% ***************************************** %
% Image processing simulation for Experiment
% Designed in Chengdu Precise CNC ...
%                    Machine Tool Co.,LTD.
% ***************************************** %

% Building up a window with name "Window and Menu experiment"
clear;
f1=figure('Toolbar','none','Position',[10 40 1000 680],...
          'Name','Window and Menu experiment',...
          'MenuBar','none',...
          'NumberTitle','off');    

% Building all menus      
% 1.Setting axes and Preprocess menus 
a1=axes('Position',[0.05,0.63,0.26,0.26]);

menu_1=uimenu(f1,'Label','&Preprocess');
        uimenu(menu_1,'Label','&Load',...
               'Callback',[...
                    'I=imread(''football.jpg'');',...   % load image
                    'imshow(I);',...
                    'Title(''Original Picture'')'],...
               'Accelerator','L'...
               );
        uimenu(menu_1,'Label','&Grey Image',...
                 'Callback',[...
                    'Gray_p=rgb2gray(I);',...   % display gray image
                    'set(f1,''CurrentAxes'',a1);',...
                    'imshow(Gray_p);',...
                    'Title(''Grey Picture'')']...  
                ); 
        uimenu(menu_1,'Label','&Enhancement',...
                 'Callback',[...
                    'Enhance_p=histeq(Gray_p);',...   % Enhanced image
                    'set(f1,''CurrentAxes'',a1);',...
                    'imshow(Enhance_p);Title(''Enhanced Picture'')']...
                );
        uimenu(menu_1,'Label','&Binary',...
                 'Callback',[...
                    'BW_p=im2bw(I);',...   % Binary process 
                    'set(f1,''CurrentAxes'',a1);',...
                    'imwrite(BW_p,''BW_new.tif'');',...
                    'imshow(BW_p);Title(''Binary Picture'')'],...
                 'Accelerator','W'...
                );
%         uimunu(menu_1,'Label','BW &Save',...
%                  'Callback',['infor=imfinfo(BW_p);',...
%                              'set()'
        
%                 )
        uimenu(menu_1,'Label','E&xit',...
                 'Separator','on',...
                 'Callback','close',...          %  Close current figure
                 'ForegroundColor',[1 0  0]...
                );     
% 2.Setting axes and Image Analysis menus 
%axes('Position',[0.3,0.7,0.2,0.2]);

menu_2=uimenu('Parent',f1,'Label','&Analysis');      
  sub_menu=uimenu(menu_2,'Label','&Detection');    % edge detection in four conditions
        uimenu(sub_menu,'Label','Canny',...
                 'Callback',[...                    
                    'Edge_p1=edge(BW_p,''canny'');',...    % Canny
                    'subplot(3,3,2);subimage(Edge_p1);',...
                    'title(''Canny'')'...
                            ]...                   
                );
        uimenu(sub_menu,'Label','Sobel',...         % Sobel
                 'Callback',[...
                    'Edge_p2=edge(BW_p,''sobel'');',...
                    'subplot(3,3,3);subimage(Edge_p2);',...
                    'title(''Sobel'')'...
                            ]...
                ); 
        uimenu(sub_menu,'Label','Prewitt',...       % Prewitt
                 'Callback',[...
                    'Edge_p3=edge(BW_p,''prewitt'');',...
                    'subplot(3,3,5);subimage(Edge_p3);',...
                    'title(''Prewitt'')'...
                            ]...
                ); 
         uimenu(sub_menu,'Label','Log',...          % Log
                 'Callback',[...
                    'Edge_p4=edge(BW_p,''log'');',...
                    'subplot(3,3,6);subimage(Edge_p4);',...
                    'title(''Log'')'...
                             ]...
                );
          uimenu(sub_menu,'Label','Roberts',...         % Roberts
                 'Callback',[...
                    'Edge_p4=edge(BW_p,''roberts'');',...
                    'subplot(3,3,8);subimage(Edge_p4);',...
                    'title(''Roberts'')'...
                             ]...
                ); 
          uimenu(sub_menu,'Label','Zero-cross',...        % Zero-cross
                 'Callback',[...
                    'Edge_p4=edge(BW_p,''zerocross'');',...
                    'subplot(3,3,9);subimage(Edge_p4);',...
                    'title(''Zerocross'')'...
                             ]...
                ); 
  uimenu(menu_2,'Label','&Thin Op',...          % Thinner the edge
                'Callback',[ 'Thin_p=bwmorph(BW_p,''thin'',Inf);',...
                             'subplot(2,3,4);subimage(Thin_p);',...
                             'Title(''Thinned Image'')']);
    
    

⌨️ 快捷键说明

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