PENGOLAHAN CITRA Ch.4 M E N G O L A H C I T R A M E N J A D I N E G A T I V E Bayu Pratama RN [ ]

dokumen-dokumen yang mirip
PENGOLAHAN CITRA Ch.3 M E N G O L A H C I T R A M E N J A D I G R A Y S C A L E Bayu Pratama RN [ ]

Praktikum Pengolahan Citra - Pertemuan 1.2

Suatu proses untuk mengubah sebuah citra menjadi citra baru sesuai dengan kebutuhan melalui berbagai cara.

Praktikum Pengolahan Citra - Pertemuan 1

MODUL 9 Material Texture

Manipulasi Gambar dengan Efek yang keren

Manipulasi Gambar dengan Efek yang keren

Digitalisasi Citra. Digitalisasi. Citra analog / objek / scene. Citra digital

Pengenalan Processing untuk Image Processing

Kriptografi Visual tanpa Ekspansi Piksel dengan Pembangkitan Warna dan Kamuflase Share

BAB IV IMPLEMENTASI DAN PENGUJIAN. Pada bab ini akan membahas membahas Construction (Konstruksi) dan

babastudio.com babastudio.com

Bab 1 Membaca & Menyimpan File Gambar

Implementasi Algoritma Kompresi Shannon Fano pada Citra Digital

APLIKASI MENGELOLA DATA ACCESS LOG MENGGUNAKAN C# Melihat LOG berdasar Hari, Jam, dan URL Terbanyak diakses

PENGENALAN INTERFACE MACROMEDIA DITECTOR MX

Dwiny Meidelfi, M.Cs

PRAKTIKUM 6 SPINNER. 1. Aktifkanlah project baru, File New Project Android Application Project. Modul 6 Spinner Page 1

PRAKTIKUM 2. Variabel, Tipe Data dan Operator. Tipe data dan variabel. - Microsoft Visual Studio 2010

Color Detection. Praktikum

Penggunaan Netbeans IDE, Hello World, variable dan Operator aritmetika.

Kriptografi Visual Menggunakan Adobe Photoshop

MODUL PRAKTIKUM CLENT SERVER. Menggunakan Visual Basic 2010 dan MySQL. (Prodi Manajemen Informatika D3)

BAB II LANDASAN TEORI

BAB I Pengenalan Microsoft Visual Basic 6.0

BAB III ANALISIS DAN DESAIN SISTEM

BAB 3 PERANCANGAN PROGRAM

BAB III METODE PENELITIAN. Tujuan tugas akhir ini akan membangun suatu model sistem yang

MODUL I Pengenalan IDE Visual Basic 6.0

MODUL 2 PERANCANGAN INTERFACE

STEGANOGRAFI GANDA DENGAN MANIPULASI GAMBAR

DAFTAR ISI. DAFTAR ISI... vii. DAFTAR GAMBAR... x. DAFTAR TABEL... xii I. PENDAHULUAN Latar Belakang Rumusan Masalah...

LAPORAN PEMROSESAN CITRA DIGITAL

Pengenalan Visual Basic

Analisis Alokasi Memori Citra Bitmap 24 Bit

BAB 3 ANALISIS DAN PERANCANGAN SISTEM PROGRAM APLIKASI HANDS RECOGNIZER

TIPE DATA PADA JAVA. Pertemuan (K-04/L-04)

Mengenal Lebih Jauh Apa Itu Point Process

BAB II MICROSOFT VISUAL STUDIO

I. JUDUL Array. Pengertian Array. Deklarasi Array PRAKTIKUM 6 ARRAY II. TUJUAN. III. ALAT DAN BAHAN - Microsoft Visual Studio 2010

MODUL PRAKTIKUM PEMROGRAMAN BERORIENTASI OBJEK. Maimunah, S.Si,M.Kom

Modul 2. [access specifier] [tipe data] [nama variabel];

Kriptografi Visual dengan Plain Partition dan Skema (n-1,n)

Handout 2 Banner dan Logo

Eko Purwanto WEBMEDIA Training Center Medan

Model Citra (bag. 2)

PRAKTIKUM 1 INPUT - OUTPUT

Bentuk 2D dasar. Titik. Garis. Contoh 2. Contoh. Contoh 1. Syntax. point(x, y) x: koordinat x y: koordinat y

Pertemuan 2 Representasi Citra

PRAKTIKUM. Ukuran foto yang terlalu besar sering menyulitkan saat mau di ke orang lain atau mau dipasang di website.

Spesifikasi: Ukuran: 19x23 cm Tebal: 162 hlm Harga: Rp Terbit pertama: Januari 2005 Sinopsis singkat:

Menangkap dan Mengolah Gambar

METODE REGION BASED QUADTREE UNTUK REPRESENTASI CITRA BERWARNA

Pengenalan IDE Delphi. 1 By : Eko Budi Setiawan

Abstrak. Pendahuluan. pi log2 pi bits (1) Dimana pi adalah probabilitas daro intensitas nilai i, dimana i bernilai diantara 0 sampai 225

MODUL-MODUL PRAKTIKUM VB.

IV. RANCANG BANGUN SISTEM. Perangkat lunak bantu yang dibuat adalah perangkat lunak yang digunakan untuk

STMIK AMIKOM PURWOKERTO PENGOLAHAN CITRA. Akuisisi dan Model ABDUL AZIS, M.KOM

MODUL 3. Classes and Objects (part I)

Modul Praktikum Ke-1

Workshop Singkat Membuat Game Shooter

BAB IV IMPLEMENTASI DAN PENGUJIAN

BAB I. 1 P e m r o g r a m a n V i s u a l B a s i c - J a t i L e s t a r i

1 Pendahuluan. 1. Tujuan: 2 Dasar Teori: Praktikum

Tutorial # A-02 : Slide Show

Pada praktikum ini, anda akan mengimplementasikan sebuah game sederhana, bernama Smiley Face.

ColorMatcher. Goal. Preparation. The Task & the Game. Level 1

Pengembangan Sistem Konversi Citra ke G-Code untuk Aplikasi Manufaktur

Objek-Objek Toolbox. Pokok Bahasan: Membuat Program Memakai ComboBox Membuat Program Memakai HScrollBar Membuat Program Memakai TrackBar

MODUL PRAKTIKUM 1 DASAR VISUAL BASIC 6.0

Modul Pelatihan : Pembuatan Game Animasi Menggunakan Greenfoot

PENGENALAN ADOBE PHOTOSHOP

MODUL-MODUL PRAKTIKUM VB.

: PRAKTIKUM CSS 3 [Color dan Background] NAMA : KELAS : TANGGAL PRAKTIKUM :

BAB IV ATRIBUT OUTPUT PRIMITIF

Praktikum. Jobsheet III. untuk Processing. B. Dasar Teori Ada dua mode dan HSB. (a) (b) HSB. Gambar 3.1. memperoleh. A. Tujuan

Pengenalan Angka. Ubah properti control dan tambahkan class variabel control tipe dan membernya seperti pada tabel berikut :

ABSTRAK. Kata kunci : CBIR, GLCM, Histogram, Kuantisasi, Euclidean distance, Normalisasi. v Universitas Kristen Maranatha

Prosedur Menjalankan Aplikasi Linda

INSTRUKSI PENCABANGAN

BAB 3 ANALISIS DAN PERANCANGAN SISTEM. yang sering dilakukan. Pertukaran informasi dan data menggunakan internet

Microsoft Office Picture Manager

BAB IV ANALISA DAN PERANCANGAN

Pemrograman serial port pada Arduino

Pemrograman Java III

BAB III ANALISIS DAN DESAIN SISTEM

BAB II LANDASAN TEORI

PENGGUNAAN SLICE. Tujuan Instruksional

MODUL #1 Membuat Kartu Nama dengan CorelDraw

MODUL PRAKTIKUM STRUKTUR DATA DAN ALGORITMA STACK

Deteksi Warna. Resty Wulanningrum,S.Kom Universitas Nusantara PGRI Kediri

BAB 2 TINJAUAN TEORETIS

Sesi 2: Image Formation. Achmad Basuki PENS-ITS 2006

SOLUTIONS DAN PROJECT

Cara Mengelola Isi Halaman Web

Bab I Pengenalan Visual BASIC

GRAFIK KOMPUTER DAN PENGOLAHAN CITRA. WAHYU PRATAMA, S.Kom., MMSI.

Mengubah Citra Berwarna Menjadi Gray Scale dan Citra biner

SATIN Sains dan Teknologi Informasi

Pemrograman. Pertemuan-3 Fery Updi,M.Kom

Transkripsi:

PENGOLAHAN CITRA Ch.4 M E N G O L A H C I T R A M E N J A D I N E G A T I V E Bayu Pratama RN [ bayu.pratama.rn@gmail.com ] Tujuan Praktikum - Mengetahui cara membuat program yang mengubah image berwarna ke negative nya INFORMASI Pada praktikum ke-4 ini melanjutkan file yang telah kalian buat dari praktikum ke-2. Sebelumnya lakukan kopi folder proyek yang kalian buat dari praktikum ke-2 (LatihanPengcit2) ke folder LatihanPengcit4. Hal ini karena LatihanPengcit2 nantinya akan digunakan lagi. (Jika kalian ingin membuat dari awal juga tidak apa-apa). PEMBUATAN CITRA NEGATIF Suatu citra dapat dibuat negatif atau berkebalikan. Pada citra 1 bit yang hanya memiliki warna hitam dan putih, proses membuat negatif dapat dilakukan dengan mudah, yaitu membalik warna putih menjadi hitam, dan warna hitam menjadi putih. Proses diatas dapat digambarkan sebagai berikut 1 1 1 0 0 0 0 0 0 1 1 1 1 0 1 0 1 0 Gambar sebelah kiri adalah citra berukuran 3x3 yang masih asli. Sementara yang sebelah kanan adalah citra yang telah dibuat negatif. Ada dua cara untuk membuat negatif, yaitu dengan operasi biner NOT Warna2 = NOT Warna1 Atau dapat dengan melakukan pengurangan Warna2 = 255 Warna1 Untuk citra 24bit RGB, proses pembuatan citra negatif dilakukan sendiri-sendiri pada komponen Red, Green, dan Blue. Algoritmanya adalah sebagai berikut For I:=0 to ImageWidth -1 For J:=0 to ImageHeight -1 Color := GetPixel( I, J ) ; // mengambil pixel pada koordinat (I, J) Color.Red := 255 - Color.Red ; Color.Green := 255 - Color.Green; Color.Blue := 255 - Color.Blue; SetPixel( I, J, Color) ; // mengubah pixel pada koordinat (I, J) End For End For S1 Teknik Informatika UNS [ 1 ]

Di bawah ini adalah perbandingan citra sebelum dan sesudah manipulasi negatif Sebelum Sesudah Histogram Red (Sebelum) Histogram Red Histogram Green (Sebelum) Histogram Green S1 Teknik Informatika UNS [ 2 ]

Histogram Blue (Sebelum) Histogram Blue Image yang telah diubah menjadi negative, bisa dilihat bentuk histogramnya, bandingkan sebelum dan sesudah, bentuknya akan berkebalikan. BAGAIMANA MEMBUAT PROGRAM YANG BISA MENGUBAH IMAGE KE NEGATIVE? Bagian ini melanjutkan source code yang telah dibuat dari praktikum ke-2. 1. Salin folder proyek kalian dan beri nama LatihanPengcit4. 2. Selanjutnya, buka folder baru tersebut. Untuk membuka proyek, kalian bisa melakukan double klik pada file.sln atau file.csproj yang iconnya seperti di bawah ini 3. Proyek anda akan terbuka. Tugas anda selanjutnya adalah menambahkan sebuah Button ke dalam Form dengan property sebagai berikut Nama Tipe Property Name Property Value button3 Button Text NEGATIVE Dari ToolBox, klik Button lalu klik pada Form S1 Teknik Informatika UNS [ 3 ]

4. Pada Form Designer, double klik tombol NEGATIVE 5. Selanjutnya, anda akan berada dalam modus Source Code. Visual Studio akan secara otomatis mengenerate method yang sesuai dengan Event Click dari button1, yaitu button3_click S1 Teknik Informatika UNS [ 4 ]

6. Kemudian Isikan potongan kode di bawah ini 7. Simpan proyek anda. 8. Jalankan program dengan menekan F5 9. Coba Anda tekan tombol LOAD, lalu anda pilih file gambar 10. Selanjutnya anda tekan tombol NEGATIVE. (Anda harus me-load gambar pada langkah no.9) S1 Teknik Informatika UNS [ 5 ]

11. Berikut ini adalah contoh screenshot nya jika anda berhasil 12. Silakan anda coba coba modifikasi sendiri tampilannya agar sesuai selera anda :P Penjelasan : Program di atas merupakan program sederhana untuk mengubah image warna ke negative. Setelah pengguna me-load image dan kemudian menekan tombol NEGATIVE, maka code di dalam method button3_click dijalankan. Proses tersebut sama dengan algoritma yang telah ditulis di atas. Color c = bm.getpixel( x, y ); Pada code diatas, program mengambil pixel pada koordinat tertentu. Pixel tersebut merubakan suatu object dari class Color, dimana class Color memiliki property R,G, dan B. Untuk membuat negatif, kita hanya perlu rumus berikut Color c2 = Color.FromArgb( c.a, 255 c.r, 255 c.g, 255 c.b ); Jika sudah, hasil penghitungan kita ganti warna pixel dengan warna yang baru yang sudah Negative. bm.setpixel( x, y, c2 ); Proses ini berulang sampai seluruh pixel dala gambar telah menjadi Negative. S1 Teknik Informatika UNS [ 6 ]

REFERENSI CLASS DAN METHOD YANG SERING DIGUNAKAN Namespace : System.Drawing Class : Bitmap Turunan dari Class : Image (Abstract Class) public sealed class Bitmap : System.Drawing.Image Member of System.Drawing Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A System.Drawing.Bitmap is an object used to work with images defined by pixel data. Constructor : public Bitmap(string filename) Member of System.Drawing.Bitmap Initializes a new instance of the System.Drawing.Bitmap class from the specified file. filename: The name of the bitmap file. public Bitmap(int width, int height) Member of System.Drawing.Bitmap Initializes a new instance of the System.Drawing.Bitmap class with the specified size. width: The width, in pixels, of the new System.Drawing.Bitmap. height: The height, in pixels, of the new System.Drawing.Bitmap. Method : public static System.Drawing.Image FromFile(string filename) Creates an System.Drawing.Image from the specified file. filename: A string that contains the name of the file from which to create the System.Drawing.Image. The System.Drawing.Image this method creates. public System.Drawing.Color GetPixel(int x, int y) Member of System.Drawing.Bitmap Gets the color of the specified pixel in this System.Drawing.Bitmap. S1 Teknik Informatika UNS [ 7 ]

x: The x-coordinate of the pixel to retrieve. y: The y-coordinate of the pixel to retrieve. A System.Drawing.Color structure that represents the color of the specified pixel. public void Save(string filename) Saves this System.Drawing.Image to the specified file or stream. filename: A string that contains the name of the file to which to save this System.Drawing.Image. public void SetPixel(int x, int y, System.Drawing.Color color) Member of System.Drawing.Bitmap Sets the color of the specified pixel in this System.Drawing.Bitmap. x: The x-coordinate of the pixel to set. y: The y-coordinate of the pixel to set. color: A System.Drawing.Color structure that represents the color to assign to the specified pixel. Property : public int Height { get; } Gets the height, in pixels, of this System.Drawing.Image. The height, in pixels, of this System.Drawing.Image. public float HorizontalResolution { get; } Gets the horizontal resolution, in pixels per inch, of this System.Drawing.Image. The horizontal resolution, in pixels per inch, of this System.Drawing.Image. public System.Drawing.Imaging.PixelFormat PixelFormat { get; } Gets the pixel format for this System.Drawing.Image. A System.Drawing.Imaging.PixelFormat that represents the pixel format for this System.Drawing.Image. S1 Teknik Informatika UNS [ 8 ]

public System.Drawing.Imaging.ImageFormat RawFormat { get; } Gets the file format of this System.Drawing.Image. The System.Drawing.Imaging.ImageFormat that represents the file format of this System.Drawing.Image. public float VerticalResolution { get; } Gets the vertical resolution, in pixels per inch, of this System.Drawing.Image. The vertical resolution, in pixels per inch, of this System.Drawing.Image. public int Width { get; } Gets the width, in pixels, of this System.Drawing.Image. The width, in pixels, of this System.Drawing.Image. Namespace : System.Drawing Struct : Color Turunan dari Class : ValueType (Abstract Class) public struct Color Member of System.Drawing Represents an ARGB (alpha, red, green, blue) color. Constructor : public Color() Method : public static System.Drawing.Color FromArgb(int red, int green, int blue) Creates a System.Drawing.Color structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (fully opaque). Although this method allows a 32-bit value to be passed for each color component, the S1 Teknik Informatika UNS [ 9 ]

value of each component is limited to 8 bits. red: The red component value for the new System.Drawing.Color. Valid values are 0 through 255. green: The green component value for the new System.Drawing.Color. Valid values are 0 through 255. blue: The blue component value for the new System.Drawing.Color. Valid values are 0 through 255. The System.Drawing.Color that this method creates. public static System.Drawing.Color FromArgb(int alpha, System.Drawing.Color basecolor) Creates a System.Drawing.Color structure from the specified System.Drawing.Color structure, but with the new specified alpha value. Although this method allows a 32-bit value to be passed for the alpha value, the value is limited to 8 bits. alpha: The alpha value for the new System.Drawing.Color. Valid values are 0 through 255. basecolor: The System.Drawing.Color from which to create the new System.Drawing.Color. The System.Drawing.Color that this method creates. public static System.Drawing.Color FromArgb(int alpha, int red, int green, int blue) Creates a System.Drawing.Color structure from the four ARGB component (alpha, red, green, and blue) values. Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits. alpha: The alpha component. Valid values are 0 through 255. red: The red component. Valid values are 0 through 255. green: The green component. Valid values are 0 through 255. blue: The blue component. Valid values are 0 through 255. The System.Drawing.Color that this method creates. public float GetBrightness() Gets the hue-saturation-brightness (HSB) brightness value for this System.Drawing.Color structure. The brightness of this System.Drawing.Color. The brightness ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white. public float GetHue() Gets the hue-saturation-brightness (HSB) hue value, in degrees, for this System.Drawing.Color structure. S1 Teknik Informatika UNS [ 10 ]

The hue, in degrees, of this System.Drawing.Color. The hue is measured in degrees, ranging from 0.0 through 360.0, in HSB color space. public float GetSaturation() Gets the hue-saturation-brightness (HSB) saturation value for this System.Drawing.Color structure. The saturation of this System.Drawing.Color. The saturation ranges from 0.0 through 1.0, where 0.0 is grayscale and 1.0 is the most saturated. Property : public byte A { get; } Gets the alpha component value of this System.Drawing.Color structure. The alpha component value of this System.Drawing.Color. public byte B { get; } Gets the blue component value of this System.Drawing.Color structure. The blue component value of this System.Drawing.Color. public byte G { get; } Gets the green component value of this System.Drawing.Color structure. The green component value of this System.Drawing.Color. public byte R { get; } Gets the red component value of this System.Drawing.Color structure. The red component value of this System.Drawing.Color. S1 Teknik Informatika UNS [ 11 ]