镜像
来源:互联网 发布:中科大网络大学报名 编辑:程序博客网 时间:2024/05/20 05:03
#if 1#include <iostream>#include <cv.h>#include <highgui.h>#include <imgproc/imgproc.hpp>#include <iostream>#include <math.h>using namespace std;using namespace cv;#define PI 3.1415926int main(int argc, const char * argv[]){ //1:load source image Mat image = imread("/Users/hanoi/Desktop/copy.jpeg"); if(image.empty()) { printf("it can not load image\n"); return 0; } int height = image.rows; int width = image.cols; Mat destImage; destImage.create(height, 2*width, image.type()); memset(destImage.data, 0, 2*height*width*3); for (int j=0; j<height; j++) { for(int i=0; i<width; i++) { *(destImage.data + j*destImage.step + 3*i) = *(image.data + j*image.step + 3*i); *(destImage.data + j*destImage.step + 3*i + 1) = *(image.data + j*image.step + 3*i + 1); *(destImage.data + j*destImage.step + 3*i + 2) = *(image.data + j*image.step + 3*i +2); } } for (int j=0; j<height; j++) { for(int i=0; i<width; i++) { if(i == 0) { *(destImage.data + j*destImage.step + 3*(i+width)) = *(image.data + j*image.step + 3*(width-1)); *(destImage.data + j*destImage.step + 3*(i+width) + 1) = *(image.data + j*image.step + 3*(width-1) + 1); *(destImage.data + j*destImage.step + 3*(i+width) + 2) = *(image.data + j*image.step + 3*(width-1) + 2); } else { *(destImage.data + j*destImage.step + 3*(i+width)) = *(image.data + j*image.step + 3*(width-i)); *(destImage.data + j*destImage.step + 3*(i+width) + 1) = *(image.data + j*image.step + 3*(width-i) + 1); *(destImage.data + j*destImage.step + 3*(i+width) + 2) = *(image.data + j*image.step + 3*(width-i) + 2); } } } imwrite("/Users/hanoi/Desktop/镜像.bmp", destImage); return 0;}#endif
0 0
- 镜像
- 镜像
- 镜像
- 镜像
- 镜像
- 镜像
- Ghost镜像与wim镜像
- 图像镜像之水平镜像
- 图像镜像之竖直镜像
- 端口镜像详解
- 镜像之城
- 关于镜像
- 端口镜像详解
- SQLserver2005 数据库镜像
- 绘制镜像字体
- 镜像劫持
- 制作iso镜像
- 制作文件系统镜像
- 简单工厂模式——把生产方法封装起来
- 生命周期 Service
- android studio基本界面设置
- 工厂方法模式——办分厂
- 新开一个博客
- 镜像
- C语言概述
- JVM致命错误日志(hs_err_pid.log)解读
- python opencv(4) 调节图像亮度
- STM32F427 内部晶振初始化
- 以muppet为例利用模板方法模式增强异常信息的反馈
- 37. customer payment(1)
- MATLAB中sum函数的用法
- cout的输出格式(转)