image thumbnail

March 2013 Japanese webinar "Introduction to Image Processing and Computer Vision with MATLAB"

by

 

25 Mar 2013 (Updated )

Script used in the Japanese webinar for image processing and computer vision held on Mar. 01, 2013.

S1_1_Index.m
%% Copyright 2013 The MathWorks, Inc.
% This is a simple script for introduction to image processing with MATLAB

%% MATLABɂ摜̊{

% GUI̐
        % MATLAB𗧂グƁÂ悤ȉʂŗオ܂B
        % ł͕傫邽߂ɁA
        % R}hEChEȊOׂčŏāA
        % c[Xgbvŏ܂B

% s񑀍ɂ摜̎戵
magic(5)      % 悸A5s5̍s𐶐܂B
              % ł́AmagicƂ֐pA
              % P25̐񂸂ŽgAcEE΂߂ǂ𑫂킹ĂA
              % ɂȂAwƂs𐶐Ă݂܂B
              % [C^v^] MATLAB̓C^v^^̌ł̂ŁA
              % ̂悤Ƀ^[L[ƂŌʂɌ邱Ƃł܂B
              
              % ɁA̍sϐAɑƎv܂B
A=magic(5)    % [`sv] MATLABł́AĈ悤ȕϐ̒`Kv܂̂ŁA
              % ̂悤ɁAϐAɑ邱ƂŕϐIɍ쐬܂B
              
              % ɂ̍s摜Ƃĕ\Ǝv܂B
              % ̌łƁAႦBitmap`̃wb_[𐶐
              % ʂ̍EփsNZf[^File֏ôɁA
              % ʃc[ŕ\肷邩܂񂪁A
              % MATLABɂ́A[Žp̗lXȊ֐]pӂĂ܂B
              % łimshowƂ֐pĕ\Ǝv܂B 
              % 1^Eől25^Ƃĕ\܂B
imshow(A, []);
        % ̂悤ɉ摜\܂A
        % ŝꂼ̗vf̒lAePixel̖邳ɑΉĂāA
        % 2sƉ摜PFPɑΉĂ邱Ƃ܂B
        
        % ɁAl̏̂mCYƂďƎv܂B
        % ł́A10ȉ̂̂A10傫Ȃ͎̂cƎv܂B
        % Čł낤ƂƁAcƉ2d̃[vgA
        % 1sNZԂɔr肷Ǝv܂A
        % MATLABł͍ŝ܂܎舵܂̂ŁAȌȋLqŏ邱Ƃł܂B
        
        % MATLABł́Asɑ΂lXȕ֗ȉZqpӂĂA
        % Ⴆ΁As̊evfƁAl10rƂɂ́A
B=A<10
        % ̂悤ɁAsƐ10ׂĂ邱ƂŁA
        % 10vfʒuɂ͂PA10ȏ̂Ƃ0ɂȂs𓾂邱Ƃł܂B
        
        % MATLABł͏gvf̎ŵŁA
        % Ⴆ΁Â悤ɂ邱Ƃ
A(1,1)
        % sȂ1sE1ڂw肷邱Ƃł܂B
        % vfw肷镔ɁAlł͂ȂsgƂł܂B

        % Ⴆ΁Â悤ɂ邱ƂŁABs1̗vfɑ΂Ă̂ݏs邱Ƃł܂B
A(B)=1
        % ŽĂ݂̂łA
%im     % imƓ͂ďĂƁAR}himshow͂Ă܂B
        % łłimshow̑ɁA
        % 摜͂̋@\LxȁAimtoolgĂ݂܂B
        
imtool(A, []);
        % ̂悤ɊDFl1ɂȂ^ɂȂĂ邱Ƃ܂B
        % 𑪂邱Ƃł܂A
        % C[W ̉ sNZ̈ Ƃj[gƁA
        % ̂悤ɊePixel̖邳̒l\邱Ƃł܂B
        % J[̏ꍇ́A3‚̒l\܂

B                % قǁAAs10ׂčBsłA
imshow(B,[]);    % 摜Ƃĕ\Ă݂ƁA
                 % 10vf͔A10傫vf͍̓l摜ɂȂĂāA
                 % 召rZ2l摜邱Ƃ܂B

                 % ̑ɂAႦ΁A
B                % ̂悤Bs1̂ƂAقǂ̂悤1ɂ̂ł͂Ȃ0ɂꍇ
~B               % `_ŁAs01ꊇŕϊł̂ŁA
A                % As
A .* ~B          % `_B ̊es̗vfm̊|Z (*̑O.uƂŏo܂)
                 % sƂŁAقǂ1̑0֕ϊ邱Ƃł܂B

Contact us