範例為 cols 640 x row 480
OpenCV 的 char* 的顏色順序是 (B,G,R)
if (Camera_Setting.Camera_Video_Capture(ref Camera_Buffer, Camera_len_Buffer))
{
int Height = 480;
int Width = 640;
pictureBox_Camera1.Height = Height;
pictureBox_Camera1.Width = Width;
Bitmap image1 = new Bitmap(Width, Height);
for (int y = 0; y < Height; y++)
{
for (int x = 0; x < Width; x++)
{
byte R_color = Camera_Buffer[(x * 3 + 2) + y * Width * 3];
byte G_color = Camera_Buffer[(x * 3 + 1) + y * Width * 3];
byte B_color = Camera_Buffer[(x * 3 + 0) + y * Width * 3];
Color newColor = Color.FromArgb(R_color, G_color, B_color);
image1.SetPixel(x, y, newColor);
}
}
pictureBox_Camera1.Image = image1;
}