Bonjour à tous.

Voilà mon soucis.

J'ai une caméra externe avec transmetteur, et récepteur à côté de mon PC (signal analogique).

J'ai acheté un convertisseur analogique numérique, de marque Hauppauge USB-live 2, qui permet de récupérer sur un port USB de mon PC le signal numérique de la caméra (image numérique quoi)/

Avec le logiciel fourni WinTV installé sur mon PC, j'obtiens bien le signal de ma caméra issu du convertisseur Hauppauge !

Seulement voilà, moi je veux récupérer le signal vidéo depuis mon programme OpenCV !

J'ai donc fait ce 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
#include "main.h"
 
using namespace cv;
using namespace std;
 
#include <iostream>
 
using namespace std;
char key;
 
int main()
{
	IplImage *frame = NULL; //Preparing frame pointer
	int key;
 
	//Allocates and initializes cvCapture structure
	// for reading a video stream from the camera.
	//Index of camera is -1 since only one camera
	// connected to the computer or it does not
	// matter what camera to use.
 
	CvCapture *input_camera = cvCaptureFromCAM(-1);
 
	if(input_camera)
	{
		//Grabs and returns a frame from camera
		frame = cvQueryFrame(input_camera);
 
		//Creates window for displaying the frames
		//Flag is reset (0) --> change window size
		// manually
		cvNamedWindow("Capturing Image", 0);
 
		//Change to the appropriate size. In GTK, the
		// inappropriate size will return a segmentation
		// fault. I don't know why ...
		//Gets the appropriate size using cvGetCaptureProperty
		// with CV_CAP_PROP_FRAME_HEIGHT and CV_CAP_PROP_FRAME_WIDTH
		// as property_id
		cvResizeWindow("Capturing Image",
		(int) cvGetCaptureProperty(input_camera, CV_CAP_PROP_FRAME_HEIGHT),
		(int) cvGetCaptureProperty(input_camera, CV_CAP_PROP_FRAME_WIDTH));
 
		while(frame != NULL)
		{
			//Shows a frame
			cvShowImage("Capturing Image", frame);
 
			//Checks if ESC is pressed and gives a delay
			// so that the frame can be displayed properly
			key = cvWaitKey(10);
			if(key == 27)
			break;
			//Grabs and returns the next frame
			frame = cvQueryFrame(input_camera);
		}
 
		//Release cvCapture structure
		cvReleaseCapture(&input_camera);
 
		//Destroy the window
		cvDestroyWindow("Capturing Image");
	}
	else
	{
		cout << "Video stream not found\n\n";
	}
	cvWaitKey(0);
 
	return 0;
}

Lorsque je lance l'exécution sur visual studio (flèche verte), mon convertisseur Hauppauge se met en marche car les voyants s'allument au vert, et une fenêtre s'ouvre (frame) ! SEULEMENT LA FENETRE EST GRISE, AUCUNE IMAGE DESSUS.

Je suppose donc que le codage n'est pas reconnu !! Comment faire ? Je sens que je suis pas encore sorti d'affaires !