㈠ 用JAVA编写一个程序识别图片上的文字
这种想法太疯狂了。。目前能实现辨别图片里的数字是正常的,辨别英文也有点难度,中文就更难了。。辨别图像里面的文字数字,不是想象的那么简单的,要从像素着手的,比较特定区域的像素,然后程序做出判断,程序实现起来还是比较复杂的
㈡ java有读取图片里面文字的方法吗
使用tesseract-ocr,可以识别简单的验证码,中文没尝试过
㈢ java判断图片是否有中文
ImageIcon类里面本身没有提供图片比较的方法
如果楼主是想比较ImageIcon的来源是不是一样
最好是自己程序里面记录下来图片的Url或者文件地址
根据自己保存的来源来判断一不一样
如果是想判断两张来源不同的图片是不是相等
那就得用到图像判断了
可以从ImageIcon中把图片去出来用getImage()获得到Image对象
把Image对象转成BufferedImage对象
然后比较每个像素点的颜色
有不一样的就说明不是一张图片了
㈣ Java如何判断中文简体繁体
[\u4e00-\u9fa5]
这个可以判断是不是汉字,我测试时,不能区分简繁。
找到下边这些JS的正则。(测试也区分不了简繁。)
[\u2E80-\u9FFF]+$ 匹配所有东亚区的语言
[\u4E00-\u9FFF]+$ 匹配简体和繁体
[\u4E00-\u9FA5]+$ 匹配简体
希望能你有点帮助,我再找找怎么区分简繁。
㈤ 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 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.e.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 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.e.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 <code>image< .>* @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;
}
资源来自:
http://blog.csdn.net/chief1985/article/details/2229572
㈥ java如何识别汉字字符
可以用正则表达式识别的, 用正则表达式"[\u4e00-\u9fa5]"匹配
字符串,可以找到是否有中文,如果只匹配一个字符,
就可以看到是不是中文
范例:
public static boolean isChinese(char c) {
String regEx = "[\u4e00-\u9fa5]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(c + "");
if (m.find())
return true;
return false;
}
㈦ Java调用OCR进行图片识别,能同时识别中文简体和中文繁体吗
这和java无关,是ocr软件的事,而且一般不能同时支持
㈧ 用JAVA编写一个程序识别图片上的文字;这个难题你实现了吗
这种不是个人可以处理的,也不是java的强项,去找提供ocr api的厂商吧。
㈨ 用Java读取一张图片,并识别图中的所有汉字,怎么解决
这个要是自己去写,估计很难,需要用到很多AI智能的算法,可以调用谷歌或者网络的识图API