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图
原文作者:数据结构之图
原文地址: https://blog.csdn.net/u011504498/article/details/44589817
本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
原文地址: https://blog.csdn.net/u011504498/article/details/44589817
本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。