void Traverse( IplImage* src )
{
if ( src == NULL )
{
return ;
}
const int width = src->width;
const int height = src->height;
const int widthStep = src->widthStep;
const int channels = src->nChannels;
uchar *data = (uchar *)src->imageData;
int* bgr = new int[channels];
for ( int row = 0; row < height; ++row )
{
for ( int col = 0; col < width; ++col )
{
for ( int cha = 0; cha < channels; ++cha )
{
bgr[cha] = (int)data[cha + col * channels + row * widthStep];
}
}
}
delete( bgr );
}
opencv 遍历rgb图
最新推荐文章于 2023-06-14 12:52:48 发布