rgb格式转换

该博客主要围绕RGB格式转换展开,但具体转换细节及相关信息因内容缺失暂不明确。RGB格式转换在图像处理等信息技术领域有重要应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

void cvtColorBgrC2RgbP(unsigned char* dst, unsigned char* src, int width, int height)
{
	int picSize = width * height;
	unsigned char* dstC0 = dst;
	unsigned char* dstC1 = dst + picSize;
	unsigned char* dstC2 = dst + 2*picSize;
	int mulWidth = 3 * width;

	for (int h = 0; h < height; h++)
	{
		for (int w = 0, w1 = 0; w < width; w ++, w1 += 3)
		{
			dstC0[w] = src[w1 + 2];
			dstC1[w] = src[w1 + 1];
			dstC2[w] = src[w1    ];
		}
		src   += mulWidth;
		dstC0 += width;
		dstC1 += width;
		dstC2 += width;
	}
}

void cvtColorRgbP2BgrC(unsigned char* dst, unsigned char* src, int width, int height)
{
	int picSize = width * height;
	int mulWidth = 3 * width;

	unsigned char* src0 = src;
	unsigned char* src1 = src + picSize;
	unsigned char* src2 = src + 2*picSize;

	for (int h = 0; h < height; h++)
	{
		for (int w = 0, w1 = 0; w < width; w ++, w1 += 3)
		{
			dst[w1]     = src2[w];
			dst[w1 + 1] = src1[w];
			dst[w1 + 2] = src0[w];
		}
		src0 += width;
		src1 += width;
		src2 += width;
		dst += mulWidth;
	}
}

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值