开发者

Android ZXing image processing

I have to scan a Data Matrix written on something like this.

The code is white/light gray but the background reflects different colors, depending on the position of the camera(angle), light. Where would be the right place to edit the image cap开发者_JS百科tured in Android Zxing?

Is there any possible adjustment to make the image black on white before processing?

Any idea would be great.


            Bitmap bm = Bitmap.createBitmap(500, 500, Bitmap.Config.RGB_565);
            Canvas c = new Canvas(bm);
            Paint paint = new Paint();
            ColorMatrix cm = new ColorMatrix();
            cm.setSaturation(0);
            ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
            paint.setColorFilter(f);
            int xo = (w-500)/2;
            int yo = (h-500)/2;
            c.drawBitmap(bmp, -xo, -yo, paint);
            bmp.recycle();


Also have a look at this class:

http://zxing.org/w/docs/javadoc/com/google/zxing/common/HybridBinarizer.html

Maybe you are using by default the GlobalHistogramBinarizer, which is faster but doesn't work so good with gradients.


It seems that you need some image processing before recognition. Previous answer suggest histogram bianrizer, which is sensitive to background intensity changes. Sauvola filter is known to have good tolerance to background changes ( and gradients), but has higher processing time. ( Implemented in our OCR Project: http://sourceforge.net/projects/javaocr/ , and you can see it in action in this application: https://market.android.com/details?id=de.pribluda.android.ocrcall&feature=search_result )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜