1 / 19

Praktikum Pengolahan Citra

Praktikum Pengolahan Citra. Pertemuan 12 – Color Model. Color Model. RGB r-g Color Normalized RGB HSV CIE CMYK YCrCb TSL. Format Warna Pada Gambar.

Download Presentation

Praktikum Pengolahan Citra

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Praktikum Pengolahan Citra Pertemuan 12 – Color Model

  2. Color Model • RGB • r-g Color • Normalized RGB • HSV • CIE • CMYK • YCrCb • TSL

  3. Format Warna Pada Gambar • Gambar (Digital) adalahsekumpulantitik yang disusundalambentukmatriks, dannilainyamenyatakansuatuderajatkecerahan (derajatkeabuan/gray-scale). Derajatkeabuan 8 bit menyatakan 256 derajatkecerahan. • Padagambarberwarnanilaisetiaptitiknyaadalahnilaiderajatkeabuanpadasetiapkompoenwarna RGB. Bilamasing-masingkomponen R,G dan B mempunyai 8 bit, makasatutitikdinyatakandengan (8+8+8)=24 bit atau 224derajatkeabuan

  4. Format RGB • Format RGB (Red, Green & Blue) adalah format dasar yang digunakanolehbanyakperalatanelektronikseperti monitor, LCD atau TV untukmenampilkansebuahgambar. • Pada format RGB, suatuwarnadidefinisikansebagaikombinasi (campuran) darikomponenwarna R, G dan B. • Pada format warna RGB 24 bit, makanilai R, G dan B masing-masing 0-255

  5. Format RGB

  6. R-G Color Space • Nilai r-g digunakanuntukmendeteksiwarnakulit, J. Fritsch, S. Lang, M. Kleinehagenbrock, G. A. Fink and G. Sagerer, Improving Adaptive Skin Color Segmentation by Incorporating Results from Face Detection, Proc. IEEE Int. Workshop on Robot and Human Interactive Communication (ROMAN), Berlin, Germany,September 2002. IEEE. • Nilainyaberada 0-1 padasetiapkomponen r dan g

  7. Normalize RGB • Vladimir Vezhnevets Vassili Sazonov Alla Andreeva, ”A Survey on Pixel-Based Skin Color Detection Technique”, Graphics and Media Laboratory, Faculty ofComputational Mathematics and CyberneticsMoscow State University,Moscow, Russia.

  8. HSV (Hue, Saturation, Value)

  9. CIE (Commission Internationale de l’Eclairage) RGB XYZ CIE

  10. CMYK (Cyan, Magenta, Yellow, Black) • R' = R/255 • G' = G/255 • B' = B/255 • K = 1-max(R', G', B') • C = (1-R'-K) / (1-K) • M = (1-G'-K) / (1-K) • Y = (1-B'-K) / (1-K)

  11. YCrCb Y = 0.299R+0.587G+0.114B Cr = R−Y Cb = B−Y

  12. TSL (Tint, Saturation, Lightness) Dimana:

  13. Petunjuk Praktikum • Buatlah form seperti gambar berikut.

  14. Petunjuk Praktikum • Fungsi RGB to CIE. public double[] RgbToCIE(int r, int g, int b) { float Rx = r; float Gx = g; float Bx = b; double X = 0.723 * Rx + 0.273 * Gx + 0.166 * Bx; double Y = 0.265 * Rx + 0.717 * Gx + 0.008 * Bx; double Z = 0.000 * Rx + 0.008 * Gx + 0.824 * Bx; double x = X / (X + Y + Z); double y = Y / (X + Y + Z); double z = 1 - X - Y; double[] cie = { x, y, z }; return cie; }

  15. Petunjuk Praktikum • Fungsi RGB to CMYK. public float[] RgbToCMYK(int r, int g, int b) { float Rx = (float)r / 255; float Gx = (float)g / 255; float Bx = (float)b / 255; float k = 1 - max(Rx, Gx, Bx); float c = (1 - Rx - k) / (1 - k); float m = (1 - Gx - k) / (1 - k); float y = (1 - Bx - k) / (1 - k); float[] cmyk = { c, m, y, k }; return cmyk; }

  16. Petunjuk Praktikum • Fungsi RGB to HSV. public float[] RgbToHSV(int r, int g, int b) { float Rx = (float)r / 255; float Gx = (float)g / 255; float Bx = (float)b / 255; float Cmax = max(Rx, Gx, Bx); float Cmin = min(Rx, Gx, Bx); float d = Cmax - Cmin; float h = 0, s = 0; if (Cmax == Rx) h = 60 * ((Gx - Bx) / d); if (Cmax == Gx) h = 60 * ((Bx - Rx) / d + 2); if (Cmax == Bx) h = 60 * ((Rx - Gx) / d + 4); if (d == 0) s = 0; else s = d / Cmax; float v = Cmax; float[] hsv = { h, s, v }; return hsv; }

  17. Petunjuk Praktikum • Fungsi RGB to HSL. public float[] RgbToHSV(int r, int g, int b) { float Rx = (float)r / 255; float Gx = (float)g / 255; float Bx = (float)b / 255; float Cmax = max(Rx, Gx, Bx); float Cmin = min(Rx, Gx, Bx); float d = Cmax - Cmin; float h = 0, s = 0; if (Cmax == Rx) h = 60 * ((Gx - Bx) / d); if (Cmax == Gx) h = 60 * ((Bx - Rx) / d + 2); if (Cmax == Bx) h = 60 * ((Rx - Gx) / d + 4); if (d == 0) s = 0; else s = d / Cmax; float l = (Cmax + Cmin) / 2; float[] hsl= { h, s, l}; return hsl; }

  18. Capture Program

  19. Tugas • Tambahkan konversi CMYK to RGB, HSV to RGB, HSL to RGB, CIE to RGB. • Tambahkan Fungsi untuk konversi RGB to YCrCb dan sebaliknya!

More Related