template<class T>
void cplot::plot(T *X, T *Y, int Cnt, CvScalar color, char type,bool is_need_lined){
//对数据进行存储
T tempX, tempY;
vector<CvPoint2D64f>data;
for(int i = 0; i < Cnt;i++) {
if(this->dataset.size())
{
tempX = X[i]-this->orign_x;
tempY = Y[i]-this->orign_y;
}
data.push_back( cvPoint2D64f((double)tempX, (double)tempY) );
}
}
记住,这种情况下,函数定义在头文件里面,编译才不会出错
2.处理错误
由于许多CUDA函数调用是异步的,所以有时很难确定某个错误是由哪一步程序引起的:
#define CHECK(call)
{
const cudaError_t error=call;
if(error!=cudaSuccess)
{
printf("%s %d\n",__FILE__,__LINE__);//显示代码的行数,文件
printf("code:%d reason:%s\n",error,cudaGetErrorString(error))//显示错误
exit(1);
}
}
3. mkdir
#include "sys/stat.h"