1 of 37

PERTEMUAN KE 3 – OPERASI DASAR PENGOLAHAN CITRA DIGITAL

PENGOLAHAN CITRA

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

2 of 37

R

P

S

MEMBUKA CITRA DIGITAL

01

OPERASI ARITMATIKA

03

OPERASI KOMPUTASI

02

OPERASI GEOMETRI

04

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

3 of 37

MEMBUKA CITRA DIGITAL

01

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

4 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

MEMBUKA CITRA DIGITAL

Sebagai Langkah awal, kita akan membuka file citra menggunakan python dan OpenCV.

Untuk itu siapkan citra yang dibutuhkan dan ikuti script berikut

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

5 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

MEMBUKA CITRA DIGITAL DALAM BENTUK MATARIKS

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

6 of 37

OPERASI KOMPUTASI

02

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

7 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI

Pada materi sebelumnya sudah dijelaskan bahwa citra digital pada dasarnya adalah matriks atau array yang berisi nilai-nilai/angka-angka.

Oleh karenanya, nilai-nilai itu bisa diolah/dioperasikan layaknya nilai-nilai biasa

Sebagai contoh, suatu pixel pada citra digital berwarna hitam, yang berarti memilki nilai 0.

Maka nilai 0 tersebut bisa diganti dengan nilai lain.

Misalnya dengan dilakukan operasi penjumlahan, yaitu dengan menambahkan dengan nilai acak 200.

Maka nilai pixel yang sebelumnya 0 menjadi 0 ditambah 200 menjadi 200. Sehingga ketika disimpan dalam format citra digital kembali, pixel yang sebelumnya berwarna hitam menjadi abu-abu mendekati putih.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

8 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI

Terdapat beberapa operasi yang umum dilakukan pada citra digital, antara lain adalah

OPERASI KOMPUTASI

OPERASI ARITMATIKA

OPERASI BOOLEAN

OPERASI GEOMTERI

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

9 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI

Operasi komputasi adalah segala bentuk operasi yang dilakukan menggunakan komputer.

Jika menggunakan sudut pandang ini, maka semua operasi citra digital masuk ke dalam kategori operasi komputasi.

Inti dari operasi komputasi adalah mengganti nilai pixel pada citra digital dengan nilai baru.

Ada beberapa jenis operasi komputasi yaitu : �operasi titik, �operasi lokal, dan �operasi global.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

10 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

Operasi titik atau kadang disebut operasi pixel adalah operasi untuk memberikan nilai baru pada suatu pixel, dimana nilai baru tersebut hanya dipengaruhi oleh nilai pada pixel itu sendiri

Beberapa contoh dari operasi titik adalah :�operasi simple thressholding ,

operasi brightness,

inversi warna (negative photo),

operasi geometri, dan lain-lain.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

11 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

Operasi thressholding adalah operasi untuk mengganti nilai dari satu pixel dengan nilai 0 atau 255 (dalam konteks grayscale 8-bit) atau 0 dan 1 (dalam konteks binary 1 bit).

Thressholding biasanya digunakan untuk memperjelas citra digital yang mengandung teks, memishkan obyek dengan latar belakang, atau proses preprocessing

Pada citra digital 8-bit yang memiliki rentang nilai 0-255, operasi simple thressholding memiliki aturan sebagai berikut :

Nilai pixel < 128, dikonversi menjadi 0

Nilai pixel >= 128 dikonversi menjadi 255

Nilai 128 ini adalah batas yang ditentukan sendiri yang disebut sebagai nilai ambang batas (threshold). 128 dipilih karena median/nilai Tengah dari 0-255.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

12 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

13 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

14 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

Operasi Brigthness�adalah operasi untuk mempercerah atau mempergelap citra digital. Ide dasarnya sederhana yaitu dengan menambah/mengurangi nilai pixel citra digital dengan nilai yang sama.

Jika ingin mempercerah citra maka pixel harus ditambah dengan nilai tertentu agar mendekati nilai 255.

Sebaliknya, jika ingin mempergelap citra, maka pixel dikurangi dengan nilai tertentu agar mendekati nilai 0.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

15 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

16 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - TITIK

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

17 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - LOKAL

Jika operasi titik, nilai baru hanya dipengaruhi oleh pixel itu sendiri, maka pada operasi lokal, nilai baru dipengaruhi oleh pixel-pixel tetanganya.

Pixel tetangga adalah pixel-pixel di sektiar pixel yang akan diganti nilainya.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

18 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - LOKAL

Selanjutnya, materi terkait operasi lokal ini berkaitan dengan metode konvolusi, adaptive thresholding, dan lain-lain yang akan dipelajari di materi-materi berikutnya

Berikut adalaj contoh penerapan operasi lokal pada metode Edge Detection

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

19 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - GLOBAL

Operasi global melibatkan semua pixel untuk mengubah satu pixel saja di dalam citra.

Operasi global jauh lebih kompleks dibanding operasi titik dan lokal. Selain itu proses yang diperlukan juga relatif lebih lama.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

20 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI KOMPUTASI - GLOBAL

Beberapa contoh penerapan operasi global adalah pada proses thressholding menggunakan metode Otsu, perbaikan citra menggunakan metode Histogram Equalization, Brightness Normalization, dan lain-lain. ��Lebih lanjut mengenai opeasi ini akan dibahas pada bab-bab berikutnya.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

21 of 37

OPERASI ARITMATIKA

03

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

22 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA

Dikarenakan citra bisa direpresentasikan ke dalam bentuk matriks, maka bisa dilakukan beberapa fungsi aritmatika seperti layaknya bilangan dalam matematika

Beberapa operasi yang bisa dilakukan antara lain :

PENJUMLAHAN/PENGURANGAN

PERKALIAN

TRANSPOSE

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

23 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PENJUMLAHAN/PENGURANGAN

Konsep operasi penjumlahan/pengurangan pada citra adalah dengan menambahkan atau mengurangi nilai pixel dalam citra dengan satu nilai skalar tertentu atau dengan matriks lain.

Contoh operasi penjumlahan dengan nilai skalar bisa ditemui pada operasi brigtness.

Pada operasi ini semua nilai/pixel pada citra ditambahkan dengan nilai skalar tertentu, sehingga nilai pixel menjadi lebih besar dan warna pada citra menjadi lebih cerah (bright).

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

24 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PENJUMLAHAN/PENGURANGAN

F adalah sebuah citra yang sudah dikonversi menjadi matriks. Kita ingin membuat citra lebih cerah dengan menambahkan nilai 10 ke setiap pixelnya

Sehingga, nilai citra yang baru adalah G

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

25 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PENJUMLAHAN/PENGURANGAN

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

26 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PENJUMLAHAN/PENGURANGAN

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

27 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – TRANSPOSE

Dalam konteks matematika, transpose artinya menukar baris pada matriks menjadi kolom.

Pada kasus ini, jika ukuran kolom dan baris berbeda, maka matriks hasil transpose juga akan berbeda.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

28 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – TRANSPOSE

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

29 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – TRANSPOSE

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

30 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PERKALIAN

Operasi ini bisa dilakukan dengan nilai skalar (seperti pada kasus operasi pernjumlahan), juga bisa dilakukan dengan citra lain (istilah untuk citra lain/citra pengali adalah masking).

Akan tetapi, jika melakukan perkalian dengan citra lain, harus dipastikan bahwa kedua citra memiliki ukuran (panjang dan lebar) yang sama dan jumlah channel yang sama. Jika tidak,maka perkalian tidak bisa dilakukan.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

31 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PERKALIAN

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

32 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI ARITMATIKA – PERKALIAN

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

33 of 37

OPERASI GEOMETRI

04

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

34 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI GEOMETRI

Menurut beberapa ahli dan buku referensi yang ada, operasi geometri masuk ke kategori operasi pixel/titik.

Akan tetapi ada pula yang membedakan dengan operasi titik, karena konteksnya berbeda.

Pada operasi titik, terdapat nilai pengganti pixel yang dipengaruhi nilai di titik itu sendiri. Sedangkan pada operasi geometri, tidak terdapat perubahan nilai. hanya lokasinya saja yangh ditukar

Yang termasuk dalam operasi ini adalah :

rotasi (memutar), �transalsi (menggeser), dan scalling (memperbesar/memperkecil).

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

35 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI GEOMETRI

Contoh operasi geometri berikut dilakukan langsung menggunakan library OpenCV.

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

36 of 37

  • Input the text content you want according to the content you need, and input the text and other information.Input the text content you want according to the content you need, and input the text and other information.

  • Input the text content you want according to the content you need, and input the text and other information.

20NN

OPERASI GEOMETRI

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

37 of 37

Tim Penyusun:

1.

2.

3

TERIMA

KASIH

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA

PROGRAM STUDI INFORMATIKA

UNIVERSITAS GUNADARMA