问题描述
- OPENCV中的cvmGet和cvmSet就真的没法用来处理8UC1的数据吗?
-
有什么好的解决办法么?曾经仿照cvmGet写过,可是在处理行列数较大的矩阵时就会出错,还找不到错误原因
不懂原理乱写的。。。
unsigned readmat( const CvMat* mat, int row, int col )
{
int type;type = CV_MAT_TYPE(mat->type); assert( (unsigned)row < (unsigned)mat->rows && (unsigned)col < (unsigned)mat->cols ); if( type == CV_32FC1 ) return ((float*)(mat->data.ptr + (size_t)mat->step*row))[col]; else if(type == CV_64FC1 ) { assert( type == CV_64FC1 ); return ((double*)(mat->data.ptr + (size_t)mat->step*row))[col]; } else { return (((unsigned*)(mat->data.ptr + (size_t)mat->step*row))[col]); }
}
时间: 2025-01-31 01:22:34