资源简介
基于JAVA实现的图像特征提取源代码,能够输出图像的七个hu不变量特征,打开eclipse,导入工程,运行Test.java,可以把Test里面的注释弄掉运行更多的功能

代码片段和文件信息
package fq;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.WritableRaster;
import java.io.File;
import javax.imageio.ImageIO;
import fq.Point;
public class FqImage {
public static final double SOBELDOOR = 80.00;
public BufferedImage imh;
public int height;
public int width;
public Point[][] points;
public double[][] sobels;
public int[][] edge;
public double[] colorJuH = new double[4];
public double[] colorJuS = new double[4];
public double[] colorJuV = new double[4];
public double[] huJu = new double[8];
public double getAbsColorDistance( FqImage other ){
int width = FqMath.min(this.width other.width);
int height = FqMath.min(this.height other.height);
int sum = 0;
for( int i = 0 ; i < width ; i++ ){
for( int j = 0 ; j < height ; j++ ){
sum += this.points[i][j].pointDistance(other.points[i][j]);
}
}
return sum;
}
public double f( int i int j ){
double temp = this.points[i][j].getGray();
return temp;
}
public void toSobel(){
double fx fy;
double sobel;
int i j;
for( i = 1 ; i < this.width - 1 ; i++ ){
for( j = 1 ; j < this.height - 1 ; j++ ){
fx = ( f(i-1j-1) + 2*f(i-1j) + f(i-1j+1) ) - ( f(i+1j-1) + 2*f(i+1j) + f(i+1j+1) );
fy = ( f(i-1j-1) + 2*f(ij-1) + f(i+1j-1) ) - ( f(i-1j+1) + 2*f(ij+1) + f(i+1j+1) );
this.sobels[i][j] = FqMath.max( Math.abs(fx) Math.abs(fy) );
}
}
}
public void toEdge(){
int i j;
for( i = 0 ; i < this.width ; i++ ){
for( j = 0 ; j < this.height ; j++ ){
if( this.sobels[i][j] > SOBELDOOR )
this.edge[i][j] = 1;
else
this.edge[i][j] = 0;
}
}
}
public FqImage cutSmallest(){
final double EDGEDOOR = 4;
int i j;
int left = 0;
int right = 0;
int top = 0;
int bottom = 0;
int count = 0;
for( i = 0 ; i < this.width ; i++ ){
count = 0;
for( j = 0 ; j < this.height ; j++ ){
if( this.edge[i][j] == 1 )
count++;
}
if( count >= EDGEDOOR ){
left = i;
break;
}
}
for( i = this.width - 1 ; i >= 0 ; i-- ){
count = 0;
for( j = 0 ; j < this.height ; j++ ){
if( this.edge[i][j] == 1 )
count++;
}
if( count >= EDGEDOOR ){
right = i;
break;
}
}
for( j = 0 ; j < this.height ; j++ ){
count = 0;
for( i = 0 ; i < this.width ; i++ ){
if( this.edge[i][j] == 1 )
count++;
}
if( count >= EDGEDOOR ){
top = j;
break;
}
}
for( j = this.height - 1 ; j >= 0 ; j-- ){
count = 0;
for( i = 0 ; i < this.width ; i++ ){
if( this.edge[i][j] == 1 )
count++;
}
if( count >= EDGEDOOR ){
bottom = j;
break;
}
}
BufferedImage subImh = this.imh.getSubimage(left top right-left bottom-top);
return new FqImage(subImh);
}
public void setCo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-27 15:45 基于JAVA实现的图像特征提取源代码\
文件 6708 2007-07-04 16:28 基于JAVA实现的图像特征提取源代码\FqImage.class
文件 9942 2007-07-04 16:24 基于JAVA实现的图像特征提取源代码\FqImage.java
文件 856 2007-07-04 16:28 基于JAVA实现的图像特征提取源代码\FqMath.class
文件 503 2007-04-20 17:16 基于JAVA实现的图像特征提取源代码\FqMath.java
目录 0 2011-12-27 15:45 基于JAVA实现的图像特征提取源代码\images\
文件 14442 2007-04-17 15:39 基于JAVA实现的图像特征提取源代码\images\1.jpg
文件 1061 2007-07-03 15:22 基于JAVA实现的图像特征提取源代码\images\2.gif
文件 157 2007-04-03 10:15 基于JAVA实现的图像特征提取源代码\images\cross.gif
文件 158 2007-04-03 10:15 基于JAVA实现的图像特征提取源代码\images\not.gif
文件 9216 2008-10-01 12:14 基于JAVA实现的图像特征提取源代码\images\Thumbs.db
文件 4075 2007-07-10 15:09 基于JAVA实现的图像特征提取源代码\Point.class
文件 4156 2007-07-10 15:09 基于JAVA实现的图像特征提取源代码\Point.java
文件 5610 2007-07-10 15:48 基于JAVA实现的图像特征提取源代码\Test.class
文件 6819 2011-12-27 14:57 基于JAVA实现的图像特征提取源代码\Test.java
文件 749 2007-07-04 16:21 基于JAVA实现的图像特征提取源代码\Test2.class
文件 345 2007-07-03 17:03 基于JAVA实现的图像特征提取源代码\Test2.java
- 上一篇:Java五子棋经典程序,非常详细
- 下一篇:java图书馆管理系统项目总结PPT
相关资源
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
- [免费]java实现有障碍物的贪吃蛇游戏
评论
共有 条评论