新人,求助大神
opencv吧
全部回复
仅看楼主
level 1
1342054842 楼主
请大神帮忙,我想用当前时间作为保存图像的文件名,代码如下,一直显示Unhandled exception at 0x7694C54F in Marker识别.exe: Microsoft C++ exception: cv::Exception at memory location 0x0036EBBC.
pFrame = cvQueryFrame(pCapture);
time_t timeSec = time(NULL);
struct tm * timeinfo = localtime(&timeSec);//创建TimeDate,并转化为当地时间,
//struct tm * timeinfo = gmtime ( &timeSec ); //创建TimeDate,并转化为GM时间,
//获取年 月 日 时 分 秒 对应的int值:
//printf("%d-%d-%d %d:%d:%d\n", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
char filename[255] = {"0"};
sprintf(filename, "%d.%d.%d.%d.%d.%d",timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
cvSaveImage(filename, pFrame);//只有8位单通道或者3通道(通道顺序为'BGR' )可以使用这个函数保存
2017年08月15日 05点08分 1
level 7
好象没有扩展名耶?
2017年08月15日 06点08分 2
函数cvSaveImage保存图像到指定文件。图像格式的的选择依赖于filename的扩展名,请参考cvLoadImage。
2017年08月15日 06点08分
level 1
1342054842 楼主
大神们能写一下代码吗 万分感谢
2017年08月15日 06点08分 3
level 1
1342054842 楼主
加上扩展名又出现另外一个错误
2017年08月15日 06点08分 4
level 1
1342054842 楼主
pFrame = cvQueryFrame(pCapture);
cvSaveImage(“new.JPG”, pFrame);
如果只是保存图片能运行,就是下一帧覆盖上一帧
2017年08月15日 06点08分 5
1