salut
je travaille sous visual C++ version 6 avec la bibliotheque OPENCV
j'ai realisé ce programme qui sert a convertir une image RGB en HSV et a pouvoir avoir le code hsv d'une couleur à partir d'un clik de souris mais çà fonctionns pas s'il se compile
lors de l'execution , il m'ecrit prog cesse de fonctionner
voilà le code
********************************************************************************************************************
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
#include<cv.h>
#include<highgui.h>
 
 
 
 
IplImage *img;
int h=0, s=0, v=0;
 
void getObjectColor(int event, int x, int y, int flags, void *param = NULL) 
{
 
	// Vars
 
    CvScalar pixel;
	IplImage *hsv;
 
	if(event == CV_EVENT_LBUTTONUP)	{
 
		// Get the hsv image
		hsv = cvCloneImage(img);
		cvCvtColor(img, hsv, CV_BGR2HSV);
 
		// Get the selected pixel
		pixel = cvGet2D(hsv, y, x);
 
		// Change the value of the tracked color with the color of the selected pixel
		h = (int)pixel.val[0];
		s = (int)pixel.val[1];
		v = (int)pixel.val[2];
 
 
	}
 
}
 
 
int main()
 
{
	char key;
	//initialisations
	IplImage *hsv;
	img=cvLoadImage("C:\users\khadija\desktop\defaut.jpg");
	cvNamedWindow("code", CV_WINDOW_AUTOSIZE);
	cvShowImage("code", hsv);
 
	cvSetMouseCallback("code", getObjectColor);
    key = cvWaitKey(0);
 
	return 0;
}


********************************************************************************************************************
j'attends vos reponses
merci