I write This code for display Y1 in pictureBox but when I run program the picture box is empty not display picture,what is error or what method to display image in picture box in c# ??
byte []R = new byte[width, height];//R,G,B arrays not empty it contain data
byte []G = new byte[width, height];
byte []B = new byte[width, height];
Bitmap bmp4 = new Bitmap(width, height);
Int32 zz;
for (int x = 0; x < width; x++)
for (int y = 0; y < height; y++)
{
Y1[x, y] = (0.39 * R[x,y]) + (0.59 * G[x,y]) + (0.12 * B[x,y]);
zz = Convert.ToInt32(Y1[x, y]);
bmp4.SetPixel(x, y, Color.FromArgb(zz));
}
pictureBox6.Image=bmp4;
VulpesPosted Jan 7, 2014, 3:32 PM
byte [] R = new byte[width, height];//R,G,B arrays not empty it contain data
byte [] G = new byte[width, height];
byte [] B = new byte[width, height];
Bitmap bmp4 = new Bitmap(width, height);
Int32 aa, rr, gg, bb;
for (int x = 0; x < width; x++)
for (int y = 0; y < height; y++)
{
aa = 255; // fully opaque
rr = (int)(0.39 * R[x,y] + 0.5); // add 0.5 so doesn't always round down
gg = (int)(0.59 * G[x,y] + 0.5);
bb = (int)(0.12 * B[x,y] + 0.5);
bmp4.SetPixel(x, y, Color.FromArgb(aa, rr, gg, bb));
}
pictureBox6.Image=bmp4;