因此,在我的图像处理项目中,我目前使用gettickcount()来计算处理每一帧所需的平均时间。但是,为了提高速度,我选择了每隔一帧处理一次。从理论上讲,程序应该运行得更快,事实也的确如此。但是,我从gettickcount获得的值保持不变。这让我相信gettickcount函数仍然在计算程序的未处理图像的节拍。
while(capture.grab())
{
int64 t = getTickCount();
if(count == 0) //count is each image number. this segment processes the first image
{
}
if(count % 2 == 1) //processes every other image
{
}
}即使没有使用getTickCount函数,它是否仍然计算if(count %2 == 1)中的刻度数?
谢谢!
发布于 2013-12-23 02:14:12
#include<stdio.h>
#include<time.h>
int main()
{
clock_t start = clock();
//write your code here, and this will calculate the execution time of the code...
clock_t ends = clock();
printf("run time: %.5f \n", ((double)(ends -
start)) / CLOCKS_PER_SEC);
return 0;
}发布于 2013-07-19 13:36:21
是。不管"count“的值是什么,在while循环的每一次传递中都会调用getTickCount。
尝试:
while(capture.grab())
{
int64 t = 0;
if(count == 0) //count is each image number. this segment processes the first image
{
t = getTickCount();
}
if(count % 2 == 1) //processes every other image
{
t = getTickCount();
}
}https://stackoverflow.com/questions/17738718
复制相似问题