Bonjour, je réalise une application mobile pour un smartphone (windows mobile 6) qui va devoir lire des code-barres. J'utilise des boites de dialogues pour la réaliser

Pour l'instant, j'ai réussi à coder la partie qui me permet d'utiliser la caméra du smartphone et de prendre une photo. j'ai utiliser l'API SHCAMERACAPTURE.
J'ai aussi coder la partie qui stock et affiche l'image.

J'aimerais convertir l'image en niveaux gris. Mon image a une résolution de 2Mégapixel . Votre aide serait la bienvenue, je suis perdu sur cette partie.


voici une partie du code c++ de mon projet.
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
//Capture d'une image avec caméra du smartphone
void CcameraDlg::OnBnClickedButton3()
{
// Capture de l'image
SHCAMERACAPTURE shcc;
ZeroMemory(&shcc,sizeof(SHCAMERACAPTURE));
shcc.cbSize= sizeof(SHCAMERACAPTURE);
shcc.hwndOwner= m_hWnd;
shcc.pszInitialDir = TEXT("\\My Documents");
shcc.pszDefaultFileName = TEXT("test.jpg");
shcc.pszTitle = TEXT("Camera");
shcc.VideoTypes = CAMERACAPTURE_VIDEOTYPE_ALL;
// Résolution 2M (1600*960) 3M (2048*1232) 5M (2592*1552)
// Resolution L (640*384) par defaut
shcc.nResolutionWidth = IMG_WIDTH;
shcc.nResolutionHeight = IMG_HEIGHT;
shcc.nVideoTimeLimit = 1;
shcc.Mode = CAMERACAPTURE_MODE_STILL;
shcc.StillQuality = CAMERACAPTURE_STILLQUALITY_HIGH;
HRESULT H=SHCameraCapture(&shcc);
 
}
 
//Affichage de l'image capturée en mode normal
void CcameraDlg::OnBnClickedButton6()
{
CDC * pDC = GetDC();
HBITMAP Hbitmap=SHLoadImageFile(_T("\\My Documents\\test.jpg"));
if(Hbitmap)
{
 
CBitmap bitmap;
bitmap.Attach(Hbitmap);
 
BITMAP bmpInfo;
bitmap.GetBitmap(&bmpInfo);
 
CDC bitmapDC;
bitmapDC.CreateCompatibleDC(pDC);
bitmapDC.SelectObject(&bitmap);
CRect RC;
GetClientRect(&RC);
pDC->StretchBlt(0, 0, RC.Width(), RC.Height(), &bitmapDC,
0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, SRCCOPY);
bitmapDC.DeleteDC();
bitmap.DeleteObject();
}
}
 
 
 
//Conversion et affichage l'image en niveau de gris
void CcameraDlg::OnBnClickedButton1()
{
 
}