qzxing icon indicating copy to clipboard operation
qzxing copied to clipboard

getTagRect not always returns a valid position for QrCodes

Open maurosanjo opened this issue 8 years ago • 2 comments

Not sure why, but when decoding QrCodes sometimes the tag position returned is outside image limits.

Is any coordinate translation required?

Take a look at the return coordinates of the tag on each image:

matrixWidth = 2592 matrixHeight = 1944 QrCode = "DC00000000000TER1V6U2A4144"

Image OK P[0].X = 582 P[0].Y = 604

P[1].X = 582 P[1].Y = 959

P[2].X = 272 P[2].Y = 959

P[3].X = 320 P[3].Y = 674

imageok

Image NOK P[0].X = 602 P[0].Y = 2018

P[1].X = 956 P[1].Y = 2015

P[2].X = 959 P[2].Y = 2320

P[3].X = 675 P[3].Y = 2276

imagenok

maurosanjo avatar Dec 21 '17 10:12 maurosanjo

Found the cause of the problem, when TryHarder is enabled, the image is rotated by 90 degrees counter clockwise in 3 attempts to decode. If successfull no state is saved in order to transform the tag coordinates back to the correct position.

maurosanjo avatar Jan 29 '18 09:01 maurosanjo

This is very interesting. Thank you very much.

In case you have already fixed it in the code, i would gladly accept a pull request, Otherwise I will try to provide a fix in the coming days.

ftylitak avatar Jan 29 '18 15:01 ftylitak