网站建设资讯

NEWS

网站建设资讯

图像可识别java代码 图像识别 java

Java 可不可以做图像识别的系统

当然可以。

公司主营业务:成都网站建设、做网站、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。成都创新互联是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。成都创新互联推出同江免费做网站回馈大家。

一、纯JAVA开发的技术可行性,即JAVA是否能够实现图像识别的各种算法。

二、如果第一点没有问题,纯JAVA与C++相比,开发效率上的差异。效率要低很多,和具体问题有关。

三、如果第一点没有问题且第二点差异不太大时,纯JAVA与C++相比,相同算法的情况下,软件运行效率的差异。运行效率的差异也很大,也是和具体的算法有关。

Java 图像识别 数字图像处理 从一张JPG图片中识别出若干黑色小方块

你需要关注的主要是这个类:java.awt.image.BufferedImage

可以查阅相关的API。

java图像处理技术在《java核心技术8 下卷》中有比较详细的介绍。

相关技术要求和注意事项:RGB标准、ICC配置特性、

建议如果进行像素识别的话可以选取关键点的识别方式、而且确认像素是否符合要求使用RGB的范围识别而非精确识别。

至于具体的识别操作过程,需要你详细定义开始识别的位置标准(规定的或者识别图像获取)、边界标准、大小(识别块得SIZE)、分组(给识别块确定属性)等

给定一幅图像,用java读取每个像素的RGB三个颜色值

int rgbR;

int rgbG;

int rgbB;

int minx = 0;

int miny = 0;

try {

File file = new File("E:\\dd.png");

BufferedImage image = ImageIO.read(file);

int width = image.getWidth();//图片宽度

int height = image.getHeight();//图片高度

for (int i = minx; i width; i++) {

for (int j = miny; j height; j++) {

int pixel = image.getRGB(i, j); // 下面三行代码将一个数字转换为RGB数字

rgbR = (pixel 0xff0000) 16;

rgbG = (pixel 0xff00) 8;

rgbB = (pixel 0xff);

System.out.println("i=" + i + ",j=" + j + ":(" + rgbR + "," + rgbG + "," + rgbB + ")");

}

}

System.out.println("图片宽度为:"+width+",高度为:"+height);

} catch (IOException e) {

System.out.println("读取文件出错");

e.printStackTrace();

}

java 实现图片的文字识别

摘要图像识别是目前很热门的研究领域,涉及的知识很广,包括信息论、模式识别、模糊数学、图像编码、内容分类等等。本文仅对使用Java实现了一个简单的图像文本二值处理,关于识别并未实现。

步骤

建立文本字符模板二值矩阵

对测试字符进行二值矩阵化处理

代码

/*

* @(#)StdModelRepository.java

*

* This program is free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 3 of the License, or

* (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU Library General Public License for more details.

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

package cn.edu.ynu.sei.recognition.util;import java.awt.Image;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import java.util.ArrayList;import java.util.List;import java.util.logging.Level;import java.util.logging.Logger;import javax.imageio.ImageIO;/** * Hold character charImgs as standard model repository.

* @author 88250

* @version 1.0.0.0, Mar 20, 2008

*/

public class StdModelRepository {

/** * hold character images

*/ List charImgs = new ArrayList();

/** * default width of a character

*/ static int width = 16 /** * default height of a character

*/ static int height = 28 /** * standard character model matrix

*/ public int[][][] stdCharMatrix = new int[27][width][height];

/** * Default constructor.

*/ public StdModelRepository() {

BufferedImage lowercase = null try {

lowercase = ImageIO.read(new File("lowercase.png"));

} catch (IOException ex) {

Logger.getLogger(StdModelRepository.class.getName()).

log(Level.SEVERE, null, ex);

}

for (int i = 0 i 26 i++) {

charImgs.add(lowercase.getSubimage(i * width,

0,

width,

height));

}

for (int i = 0 i charImgs.size(); i++) {

Image image = charImgs.get(i);

int[] pixels = ImageUtils.getPixels(image,

image.getWidth(null),

image.getHeight(null));

stdCharMatrix[i] = ImageUtils.getSymbolMatrix(pixels, 0).clone();

ImageUtils.displayMatrix(stdCharMatrix[i]);

}

}

}

/*

* @(#)ImageUtils.java

*

* This program is free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 3 of the License, or

* (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU Library General Public License for more details.

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

package cn.edu.ynu.sei.recognition.util;import java.awt.Image;import java.awt.image.PixelGrabber;import java.util.logging.Level;import java.util.logging.Logger;/** * Mainipulation of image data.

* @author 88250

* @version 1.0.0.3, Mar 20, 2008

*/

public class ImageUtils {

/** * Return all of the pixel values of sepecified codeimage .* @param image the sepecified image

* @param width width of the image

* @param height height of the image

* @return */ public static int[] getPixels(Image image, int width, int height) {

int[] pixels = new int[width * height];

try {

new PixelGrabber(image, 0, 0, width, height, pixels, 0, width).grabPixels();

} catch (InterruptedException ex) {

Logger.getLogger(ImageUtils.class.getName()).

log(Level.SEVERE, null, ex);

}

return pixels;

}

资源来自:


当前标题:图像可识别java代码 图像识别 java
文章出自:http://cdweb.net/article/ddeegod.html