Code covered by the BSD License

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

### Masa Otobe (view profile)

25 Mar 2013 (Updated )

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

S1_3_filtering.m
```%% Copyright 2013 The MathWorks, Inc.
% This is a simple demo script for filtering

clear all; clc; close all;

% 摜̎荞
figure; imshow(I);

% ωtB^[
Fave=fspecial('average');           % tB^[W
Iave=imfilter(I, Fave);             % tB^[
I=[I Iave];                         % ɕʂ̉摜g
figure; imshow(I);                  % \

% N
Fsh=fspecial('unsharp');                % tB^[
Ish=imfilter(Iave, Fsh);                % tB^[
figure; imshowpair(Iave, Ish, 'montage');% щ

Fave                      % W̕\
fspecial('average',5)     % 5s5̌W邱Ƃo܂

edit fspecial      % fspecial֐̎\ or ֐IF4
% I

%Fave                      % W̕\
%fspecial('average',5)     % 5s5̌W邱Ƃo܂

% :   ÑtB^[̖O͕킵̂ŒӂĂB
% AV[v tB^[̓C[WV[vɂ邽߂Ɏgp鉉ZqłB
% ̖ÓAC[Ŵ炻̕sN (AV[v) ȃC[WZ
% C[WV[vɂoŋƊEł̏ߒɗR܂B

%size(I)                             % s̓r폜
%I(:,200:400)=[];                    % I(s,)     :͑Svf
%figure; imshow(I);                  %  200:400200~400̈Ӗ

% [fspecial֐̎̕⑫]
%
% Ⴆ  fspecial('average',5) ̏ꍇ ==> type='average, p2=[5 5] ƂȂ
%
% <>
% switch type
%  case 'average'               % Smoothing filter
%     siz = p2;                     % [5 5]
%     h   = ones(siz)/prod(siz);    % "SĂ̗vf15s5̍s" / vf̐ (5*5=25)

```