bonjour,
je voudrais tracker un objet , pour cela premièrement il faut le détecter j'ai essayer de le detecter dans une simple image et ça marche parfaitement
mais je voudrais maintenant travaillé dans un vidéo et je voudrais faire mes calcules pour chaque frame avec le frame précédent . mon problème et que je n'arrive pas à enregistrer le premier frame pour mes calcules
pour deux image j'ai fais ça
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
int main(int argc, char* argv[])
{
	// Ask user to enter image warp paremeters vector.
	// p = (wz, tx, ty),
 
	float WZ=0, TX=0, TY=0;
	printf("Please enter WZ, TX and TY, separated by space.\n");
	printf("Example: -0.01 5 -3\n");
	printf(">");
	scanf("%f %f %f", &WZ, &TX, &TY);
 
	// Here we will store our images.
	IplImage* pColorPhoto = 0; // Photo of a butterfly on a flower.
	IplImage* pGrayPhoto = 0;  // Grayscale copy of the photo.
	IplImage* pImgT = 0;	   // Template T.
	IplImage* pImgI = 0;	   // Image I.
 
	// Here we will store our warp matrix.
	CvMat* W = 0;  // Warp W(p)
 
	// Create two simple windows. 
	cvNamedWindow("template"); // Here we will display T(x).
	cvNamedWindow("image"); // Here we will display I(x).
 
	// Load photo.
	pColorPhoto = cvLoadImage("..\\data\\photo.jpg");
 
	// Create other images.
	CvSize photo_size = cvSize(pColorPhoto->width,pColorPhoto->height);
	pGrayPhoto = cvCreateImage(photo_size, IPL_DEPTH_8U, 1);
	pImgT = cvCreateImage(photo_size, IPL_DEPTH_8U, 1);
	pImgI = cvCreateImage(photo_size, IPL_DEPTH_8U, 1);
 
	// Convert photo to grayscale, because we need intensity values instead of RGB.	
	cvCvtColor(pColorPhoto, pGrayPhoto, CV_RGB2GRAY);
 
	// Create warp matrix, we will use it to create image I.
	W = cvCreateMat(3, 3, CV_32F);
 
	// Create template T
	// Set region of interest to butterfly's bounding rectangle.
	cvCopy(pGrayPhoto, pImgT);
	CvRect omega = cvRect(110, 100, 200, 150);
 
	// Create I by warping photo with sub-pixel accuracy. 
	init_warp(W, WZ, TX, TY);
	warp_image(pGrayPhoto, pImgI, W);
 
	// Draw the initial template position approximation rectangle.
	cvSetIdentity(W);
	draw_warped_rect(pImgI, omega, W);
 
	// Show T and I and wait for key press.
	cvSetImageROI(pImgT, omega);
	cvShowImage("template", pImgT);
	cvShowImage("image", pImgI);
	printf("Press any key to start Lucas-Kanade algorithm.\n");
	cvWaitKey(0);
	cvResetImageROI(pImgT);
 
	// Print what parameters were entered by user.
	printf("==========================================================\n");
	printf("Ground truth:  WZ=%f TX=%f TY=%f\n", WZ, TX, TY);
	printf("==========================================================\n");
 
	init_warp(W, WZ, TX, TY);
 
	// Restore image I
	warp_image(pGrayPhoto, pImgI, W);
 
	/* Lucas-Kanade */	
	align_image_forwards_additive(pImgT, omega, pImgI);
 
	// Restore image I
	warp_image(pGrayPhoto, pImgI, W);
 
	printf("Press any key to start Baker-Dellaert-Matthews algorithm.\n");
	cvWaitKey();
 
	/* Baker-Dellaert-Matthews*/
	align_image_inverse_compositional(pImgT, omega, pImgI);
 
	printf("Press any key to exit the demo.\n");
	cvWaitKey();
 
	// Release all used resources and exit
	cvDestroyWindow("template");
	cvDestroyWindow("image");
	cvReleaseImage(&pImgT);
	cvReleaseImage(&pImgI);
	cvReleaseMat(&W);
 
	return 0;
}
mais j'ai pas pus le modéfié pour que le image se sont de frame