Coordenates of Barcode found

496 views
Skip to first unread message

Rafael Guerra

unread,
Nov 5, 2015, 1:27:58 PM11/5/15
to zxing
How can I get the coordenates of barcode acknowledged in a image ?
I try to use resultpoint[] but did not work. Can someone explain me ?

Gustavo EHennemann

unread,
Nov 6, 2015, 11:59:34 AM11/6/15
to zxing
Em quinta-feira, 5 de novembro de 2015 16:27:58 UTC-2, Rafael Guerra escreveu:
> How can I get the coordenates of barcode acknowledged in a image ?
> I try to use resultpoint[] but did not work. Can someone explain me ?

Hi Rafael,
I'm working on exactly same issue for two days. The information is hard to find, but this is what I got til now:
Somebody also with this problem: https://groups.google.com/forum/#!searchin/zxing/coordinate/zxing/MSaLOuBaLKM/3djqWfBKY54J

A class that supose to do the job (but I can't make it work - there is no enough information): https://zxing.github.io/zxing/apidocs/com/google/zxing/qrcode/detector/FinderPatternInfo.html

What I did to work:
private Result readQRCode(BufferedImage bi){
BinaryBitmap binaryBitmap;
Result result;

try{
binaryBitmap = new BinaryBitmap( new HybridBinarizer(new BufferedImageLuminanceSource( bi )));
result = new QRCodeReader().decode(binaryBitmap);
return result;
}catch(Exception ex){
ex.printStackTrace();
return null;
}
}
And, whith result you can do:
//position of reference
posX = result.getResultPoints()[1].getX();
posY = result.getResultPoints()[1].getY();

Note:
result.getResultPoints() contains 3 points, that are the tree main corners.

That is it! Works for me.

Gustavo EHennemann

unread,
Nov 6, 2015, 12:03:13 PM11/6/15
to zxing

Sorry, there are a lithe mistake, this code is for QRCode, but for BarCode I believe is very similar.

Message has been deleted

Rafael Guerra

unread,
Nov 6, 2015, 1:09:57 PM11/6/15
to zxing
I´m trying ... But the coordinates do not match the analyzed image.

Gustavo EHennemann

unread,
Nov 6, 2015, 1:13:16 PM11/6/15
to zxing
Em sexta-feira, 6 de novembro de 2015 16:09:57 UTC-2, Rafael Guerra escreveu:
> I´m trying ... But the coordinates do not match the analyzed image.

The coordinates are relative to the position inside the image, if you are using a 640x480 camera, for example, the coordinates are expected within this range.

Rafael Guerra

unread,
Nov 6, 2015, 1:31:33 PM11/6/15
to zxing
Gustavo,

My resultpoint[] return 2 itens:
[0] - x-> 172.0 and y -> 150.0
[1] - x-> 847.0 and y-> 150.0

Looking in my analized image ... What is the relationship of the points with the barcode since they are not at the ends of barcode found (red points) ?

test.png

Gustavo EHennemann

unread,
Nov 6, 2015, 1:57:41 PM11/6/15
to zxing

This is the position of "guard pattern" or "guard bars".
Take a look at :
http://stackoverflow.com/questions/11340996/is-zxing-providing-upc-barcodes-coordinates-on-the-screen
and
http://www.av1611.org/666/barcode.html

What is your main objective?

Gustavo EHennemann

unread,
Nov 6, 2015, 1:59:09 PM11/6/15
to zxing

Rafael Guerra

unread,
Nov 9, 2015, 5:06:41 AM11/9/15
to zxing


Works. Thanks a lot about explanation, Gustavo.

Gustavo EHennemann

unread,
Nov 10, 2015, 5:15:44 AM11/10/15
to zxing

You're welcome
Boa sorte

Reply all
Reply to author
Forward
0 new messages