struct timeval tvgz1,tvgz2,tvgz3,tvgz4,tvgz5;
float t1,t2,t3,t4,t5;
gettimeofday(&tvgz1, NULL); //开始计时
/***待测试函数***/
gettimeofday(&tvgz2, NULL); //结束计时
t1 = (float)((tvgz2.tv_sec - tvgz1.tv_sec) * 1000000 + tvgz2.tv_usec - tvgz1.tv_usec) / 1000000; //测算运行时间
t2 = 1.0 / t1; //由测算时间,计算帧率
printf("目标函数运行时间: %d \n", (int)t1);
printf("目标函数发送帧率: %d \n", (int)t2);
The above code can be used to calculate the running time of a section or a function, and the value of the frame rate of the transmitted image;
Posted below is the code used to save image data;
sprintf(filename, "%保存图片的名字t_%d.rgb",CAMERA_DUMP_PATH,picIndex++);
this->perception_pic1->dumpFile(filename);
其中:CAMERA_DUMP_PATH 对图片保存的路径做出限制
#define CAMERA_DUMP_PATH "./"
picIndex++ 用于循环保存