້ ງ 2CPR2
ນາງ ນ ັດທິດາ ແສງມະໂນທາ ຫອ
ບ ົດເຝິກຫັດເພີີ່ມເຕີມ
Convert to RGB
1. ໂຫຼດຮູບພາບ
2. Color Transfomation Menu
1.
2.
3.
4.
5.
6.
using [Link];
using [Link];
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace Lab_Imageprocessing
{
public partial class ConvertRGB : Form
{
public ConvertRGB()
{
InitializeComponent();
}
Image<Bgr, byte> imgInput;
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog opf = new OpenFileDialog();
if ([Link]() == [Link])
{
imgInput = new Image<Bgr, byte>([Link]);
[Link] = [Link];
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
[Link]();
}
private void bGRGrayToolStripMenuItem_Click(object sender, EventArgs e)
{
if (imgInput == null)
[Link]("Please select an image.");
return;
Image<Gray, byte> imgOutput = new Image<Gray, byte>([Link],
[Link], new Gray(0));
[Link](imgInput, imgOutput,
[Link].Bgr2Gray);
[Link] = [Link];
}
private void bGRYCrCbToolStripMenuItem_Click(object sender, EventArgs e)
{
if (imgInput == null)
{
[Link]("Please select an image.");
return;
}
Image<Ycc, byte> imgOutput = new Image<Ycc, byte>([Link],
[Link]);
Image<Bgr, byte> imgFinalOutput = new Image<Bgr,
byte>([Link], [Link]);
[Link](imgInput, imgOutput,
[Link].Bgr2YCrCb);
[Link] = [Link];
[Link] = [Link];
}
private void bGRHSVToolStripMenuItem_Click(object sender, EventArgs e)
{
if (imgInput == null)
{
[Link]("Please select an image.");
return;
}
Image<Hsv, byte> imgOutput = new Image<Hsv, byte>([Link],
[Link]);
Image<Bgr, byte> imgFinalOutput = new Image<Bgr,
byte>([Link], [Link]);
[Link](imgInput, imgOutput,
[Link].Bgr2Hsv);
[Link] = [Link];
[Link] = [Link];
}
private void bGRLUVToolStripMenuItem_Click(object sender, EventArgs e)
{
if (imgInput == null)
{
[Link]("Please select an image.");
return;
}
Image<Luv, byte> imgOutput = new Image<Luv, byte>([Link],
[Link]);
Image<Bgr, byte> imgFinalOutput = new Image<Bgr,
byte>([Link], [Link]);
//imgOutput = [Link]<Gray, byte>();
[Link](imgInput, imgOutput,
[Link].Bgr2Luv);
[Link] = [Link];
[Link] = [Link];
}
private void bGRLabToolStripMenuItem_Click(object sender, EventArgs e)
{
if (imgInput == null)
{
[Link]("Please select an image.");
return;
}
Image<Lab, byte> imgOutput = new Image<Lab, byte>([Link],
[Link]);
Image<Bgr, byte> imgFinalOutput = new Image<Bgr,
byte>([Link], [Link]);
//imgOutput = [Link]<Gray, byte>();
[Link](imgInput, imgOutput,
[Link].Bgr2Lab);
[Link] = [Link];
[Link] = [Link];
}
private void bGRHSLToolStripMenuItem_Click(object sender, EventArgs e)
{
if (imgInput == null)
{
[Link]("Please select an image.");
return;
}
Image<Hls, byte> imgOutput = new Image<Hls, byte>([Link],
[Link]);
Image<Bgr, byte> imgFinalOutput = new Image<Bgr,
byte>([Link], [Link]);
//imgOutput = [Link]<Gray, byte>();
[Link](imgInput, imgOutput,
[Link].Bgr2Hls);
[Link] = [Link];
[Link] = [Link];
}
}
}