use*_*635 2 optimization opencv image-processing instructions sse2
我刚开始使用SS2优化图像处理,但对于3通道24位彩色图像却不知情.我的pix数据由BGR BGR BGR ...排列,unsigned char 8-bi,所以如果我想用SSE2/SSE3/SSE4的C/C++指令实现Color2Gray,我该怎么办?是否需要对齐我的像素数据(4/8/16)?我读过文章:http://supercomputingblog.com/windows/image-processing-with-sse/ 但它是ARGB 4通道32位颜色,每次都精确处理4色像素数据.谢谢!
//Assume the original pixel:
unsigned char* pDataColor=(unsigned char*)malloc(src.width*src.height*3);//3
//init pDataColor every pix val
// The dst pixel:
unsigned char* pDataGray=(unsigned char*)malloc(src.width*src.height*1);//1
Run Code Online (Sandbox Code Playgroud)
// RGB->灰色:Y = 0.212671*R + 0.715160*G + 0.072169*B.
| 归档时间: |
|
| 查看次数: |
2903 次 |
| 最近记录: |