public void QR_Reader(int[][] newdata) // get image and read QR codes. Put infomation in the allinfo[][] //Update the sensor and underlying { QRAPI.updateSensor(); QRAPI.updateProcessor(); // Update the result info from Kinect API if (QRAPI.getQRResult(qrresult)) { for (int i = 0; i < TotalNumber; i++) { if (qrresult[i, 0] != 99) { //Debug.Log("ID:" + qrresult[i, 0]); if (qrresult[i, 0] != 99 && Check_range(qrresult[i, 0])) { newdata[i][0] = qrresult[i, 0]; newdata[i][1] = -1 * (qrresult[i, 1] / 10 - 50); newdata[i][2] = newdata[i][2]; newdata[i][3] = -1 * (qrresult[i, 2] / 10 - 50); newdata[i][4] = qrresult[i, 4]; Debug.Log("ID:" + qrresult[i, 0] + " " + qrresult[i, 1] + " " + qrresult[i, 2] + " " + qrresult[i, 3] + " " + qrresult[i, 4] + " " + qrresult[i, 5]); //Debug.Log("ID:"+newdata[i][0]+" " +newdata[i][1] + " " + newdata[i][2] + " " + newdata[i][3] + " " + newdata[i][4]); } } } } return; }
// Use this for initialization void Start() { cameraFrame = new Texture2D(1280, 720, TextureFormat.RGBA32, false); //if (QRAPI.qrresult == null) // QRAPI.qrresult = new int[30,6]; QRAPI.testFun(b); for (int j = 0; j < 10; j++) { Debug.Log(b[j]); } }
void OnApplicationQuit() { QRAPI.destroyEnv(); }
void Awake() { QRAPI.initEnv(); }
// Update is called once per frame void Update() { // Update the sensor and underlying QRAPI.updateSensor(); QRAPI.updateProcessor(); //IntPtr ptrFrame = IntPtr.Zero; //int frameLen = 0; //bool success = QRAPI.getColorFrame(ref ptrFrame, ref frameLen); bool success = QRAPI.QueryCurrentColorFrame(); if (success) { // If we have a frame, set the texture map to the frame data and display it //cameraFrame.SetPixels(QRAPI.currentColorFrame); cameraFrame.LoadRawTextureData(QRAPI.currentColorData); //cameraFrame.LoadRawTextureData(ptrFrame, frameLen); cameraFrame.Apply(); Plane.GetComponent <Renderer>().material.mainTexture = cameraFrame; //Debug.Log(cameraFrame.format); } //for (int i = 0; i < 30; i++) //{ // for (int j = 0; j < 6; j++) // { // a[i, j] = 0; // } //} if (QRAPI.getQRResult(a)) { for (int i = 0; i < 30; i++) { if (a[i, 0] != 99 && a[i, 0] >= 0) { for (int q = 0; q < 6; q++) { Debug.Log(a[i, q]); } } } } //if (QRAPI.getQRResult(ref QRAPI.qrresult)) //{ // for (int i = 0; i < 30; i++) // { // if (QRAPI.qrresult[i, 0] != 99 && QRAPI.qrresult[i, 0] >= 0) // { // for (int q = 0; q < 6; q++) // { // Debug.Log(QRAPI.qrresult[i, q]); // } // } // } //} }