I am trying the following in c# Unity3D.
I want to decode a QR Code, and if the identification is successful then draw a green square around the QR code. The square has to track the real object with the decoded text underneath. At the moment I am able to decode the QR, in this way.
ScanQRCodeVuforia is the file where vuforia scan the qr/bar code.
Using the code underneath I am able to detect X and Y which Debug.DrawLine on the screen, but what happens is that the line is parallel to the camera and not on the screen. Just to give you an idea. Do you know how can I represent the line on the canvas? Do you know any other method that I can use to draw a green box around the qr?
ResultPoint[] point = result.ResultPoints;
Debug.Log("X: " + point[0].X + " Y: " + point[1].Y);
Debug.DrawLine(new Vector3(point[0].X, 0), new Vector3(point[0].Y, 0), Color.green, 1000000000f);
I think that this is a good reference to use to detect the four angles points of the QR.
Thanks.
Update!
Using the following code, I am able to draw line on the canvas, but it does not result to be align with the image. This image gives a better idea
var rayX = Camera.main.ScreenPointToRay(new Vector3(point[0].X, point[1].Y));
var rayY = Camera.main.ScreenPointToRay(new Vector3(point[1].Y, point[0].X));
Debug.DrawLine(rayX.origin, rayY.origin, Color.green, 1000000000f);