Xzing / Kudan AR Integration for QR reading
Hi,
I've been trying to get xzing to read barcodes from the android camera via [KudanAR][1], as far as I can tell everything I've done so far should work however it never manages to find a QR code within the image.
Any ideas on what I'm doing wrong?
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using ZXing; using ZXing.QrCode;
public class QR : MonoBehaviour { public Text QROutputText; Texture2D camTex; Color32[] camPix;
void Update ()
{
try
{
IBarcodeReader barcodeReader = new BarcodeReader ();
camTex = SystemManager.instance._kudanTracker._trackerPlugin.GetTrackingTexture() as Texture2D;
camPix = RotateMatrix(camTex.GetPixels32(), camTex.height);
camTex.SetPixels32(camPix);
var result = barcodeReader.Decode(camTex.GetPixels32(), camTex.width, camTex.height);
if (result != null)
{
QROutputText.text = "Scanned Text : " + result.Text;
Debug.Log ("DECODED TEXT FROM QR:" + result.Text);
}
else
{
QROutputText.text = "No QR code detected";
//Debug.Log ("NO BARDCODE DETECTED");
}
}
catch (Exception ex)
{
Debug.LogWarning (ex.Message);
}
}
static Color32[] RotateMatrix(Color32[] matrix, int n) {
Color32[] ret = new Color32[n * n];
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
ret[i*n + j] = matrix[(n - j - 1) * n + i];
}
}
return ret;
}
}
Thanks [1]: https://www.kudan.eu/
Can you provide a dump of the Color32 array from camTex.GetPixels32() which you use with the Decode method?
Can you provide a dump of the Color32 array from camTex.GetPixels32() which you are using with the Decode method?
Answer by micjahn · May 18, 2017 at 11:05 AM
Can you provide a dump of the Color32 array from camTex.GetPixels32() which you use with the Decode method?
http://answers.unity3d.com/questions/1417221/reading-barcodes-and-qr-codes-using-kudan-with-zxi.html since the creator of this question seems to be awol, ive asked it again with my code block to try to get it to work, if you could take a look that would be awsome.
ill try and get a color32 dump, as i assume youll ask that again :D
of course, I would ask for it because I want to see what the BarcodeReader sees.
Your answer
Follow this Question
Related Questions
Cinemachine untouchable zone 1 Answer
Cinemachine On Mobile? 1 Answer
Rect or Camera transform? 0 Answers
How to set up a Videocamcorder as a Webcam in Unity? 0 Answers