彩色相机 RGB8转 RGBPlanar格式
为啥要这样转呢,我可能是为了查分通道方便吧
有些缺陷特征,r通道明显,就只需要处理R通道的图像,能够提升效率
int RGB_Packed2Planar(unsigned char* packed,unsigned char* planar,int width,int height)
{
if ( NULL == packed)
{
return MV_E_PARAMETER;
}
unsigned char* p_img = packed;
unsigned char* p_r = planar;
unsigned char* p_g = planar + height*width;
unsigned char* p_b = planar + height*width * 2;
for(int i = 0; i<height*width; i++)
{
p_r[i] = p_img[i*3]; //0、3、6
p_g[i] = p_img[i*3+1]; //1、4、7
p_b[i] = p_img[i*3+2]; //2、5、8
}
return 0;
}