Aplikasi Filter Robert dan Sobel dalam Pengolahan Citra

Contoh apikasi filter robert dan sobel dalam teknik pengolahan citra untuk pendeteksian edge. Dalam implementasinya, ada 2 teknik yang dapat digunakan, menggunakan toolbox dan tanpa toolbox.

Tanpa toolbox

//filter robert

img=imread(‘circuit.tif’);

rx=[-1 0 0;0 -1 0;0 0 0];

ry=[0 1 0;-1 0 0;0 0 0];

img_rx=filter2(rx, img);

img_ry=filter2(ry, img);

tebing =sqrt(img_rx.^2 + img_ry.^2);

imshow (img)

figure, imshow (tebing/255)

//filter sobel

img=imread(‘circuit.tif’);

sx=[-1 0 1;-2 0 2;-1 0 1];

sy=[-1 -2 1;0 0 0;1 2 1];

img_sx=filter2(sx, img);

img_sy=filter2(sy, img);

tebing=sqrt(img_sx.^2 + img_sy.^2);

imshow(img);

figure,imshow(tebing/255)

Dengan toolbox

//filter robert

img=imread(‘circuit.tif’);

imshow(img);

tebing_r=edge(img,’roberts’);

figure,imshow(tebing_r)

//filter sobel

img=imread(‘circuit.tif’);

imshow(img);

tebing_s=edge(img,’sobel’);

figure,imshow(tebing_s)

Advertisements
Aplikasi Filter Robert dan Sobel dalam Pengolahan Citra

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s