Bonjour Tout le monde,

Je viens demander � l'aide, au secours, je n'y comprend plus rien, j'ai un tableau de uchar qui contient des valeurs en niveaux de gris d'une image, je voudrai la mettre dans un picturebox alors j'ai bien essay� des solution mais en vain, auriez vous des id�es ?

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
b_aff_lbl = (UCHAR*) malloc (6982*5677 + 1);
	MbufGet2d(test,0,0,6982,5677,b_aff_lbl);
 
	HBITMAP hBmp;
	hBmp = NULL;
	// 
	DWORD taille;
	HDC hDC;
	hDC = CreateCompatibleDC(NULL);
 
	BITMAPINFO *bi;
 
	bi = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof (RGBQUAD)*256 ); 
	ZeroMemory(bi,sizeof(BITMAPINFOHEADER) + sizeof (RGBQUAD)*256);
	//&bi->bmiColors = (RGBQUAD*)malloc(sizeof (RGBQUAD)*256 );
 
	bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);// + sizeof (RGBQUAD)*256;
	bi->bmiHeader.biWidth = 6982;
	bi->bmiHeader.biHeight = 5677;
	bi->bmiHeader.biBitCount = 8; 
	bi->bmiHeader.biPlanes = 1;
	bi->bmiHeader.biCompression = BI_RGB;
	bi->bmiHeader.biSizeImage = 6982*5677*1;
	bi->bmiHeader.biClrImportant = 256L;
	bi->bmiHeader.biClrUsed = 256L;
 
	for (int i = 0 ; i < 256 ; i++ ) 
	{
	bi->bmiColors[i].rgbBlue = (unsigned char) i;
	bi->bmiColors[i].rgbGreen = (unsigned char) i;
	bi->bmiColors[i].rgbRed = (unsigned char) i;
	bi->bmiColors[i].rgbReserved = 0;
	}
 
	int		nColor = 236;
	LOGPALETTE	*hlogPal;
 
	hlogPal = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + nColor*sizeof(PALETTEENTRY));
	hlogPal->palVersion = 0x300;
	hlogPal->palNumEntries = nColor;
 
	for (int i = 0 ; i < nColor ; i++ ) 
	{
			hlogPal->palPalEntry[i].peRed = i;
			hlogPal->palPalEntry[i].peGreen = i;
			hlogPal->palPalEntry[i].peBlue = i;
	}
	HPALETTE hpal = CreatePalette(hlogPal);
 
	SelectPalette(hDC, hpal, TRUE);
 
 
	hBmp = CreateCompatibleBitmap (hDC, 6982, 5677);
 
	SetDIBits(hDC, hBmp, 0, bi->bmiHeader.biHeight, b_aff_lbl, bi, DIB_RGB_COLORS);
 
	pictureBox1->Image =  Image::FromHbitmap(IntPtr((int)hBmp));

Et l'image charg�e demeure toujours noir

Merci d'avance