Usamos la API de Imagenation (muy vieja pero efectiva). Sacamos N snapshots y medimos el tiempo entre cada una de ellas usando time().
Resultados:
- Snapshots tomados: 120
- fps entre Snapshots: 30
- Tiempo Total: 4000ms
- Tiempo Promedio: 33.3ms (es decir, 30 fps)
Conclusión: el tiempo de transferencia es despreciable o bien se compenza con el tiempo de toma de la próxima foto.
Aquí un snippet del código:
1: int main(int argc, char* arg[])
2: {
3: PXD pxd;
4: FRAMELIB frameLib;
5: long hFG=0;
6: char arcFileName[20];
7: static int num=0;
8:
9: int NO_FRAMES;
10: std::cout << "Ingrese el Nro de imágenes a capturar (30 fps)"; std::cin >> NO_FRAMES;
11:
12: imagenation_OpenLibrary("PXD_32.DLL", &pxd, sizeof(PXD));
13: imagenation_OpenLibrary ("frame_32.dll", &frameLib, sizeof(FRAMELIB));
14:
15:
16: //"tm-9701 progressive free-run.cam";
17: char configFile[] = {"C:\\PXD\\bin\\default.cam"};
18: hFG= pxd.AllocateFG (-1);
19:
20: CAMERA_TYPE *configInMem = pxd.LoadConfig(configFile);
21: pxd.SetCameraConfig(hFG,configInMem);
22: pxd.FreeConfig(configInMem);
23: time_t beginTime, endTime;
24: printf("Inicio de Captura %d imagenes \n\n",NO_FRAMES);
25: time(&beginTime);
26: for(num= 0; num {
27: time(&captureTime);
28: FRAME* pFRAME = pFRAME = pxd.AllocateBufferList (pxd.GetWidth(hFG), pxd.GetHeight(hFG), pxd.GetPixelType(hFG), 1 /*solo un frame*/);
29: pxd.Grab (hFG, pFRAME,IMMEDIATE);
30: sprintf(arcFileName,"30fps%.3d.bmp", num);
31: frameLib.ExtractPlane(pFRAME,1);
32: //frameLib.WriteBMP ( frameLib.ExtractPlane(pFRAME,1), arcFileName,1);
33: frameLib.FreeFrame (pFRAME);
34: }
35:
36: time(&endTime);
37: std::cout << std::endl << "Tiempo Promedio por imagen: " << 1000.0 * (double)difftime(endTime, beginTime) / (float)NO_FRAMES << "ms." << std::endl;
38: pxd.FreeFG (hFG);
39: return 0;
40: }
41:
42: