Professional Documents
Culture Documents
File in
File in
clear all;
clc;
%--------------------------------------------
TRANGNHO=figure ( 'name','BAITAP_XULYANH',...
'color',[0 .3 .22],...
'numbertitle','off',...
'menubar','none',...
'position',[0 0 1024 768]);
%--------------------------------------------
uicontrol('Style','Text',...
'String','TRÖÔØNG ÑAÏI HOÏC VAÊN HIEÁN',...
'position',[200 650 600 50],...
'Backgroundcolor',[0 .3 .22],...
'FontName','VNI-Times',...
'FontSize',20,...
'FontWeight','bold',...
'HorizontalAlignment','center',...
'Foregroundcolor',[0 1 1]);
% -------------------------------------------------
uicontrol('Style','Text',...
'String','KHOA ÑIEÄN TÖÛ VIEÃN THOÂNG',...
'position',[300 600 450 40],...
'Backgroundcolor',[0 .3 .22],...
'FontName','VNI-Times',...
'FontSize',20,...
'FontWeight','bold',...
'HorizontalAlignment','center',...
'Foregroundcolor',[0 1 1]);
%------------------------------------------------------------
uicontrol('Style','Text',...
'String','SVTH:TRAÀN BAÙ HUYØNH 07EV019',...
'position',[122 40 450 70],...
'FontName','VNI-Times',...
'FontSize',15,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'Backgroundcolor',[0 .3 .22],...
'Foregroundcolor',[.935 0 .478]);
uicontrol('Style','Text',...
'String','LÔÙP: 07E1',...
'position',[122 0 350 70],...
'FontName','VNI-Times',...
'FontSize',15,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'Backgroundcolor',[0 .3 .22],...
'Foregroundcolor',[.935 0 .478]);
uicontrol('Style','Text',...
'String','BAØI TAÄP:XÖÛ LYÙ AÛNH',...
'position',[390 150 450 70],...
'FontName','VNI-Times',...
'FontSize',15,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'Backgroundcolor',[0 .3 .22],...
'Foregroundcolor',[.935 0 .478]);
%---------------------------------------------------------------------
uicontrol('Style','pushbutton',...
'String','Next',...
'position',[750 10 90 50],...
'FontName','VNI-Times',...
'FontSize',16,...
'FontWeight','bold',...
'HorizontalAlignment','right',...
'Backgroundcolor',[0 .3 .22],...
'Foregroundcolor',[.435 0 .978],...
'callback','baitaptt');
uicontrol('Style','pushbutton',...
'String','Exit',...
'position',[900 10 90 50],...
'FontName','VNI-Times',...
'FontSize',16,...
'FontWeight','bold',...
'HorizontalAlignment','right',...
'Backgroundcolor',[0 .3 .22],...
'Foregroundcolor',[.435 0 .978],...
'callback','close');
%-------------------------------------------------------
axes('Position',[.31 .4 .37 .37],...
'XTick',[],...
'YTick',[],...
'Xlim',[0 4],... %gioi han truc x trong doan [0 4]
'Ylim',[0 4],... %gioi han truc y trong doan [0 4]
'Box','on');
imshow('logo.jpg');
xam=rgb2gray(Anh_goc1);
axes( ...
'Units','normalized', ...
'Position',[0.59 0.55 0.40 0.40], ...
'BusyAction','Queue','Interruptible','off',...
'Ydir','reverse',...
'Xlim',[.5 128.5],...
'Ylim',[.5 128.5],...
'CLim',[0 1],...
'XTick',[],'YTick',[], ...
'Box','on');
imshow(xam);
BÀI TẬP TT
% chuong trinh tao 6 cua so de nhap anh
clc;
pos=[ 0 0 1024 768]
fg=figure(...
'numbertitle','off',...
'units','pixel',...
'color',[0.7 0.1 0.4],...
'menubar','none',...
'name','giaodien',...
'position',pos,...
'Visible','on',...
'backingstore','on');
%----------------------------------------------------------------------
uicontrol( 'Style','PushButton',...
'FontName','VNI-Times',...
'Backgroundcolor','c',...
'foregroundcolor','black',...
'FontSize',11,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'String','I1',...
'Position',[10,400,50,25],...
'callback','cuasochonanh1');
%-----------------------------------------------------------------
uicontrol( 'Style','PushButton',...
'FontName','VNI-Times',...
'Backgroundcolor','c',...
'foregroundcolor','black',...
'FontSize',11,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'String','I2',...
'Position',[500,400,50,25],...
'callback','cuasochonanh2');
%------------------------------------------------------------------
uicontrol( 'Style','PushButton',...
'FontName','VNI-Times',...
'Backgroundcolor','c',...
'foregroundcolor','black',...
'FontSize',11,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'String','I1+I2',...
'Position',[900,400,50,25],...
'callback','conghaianh');
%------------------------------------------------------------------
uicontrol( 'Style','PushButton',...
'FontName','VNI-Times',...
'Backgroundcolor','c',...
'foregroundcolor','black',...
'FontSize',11,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'String','Gray I1',...
'Position',[10,50,70,25],...
'callback','lamxamanh');
uicontrol( 'Style','PushButton',...
'FontName','VNI-Times',...
'Backgroundcolor','c',...
'foregroundcolor','black',...
'FontSize',11,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'String','xam*1.5',...
'Position',[500,50,70,25],...
'callback','lamsanganhxam');
uicontrol( 'Style','PushButton',...
'FontName','VNI-Times',...
'Backgroundcolor','c',...
'foregroundcolor','black',...
'FontSize',11,...
'FontWeight','bold',...
'HorizontalAlignment','left',...
'String','xam*0.5',...
'Position',[900,50,70,25],...
'callback','lamtoianhxam');
CỘ NG 2 ẢNH
%chuong trinh cong anh
clc;
cong=(Anh_goc2)+(Anh_goc1);
axes( ...
'Units','normalized', ...
'Position',[0.59 0.55 0.40 0.40], ...
'BusyAction','Queue','Interruptible','off',...
'Ydir','reverse',...
'Xlim',[.5 128.5],...
'Ylim',[.5 128.5],...
'CLim',[0 1],...
'XTick',[],'YTick',[], ...
'Box','on');
imshow(cong);
CỬA SỔ 2
[filename, pathname] = uigetfile( ...
{ '*.*', 'Any Files (*.*)'}, ...
'chonanh');
[path,name,ext,versn] = fileparts([pathname '\' filename]);
Anh_goc = imread([pathname filename]);
axes( ...
'Units','normalized', ...
'Position',[0.29 0.55 0.40 0.40], ...
'BusyAction','Queue','Interruptible','off',...
'Ydir','reverse',...
'Xlim',[.5 128.5],...
'Ylim',[.5 128.5],...
'CLim',[0 1],...
'XTick',[],'YTick',[], ...
'Box','on');
imshow(Anh_goc);
CỬA SỔ CHỌN ẢNH
[filename, pathname] = uigetfile( ...
{ '*.*', 'Any Files (*.*)'}, ...
'chonanh');
[path,name,ext,versn] = fileparts([pathname '\' filename]);
Anh_goc = imread([pathname filename]);
axes( ...
'Units','normalized', ...
'Position',[0.01 0.55 0.40 0.40], ...
'BusyAction','Queue','Interruptible','off',...
'Ydir','reverse',...
'Xlim',[.5 128.5],...
'Ylim',[.5 128.5],...
'CLim',[0 1],...
'XTick',[],'YTick',[], ...
'Box','on');
imshow(Anh_goc);
CỬA SỔ CHỌN ẢNH 1
[filename, pathname] = uigetfile( ...
{ '*.*', 'Any Files (*.*)'}, ...
'chonanh');
[path,name,ext,versn] = fileparts([pathname '\' filename]);
Anh_goc1 = imread([pathname filename]);
imshow(Anh_goc1)
axes( ...
'Units','normalized', ...
'Position',[0.59 0.55 0.40 0.40], ...
'BusyAction','Queue','Interruptible','off',...
'Ydir','reverse',...
'Xlim',[.5 128.5],...
'Ylim',[.5 128.5],...
'CLim',[0 1],...
'XTick',[],'YTick',[], ...
'Box','on');
imshow(B);
axes( ...
'Units','normalized', ...
'Position',[0.59 0.55 0.40 0.40], ...
'BusyAction','Queue','Interruptible','off',...
'Ydir','reverse',...
'Xlim',[.5 128.5],...
'Ylim',[.5 128.5],...
'CLim',[0 1],...
'XTick',[],'YTick',[], ...
'Box','on');
imshow(A);
CỘ NG 2 ẢNH
%chuong trinh cong 2 anh I1+I2
I1=imread('D:\hinh\DAM SEN\IMG_0619.JPG');
I1=imread('D:\hinh\DAM SEN\IMG_0624.JPG');
I=I1+I2;
imshow(I)
CỬA SỔ CHỌN ẢNH 2
[filename, pathname] = uigetfile( ...
{ '*.*', 'Any Files (*.*)'}, ...
'chonanh');
[path,name,ext,versn] = fileparts([pathname '\' filename]);
Anh_goc2 = imread([pathname filename]);
imshow(Anh_goc2);