opencv中Mat和CvMat访问元素的方式

来源:互联网 发布:校园网络规划设计论文 编辑:程序博客网 时间:2024/05/17 06:00

1.Mat类型

for(int i=0;i<1;i++)
{
       double* pLine = (double*)dict_hires.ptr(80);
for(int j=0;j<30;j++)
{
printf(" %f ",pLine[j]);
}
printf("\n");
}

2.CvMat类型

   for(int i=0;i<1;i++)
{
double* pLine = res.conf.V_pca->data.db + 323*(res.conf.V_pca->step/8);//因为double占用 8个字节,所以要除8,也就是step存放每行占用的字节数
for(int j=0;j<30;j++)
{
printf(" %f ",pLine[j]);
}
printf("\n");
}

原创粉丝点击