http://lzy32.blog.163.com/blog/static/3768032320076209273297/
public static Image createImage(Image image,
int x,
int y,
int width,
int height,
int transform)
其中:transform就可以指定要做的操作,比如水平镜像,转90度等
/***************************************************************************
*
* 垂直镜像的方法
*/
public static Image verticalMirror(Image img) {
int[] rgbOutput = null;
int[] rgbInput = null;
int width = 0, height = 0;
int[][] tempArr = null;
try {
width = img.getWidth();
height = img.getHeight();
rgbInput = new int[width * height];
rgbOutput = new int[width * height];
img.getRGB(rgbInput, 0, width, 0, 0, width, height);
int i, j, k;
k = 0;
tempArr = new int[height][width];
for (i = 0; i < height; i++)
for (j = 0; j < width; j++)
tempArr[i][j] = rgbInput[k++];
rgbInput = null;// 显式地设置为空值,告诉系统可以垃圾回收
int[][] tempArr1 = new int[height][width];
for (i = 0; i < height; i++)
for (j = 0; j < width; j++) {
tempArr1[i][width - 1 - j] = tempArr[i][j];
}
tempArr = null;// 显式地设置为空值,告诉系统可以垃圾回收
k = 0;
for (i = 0; i < height; i++)
for (j = 0; j < width; j++) {
rgbOutput[k] = tempArr1[i][j];
k++;
}
tempArr1 = null;// 显式地设置为空值,告诉系统可以垃圾回收
// return img;
return Image.createRGBImage(rgbOutput, width, height, true);
} catch (OutOfMemoryError e) {
// e.printStackTrace();
ImageAlbum.showAlert("图像尺寸太大,不能完成此操作.");
return img;
} finally {
rgbOutput = null;
}
}
/***************************************************************************
*
* 水平镜像的方法
*/
public static Image horizontalMirror(Image img) {
int[] rgbOutput = null;
int[] rgbInput = null;
int width = 0, height = 0;
int[][] tempArr = null;
int[][] tempArr1 = null;
try {
width = img.getWidth();
height = img.getHeight();
rgbInput = new int[width * height];
rgbOutput = new int[width * height];
img.getRGB(rgbInput, 0, width, 0, 0, width, height);
int i, j, k;
k = 0;
tempArr = new int[height][width];
for (i = 0; i < height; i++)
for (j = 0; j < width; j++)
tempArr[i][j] = rgbInput[k++];
rgbInput = null;// 显式地设置为空值,告诉系统可以垃圾回收
tempArr1 = new int[height][width];
for (i = 0; i < height; i++)
for (j = 0; j < width; j++) {
tempArr1[height - 1 - i][j] = tempArr[i][j];
}
tempArr = null;// 显式地设置为空值,告诉系统可以垃圾回收
k = 0;
for (i = 0; i < height; i++)
for (j = 0; j < width; j++) {
rgbOutput[k] = tempArr1[i][j];
k++;
}
tempArr1 = null;// 显式地设置为空值,告诉系统可以垃圾回收
return Image.createRGBImage(rgbOutput, width, height, true);
} catch (OutOfMemoryError e) {
// e.printStackTrace();
ImageAlbum.showAlert("图像尺寸太大,不能完成此操作.");
return img;
} finally {
rgbOutput = null;
}
}
分享到:
相关推荐
实现灰度图像的几何变换、图像平移、垂直水平镜像、图像转置、图像缩放、图像旋转
灰度图像和彩色图像关于水平和垂直的镜像
本代码为MATLAB实现图像的几何变换,包含图像的水平镜像、垂直错切、旋转和加倍,内附有图片经过代码处理后的结果
图像几何变换之镜像,本代码成功实现了图像水平镜像及垂直镜像
用C#写的图形镜像,可以实现水平翻转以及垂直翻转,并且还有动态效果的变换或者直接镜像。
基于空间域的图像镜像变换,对于图像处理初学者有一定的帮助作用!
VC++数字图像处理之图像镜像,实现了图像的水平镜像和垂直镜像 注:本资源和之前博客上资源是连贯的,代码功能是不断的增加的,如果下载了这次的,前面的资源就不用下载了,因为这个代码已经包含了前面的示例代码
Bitmap convert(Bitmap a, int width, int height){int w = a.getWidth();int h = a.getHeight();Bitmap newb = Bitmap.createBitmap(ww, wh, Config.ARGB_8888);... //镜像水平翻转m.postRotate(-
图像处理中对图像方向的调整,可以对原始图像做水平或垂直方向上的镜像处理。
MFC的平台,实现了图像的打开,平移,旋转,水平及垂直镜像,可设置参数
AI Illustator 脚本学习源码 JSX 对象镜像 ,CC及以上可用. 用于对象水平垂直镜像等。无加密,可以直接看源码学习
ov2640摄像头资料及代码
VB 6.0图像 的缩小以及 水平镜像 打开图片的代码 图片地址自己改,缩小是1/4倍 可自行调节所需要的倍数,。镜像是水平镜像,只需改动坐标即可变为垂直镜像。仅供参考
* BOOL blHorizontal - 镜像的方向,TRUE表示水平镜像,FALSE表示垂直镜像 * * 返回值: * BOOL - 镜像成功返回TRUE,否则返回FALSE。 * * 说明: * 该函数用来镜像DIB图像。可以指定镜像的方式是水平...
FlipV:创建垂直镜像图片 glow:加光辉在附近对象的边外 gray:把图片灰度化 invert:反色 light:创建光源在对象上 mask:创建透明掩膜在对象上 shadow:创建偏移固定影子 wave:波纹效果 Xray:...
Vb旋转BMP位图,图像旋转演示源码,完成垂直翻转、水平翻转、90度(逆时针)、90度(顺时针)、180度等,仅对BMP位图支持比较好。
2、该图片上传组件支持图片编辑(水平镜像,垂直镜像,旋转等),支持图片全屏预览. 3、是一个采用ATL+WTL编写超级轻量级组件,运行不依赖MFC库,UImageUploaderD.dll(Release版本)只有164Kb,打成cab包之后会更小. ...
水平镜像、垂直镜像、水平扭曲、垂直扭曲、比例缩放、旋转功能由张敏刚编写。其它功能由胡朝斌编写。易语言图像处理模块源码例程程序通过图像数据的计算,实现图像处理。点评:易语言图像处理模块源码可对24位真彩色...
压缩包内含1张测试用的320x240大小的...RawViewer1.0是一款用于查看播放yuv文件的播放器,支持查看播放及几何变换,可水平镜像、垂直镜像、图像转置、图像缩放与旋转等。 如果打不开图片,请在打开图片时配置图片参数。
垂直镜像与水平镜像类似。 平移: 确定平移方向(水平,垂直),用CDIB::ShowDIB(CDC *pDC, int nLeft, int nTop, int nRight, int nBottom, BYTE *pDIBData, BITMAPINFO* pBMI) 的方法,直接更改显示目标矩形左上...