# About the 1d barcode coordinates (result.resultPoints)

198 views
Skip to first unread message

### Patrick

unread,
Jul 5, 2012, 4:00:54 AM7/5/12
to zx...@googlegroups.com
I don't get the result.resultPoints coordinates provided by the library for each barcode:

"(398.000000,114.000000)",

"(296.000000,114.000000)",

"(218.500000,114.000000)",

"(242.000000,114.000000)"

For instance, why is the second parameter always the same (114) ?

Also, I'm not sure I've fully understood the coordinates. I've done some tests and it seems the first coordinate is actually Y while the second one is X. Also. the first and fourth points seem to be higher then the middle ones:

(Y,X): top, ?

(Y,X): bottom, ?

(Y,X): bottom, ?

(Y,X): top, ?

Could you give me some help ?

Thanks

### Sean Owen

unread,
Jul 5, 2012, 4:25:13 AM7/5/12
to zx...@googlegroups.com
These are (x,y) coordinates -- distance across from left, distance down from top. It is not (y,x). The second parameter is the same if all lie in the same line, which is not surprising for 1D barcodes since these are scanned by line. What the points mean depends on what format you scan, and you haven't mentioned the format or provided a sample image. They are the location of guard patterns / finder patterns, or corners -- depends on the format. What are you scanning? Otherwise it's impossible to say more.

### Patrick

unread,
Jul 5, 2012, 4:33:18 AM7/5/12
to zx...@googlegroups.com
Thanks for reply, I would like to have the absolute coordinates of the 1d barcode (the rectangle if possible) on the screen. I need to display an image on top of it, so I need to know how to position it.

### Patrick

unread,
Jul 5, 2012, 4:37:33 AM7/5/12
to zx...@googlegroups.com
More info: I'm scanning UPC-A UPC-E barcodes (with extensions).

About the coordinates info you gave me in the previous post: so it is giving me the same Y (the scanned line over the 2d barcode) and several x.. which are the clue points ? If I've understood well, it hasn't nothing to do with the barcode rectangle.

### Sean Owen

unread,
Jul 5, 2012, 6:50:31 AM7/5/12
to zx...@googlegroups.com
For UPC, you will get two points, the start and end of the UPC barcode at whatever vertical position (row) it found it when scanning across. (This is why it's all on the same line / y value.) With extensions, you're also getting the start/end of the extension code. The only thing I'm not sure of is why they're coming out in this order -- I think it succeeded on reading the image in reverse, but then the last two should also be reversed. Maybe there is a small issue in the extension reader logic but it's pretty easy to make sense of it in any order.

You don't get the rectangle. As I said on SO, it does not need to find the rectangle to decode which is why it works so quickly. You can find it yourself with other classes in the project if you need it.

### Patrick

unread,
Jul 5, 2012, 7:27:52 AM7/5/12
to zx...@googlegroups.com
Ok thanks, but what I don't understand is the following: when i scan the barcode, I have to orientate it vertically. In other words the barcode has to be vertical to be scanned (so that the longest side of the phone is aligned with the longest side of the barcode).

In the last answer you say: "at whatever vertical position (row)"... so I guess you position the barcode horizontally, which is not working in my case.

Patrick

### Sean Owen

unread,
Jul 5, 2012, 7:53:00 AM7/5/12
to zx...@googlegroups.com
No. This description doesn't specify vertical vs horizontal -- depends on what your phone orientation is. The barcode could be right side up or rotated 90 degrees and still be aligned longest-side to longest-side.

By default the library scans the image as-is. It is looking for a right-side-up 1D barcode, which means the 1D barcode is wider than tall. In TRY_HARDER mode it will also look at 90 degrees, so can find taller-than-wide orientation barcodes in an image.

In all cases the result points are (x,y) coordinates, relative to the image as presented to the library. It just works.

Reply all
Reply to author
Forward
0 new messages