使用java进行图像校正 [英] image correction using java

查看:667
本文介绍了使用java进行图像校正的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个java代码可以拍摄在亮度不佳的情况下拍摄的图像并更正它以识别写在其上的一些数字



我工作的图像左边有更多的光线,右边有黑暗



有没有任何算法可以做到这一点



注意。没有唯一的情况我会面对我想处理任何情况下的任何图像并纠正它。



i试图将图像分成几部分并纠正部分零件通过获取rgb为所有像素添加所有并除以像素数这将是我的阈值将图像转换为黑白二进制图像以检测数字但结果是太糟糕了,我可以检测到很多数字



有办法做到这一点吗?



注意。我真的不想使用任何外部库,因为我将使用这个pc java代码创建一个大的android项目

i want a java code to can take an image taken in bad brightness condition and correct it to can recognize some numbers written on it

the image i worked on has more light at left of it and dark at right

is there any algorithm to do this

Note. there is not the only case i will face i want to deal with any image with any case and correct it.

i tried to divide the image into parts and correct part part by get rgb for all pixel add all and divide by numbers of pixels and this will be my threshold to convert the image to black and white binary image to detect numbers but the result is sooo bad and i can detect alot of numbers

is there a way to do this?

Note. i really don't want to use any external library as i will use this pc java code to create a big android project

推荐答案

Amir,



您想要达到的效果称为阴影校正或平场校正。有几种方法可以做到这一点,具体取决于确切的问题陈述。



如果事先知道照明场,可以采用一种方法。我的意思是,如果你可以在完全相同的光线下拍摄白板的照片。然后,将图像中的值除以参考照明将恢复恒定照明,即平场。



如果你不能使用这种方法,那么你'我需要进行某种背景重建,即尝试重新创建参考照明。通常,照明的不均匀性具有平滑和缓慢的变化,并且对应于比印刷文本的空间频率长得多的空间频率。因此需要一个低通滤波器。它将删除文本并保留背景。 [你提出的方法并没有那么不同,但它会引入不连续性。]



首先,你可以尝试一个大方差的高斯滤波器,然后减去(或划分)来自原稿的模糊图像。
Amir,

what you want to achieve is called shading correction, or flat-field correction. There are several ways to do that, depending on the exact problem statement.

One approach is possible when you know the illumination field in advance. I mean if you can take a picture of a white sheet under exactly the same lighting. Then, dividing the values in your image by the reference illumination will restore constant illumination, i.e. flat-field.

If you can't use this approach, then you'll need to do some kind of background reconstruction, i.e. try and re-create the reference illumination. Usually the non-uniformity of lighting has smooth and slow variations and corresponds to spatial frequencies that are much longer than those of the printed text. So a lowpass filter is called for. It will erase the text and keep the background. [your proposed approach is not so different but it will introduce discontinuities.]

In the first place, you can try a Gaussian filter of a large variance, and subtract (or divide) the blurred image from the original.


这篇关于使用java进行图像校正的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆