/*
* Robert算子梯度
*
*/
public Bitmap RobertGradient(Bitmap myBitmap){
// Create new array
int width = myBitmap.getWidth();
int height = myBitmap.getHeight();
int[] pix = new int[width * height];
myBitmap.getPixels(pix, 0, width, 0, 0, width, height);
Matrix dataR=getDataR(pix, width, height);
Matrix dataG=getDataG(pix, width, height);
Matrix dataB=getDataB(pix, width, height);
//Matrix dataGray=getDataGray(pix, width, height);
/////////////////////////////////////////////////////////
dataR=eachRobertGradient(dataR,width,height);
dataG=eachRobertGradient(dataG,width,height);
dataB=eachRobertGradient(dataB,width,height);
///////////////////////////////////////////////////////////////
// Change bitmap to use new array
Bitmap bitmap=makeToBitmap(dataR, dataG, dataB, width, height);
myBitmap = null;
pix = null;
return bitmap;
}
private Matrix eachRobertGradient(Matrix tempM,int width,int height){
int i,j;
for(i=0;i<width-1;i++){
for(j=0;j<height-1;j++){
int temp=Math.abs((int)tempM.get(i, j)-(int)tempM.get(i,j+1))
+Math.abs((int)tempM.get(i+1,j)-(int)tempM.get(i,j+1));
tempM.set(i, j, temp);
}
}
return tempM;
} 我要用这个功能 其中
Matrix dataR=getDataR(pix, width, height);
Matrix dataG=getDataG(pix, width, height);
Matrix dataB=getDataB(pix, width, height);
这三个函数是不是得自己写实现啊
* Robert算子梯度
*
*/
public Bitmap RobertGradient(Bitmap myBitmap){
// Create new array
int width = myBitmap.getWidth();
int height = myBitmap.getHeight();
int[] pix = new int[width * height];
myBitmap.getPixels(pix, 0, width, 0, 0, width, height);
Matrix dataR=getDataR(pix, width, height);
Matrix dataG=getDataG(pix, width, height);
Matrix dataB=getDataB(pix, width, height);
//Matrix dataGray=getDataGray(pix, width, height);
/////////////////////////////////////////////////////////
dataR=eachRobertGradient(dataR,width,height);
dataG=eachRobertGradient(dataG,width,height);
dataB=eachRobertGradient(dataB,width,height);
///////////////////////////////////////////////////////////////
// Change bitmap to use new array
Bitmap bitmap=makeToBitmap(dataR, dataG, dataB, width, height);
myBitmap = null;
pix = null;
return bitmap;
}
private Matrix eachRobertGradient(Matrix tempM,int width,int height){
int i,j;
for(i=0;i<width-1;i++){
for(j=0;j<height-1;j++){
int temp=Math.abs((int)tempM.get(i, j)-(int)tempM.get(i,j+1))
+Math.abs((int)tempM.get(i+1,j)-(int)tempM.get(i,j+1));
tempM.set(i, j, temp);
}
}
return tempM;
} 我要用这个功能 其中
Matrix dataR=getDataR(pix, width, height);
Matrix dataG=getDataG(pix, width, height);
Matrix dataB=getDataB(pix, width, height);
这三个函数是不是得自己写实现啊
解决方案 »
- [界面设计] 请教安卓中可否把树状列表以另一种更合适的形式展现
- android中的session
- android 使用SDL 报错
- 如何获取Android手机厂商源码?例如三星i5508的源码
- opengl 用什么pack图片啊
- android切换activity的小程序: TextView未在main.xml中声明,而是用new来写的TextView为什么会影响程序运行?
- 装Android的机型有哪些?哪里有比较全面的数据?
- 用List列出了很多图片,怎么选中一个图片实现全屏预览图片
- SearchView问题
- android 如何实现后台运行,并且重新点击app图标后直接显示切入后台时的activity界面
- 在线急等:eclipse怎么导入gradle构建的android项目?
- android热点连接问题
Matrix dataR=getDataR(pix, width, height);
Matrix dataG=getDataG(pix, width, height);
Matrix dataB=getDataB(pix, width, height);
这段代码的功能是啥
对这个Matrix 类也不是很了解