图片翻转(Raw Image)
2024-08-21 14:48:44
int TransformImageBuffer(unsigned char* pImageBuffer, int width, int height,unsigned char* targetImageBuffer)
{
//center flip
int nRet = ;
int length = width * height;
for(int i = ; i < length / ; i++)
{
targetImageBuffer[i] = pImageBuffer[length -i -];
targetImageBuffer[length -i -] = pImageBuffer[i];
}
//vertical flip
for(int h = ; h < height; h++)
{
int firstLine = h * width;
for(int w = ; w < width /; w++)
{
int temp = targetImageBuffer[firstLine + w];
targetImageBuffer[firstLine + w] = targetImageBuffer[firstLine + width - w - ];
targetImageBuffer[firstLine + width - w - ] = temp;
}
} //horizon flip
for(int i = ; i < length /; i++)
{
int line = i / width;
int seq = i % width;
int mirrorPoint = (height - line - ) * width - + seq;
targetImageBuffer[i] = pImageBuffer[mirrorPoint];
targetImageBuffer[mirrorPoint] = pImageBuffer[i];
}
return nRet;
}
最新文章
- css-使用line-height实现垂直居中的一些问题
- LINUX下搭建VPN
- POJ 1450
- About GAC
- 【HDOJ】3487 Play with Chain
- 查找IP来源
- 基于纹理边缘抑制的轮廓和边界检测(Contour and Boundary Detection)
- spring4.2完整web项目(使用html视图解析器)
- MyBatis 源码分析——SqlSession接口和Executor类
- Swift学习笔记7--访问控制
- Sitecore CMS中查看标准字段
- go语言中的坑
- Codeforces 757C. Felicity is Coming!
- numpy数组-标准化数据
- 使用zabbix发送邮件的简易设置流程(存档用)
- vSphere下安装Hyper-V
- 【centOS7】centOS7上普通用户切换root用户,相互切换
- 个人项目-数组求和(语言:C++)
- AMD、CMD、CommonJs和 ES6对比
- Zookeeper简介和安装(四)