0% found this document useful (0 votes)
112 views5 pages

Laporan Color Detection

The document reports on color detection experiments on face and flower images. It develops a Color Detection form application in C# to detect skin color ranges in faces and specific color ranges for flowers. Sample face and flower images are opened and their RGB pixel values are analyzed to identify and keep skin and flower colored pixels and filter others out, displaying the results. Static detection uses RGB ranges while distance detection computes the distance between each pixel color and target color.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views5 pages

Laporan Color Detection

The document reports on color detection experiments on face and flower images. It develops a Color Detection form application in C# to detect skin color ranges in faces and specific color ranges for flowers. Sample face and flower images are opened and their RGB pixel values are analyzed to identify and keep skin and flower colored pixels and filter others out, displaying the results. Static detection uses RGB ranges while distance detection computes the distance between each pixel color and target color.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

LAPORAN RESMI

PENGOLAHAN CITRA
(Color Detection)

Arrachmad Nur Fauzie


2103187087

PJJ D3 AK TEKNIK INFORMATIKA


POLITEKNIK ELEKTRONIKA NEGERI SURABAYA
2018
Laporan resmi color detection pada sampel wajah dan bunga tentukan range rgb pada
static detection dan rata2 rgb pada distance detection.

Membuat Form Color Detection

Color Detection pada wajah


namespace ColorDetiction
{
public partial class Form1 : Form
{
Bitmap objBitmap;
Bitmap objBitmap1;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
DialogResult d = openFileDialog1.ShowDialog();
if (d == DialogResult.OK)
{
objBitmap = new Bitmap(openFileDialog1.FileName);
pictureBox1.Image = objBitmap;
}
}

private void button2_Click(object sender, EventArgs e)


{
objBitmap1 = new Bitmap(objBitmap);
Color w1;
for (int x = 1; x < objBitmap1.Width - 1; x++)
for (int y = 1; y < objBitmap1.Height - 1; y++)
{
Color w = objBitmap1.GetPixel(x, y);
if (((w.R > 102) && (w.R < 160)) && ((w.G > 70) && (w.G < 100)) &&
((w.B > 0) && (w.B > 50)))
w1 = Color.FromArgb(w.R, w.G, w.B);
else
w1 = Color.FromArgb(0, 0, 0);
objBitmap1.SetPixel(x, y, w1);
}
pictureBox2.Image = objBitmap1;

private void button3_Click(object sender, EventArgs e)


{
objBitmap1 = new Bitmap(objBitmap);
Color w1; int d;
int r = 144, g = 89, b = 65;
for (int x = 1; x < objBitmap1.Width - 1; x++)
for (int y = 1; y < objBitmap1.Height - 1; y++)
{
Color w = objBitmap1.GetPixel(x, y);
d = Math.Abs(w.R - r) + Math.Abs(w.G - g) + Math.Abs(w.B - b);
if (d < 300)
w1 = Color.FromArgb(w.R, w.G, w.B);
else
w1 = Color.FromArgb(0, 0, 0);
objBitmap1.SetPixel(x, y, w1);
}
pictureBox3.Image = objBitmap1;
}
}
}

Hasil
Color Detection pada bunga
namespace ColorDetiction
{
public partial class Form1 : Form
{
Bitmap objBitmap;
Bitmap objBitmap1;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
DialogResult d = openFileDialog1.ShowDialog();
if (d == DialogResult.OK)
{
objBitmap = new Bitmap(openFileDialog1.FileName);
pictureBox1.Image = objBitmap;
}
}

private void button2_Click(object sender, EventArgs e)


{
objBitmap1 = new Bitmap(objBitmap);
Color w1;
for (int x = 1; x < objBitmap1.Width - 1; x++)
for (int y = 1; y < objBitmap1.Height - 1; y++)
{
Color w = objBitmap1.GetPixel(x, y);
if (((w.R > 200) && (w.R < 220)) && ((w.G > 15) && (w.G < 50)) &&
((w.B > 0) && (w.B > 20)))
w1 = Color.FromArgb(w.R, w.G, w.B);
else
w1 = Color.FromArgb(0, 0, 0);
objBitmap1.SetPixel(x, y, w1);
}
pictureBox2.Image = objBitmap1;

private void button3_Click(object sender, EventArgs e)


{
objBitmap1 = new Bitmap(objBitmap);
Color w1; int d;
int r = 212, g = 20, b = 16;
for (int x = 1; x < objBitmap1.Width - 1; x++)
for (int y = 1; y < objBitmap1.Height - 1; y++)
{
Color w = objBitmap1.GetPixel(x, y);
d = Math.Abs(w.R - r) + Math.Abs(w.G - g) + Math.Abs(w.B - b);
if (d < 300)
w1 = Color.FromArgb(w.R, w.G, w.B);
else
w1 = Color.FromArgb(0, 0, 0);
objBitmap1.SetPixel(x, y, w1);
}
pictureBox3.Image = objBitmap1;
}
}
}

Hasil

You might also like