4

As of now, when Android Vision detects a QR-code, the array "Barcode.cornerPoints" (which contains the code's corner points) is populated in a seemingly random order. I need is to determine which 3 out of the 4 corner points that contains "orientation squares".

The current approach I am using is very unsatisfying:

  1. For every detected QR-code, I am forced to create a bitmap and attempt to find the QR-code again with another library (Zxing) that always returns the corner points in a consistent order with respect to rotation.

  2. If Zxing finds the QR-code (which sadly doesn't happen about four times out of five), I need to cross-check and match the Zxing-corners with Android Vision corners.

What I would like is to get the array "Barcode.cornerPoints" populated with respect to orientation.

For example and clarification:

cornerPoints[0] = //First corner-point with an orientation square
cornerPoints[1] = //Second corner-point with an orientation square
cornerPoints[2] = //Third corner-point with an orientation square
cornerPoints[3] = //The corner-point that does not contain a orientation square

> Like in this picture <

I have been trying to find a clever workaround to this issue for quire a while now but I can't come up with any good solution, and it does not appear as Google has open source'd the code used when population the qrCorners array so i can't extend it...

Any help out there? I am not the only one who has been looking for a solution to this issue:

https://github.com/googlesamples/android-vision/issues/103

kpptron
  • 41
  • 3
  • 1
    Why do you need the orientation squares? My guess is that the `Vision API` for getting the contents of a barcode not feature detection. Have you looked at OpenCV? – Morrison Chang May 29 '17 at 21:09
  • 1) I need to know the orientation of qr-code relative to the surroundings because after reading the code, i do some cropping and image editing to the right of the qr-code. Without knowing the orientation of corners, it is impossible to know which area that is to the right of the qr code. 2) Perhaps, but Android Vision fulfills all my needs perfectly except for the arbitrary population of the cornerPoints array. If they only would populate the array consistently, the qr-code could be used as an orientation anchor in many applications. 3) No, I have not looked close on OpenCV yet – kpptron Jun 01 '17 at 07:20

1 Answers1

2

I am in a similar situation as well. What might help you to know is that Android Vision does not return the corner points in a completely random order.

I believe that the detector scans the image from top left to bottom right of the frame. The QR-code-corner which is detected first in the image will be returned as corner 0 and the rest in a clockwise direction.

What would be really helpful was if Android Vision returned the corners like you said, in a "static" order depending on orientation. I barely see any reason for the chosen way to return the corner points. Maybe better performance? For the QR-code to be read it has to be done according to a certain orientation which is determined by the corners of the QR-code. Which means Android Vision already has identified the orientation and corners but does not give this information to us. Maybe this could be added in future updates?

Tsuni
  • 5,348
  • 2
  • 13
  • 20