forum.boolean.name

forum.boolean.name (http://forum.boolean.name/index.php)
-   Общие вопросы (http://forum.boolean.name/forumdisplay.php?f=166)
-   -   Чтение QR кода (http://forum.boolean.name/showthread.php?t=18140)

pie 04.05.2013 17:18

Чтение QR кода
 
Всем привет. Может быть кому пригодиться. Чтение происходит с картинки в проекте.

http://rghost.ru/45752714

Andvrok 04.05.2013 21:05

Ответ: Чтение QR кода
 
Чёрт возьми, именно на ргхосте меня-то и забанили. Эк как повезло.

Randomize 04.05.2013 21:30

Ответ: Чтение QR кода
 
Вложений: 1
Цитата:

Сообщение от Andvrok (Сообщение 258446)
Чёрт возьми, именно на ргхосте меня-то и забанили. Эк как повезло.

Пожалуйста

pie 04.05.2013 23:03

Ответ: Чтение QR кода
 
Для чтения с веб камеры.
PHP код:

using UnityEngine;
using System.Collections;
using System.Threading;
using com.google.zxing.qrcode;

public class 
SecurityTest MonoBehaviour {    
    
WebCamTexture camTexture;
    
Thread qrThread;

    
Color32[] c;
    
sbyte[] d;
    
int whwxh;
    
int xyz;
    
bool isQuit;
    
    public 
void Start () {
        
camTexture = new WebCamTexture ();
        
OnEnable ();
        
        
qrThread = new Thread (DecodeQR);
        
qrThread.Start ();
    }
    
    public 
void OnEnable () {
        if (
camTexture != null) {
            
camTexture.Play ();
            
camTexture.width;
            
camTexture.height;
            
wxh h;
        }
    }
    
    public 
void OnDisable () {
        if (
camTexture != null) {
            
camTexture.Pause ();
        }
    }
    
    public 
void OnDestroy () {
        
qrThread.Abort ();
        
camTexture.Stop ();
    }
    
    public 
void OnApplicationQuit () {
        
isQuit true;
    }
    
    public 
void Update () {
        
camTexture.GetPixels32 ();
    }
    
    public 
void DecodeQR () {
        while(
true) {
            if(
isQuit) break;
            try {                
                
= new sbyte[wxh];
                
0;
                for(
1>= 0y--) {
                    for(
0wx++) {
                        
d[z++] = (sbyte)(((int)c[x].r) << 16 | ((int)c[x].g) << | ((int)c[x].b));
                    }
                }
               
Debug.Log (new QRCodeReader().decode(dwh).Text);
            }
            catch {
                continue;
            }
        }
    }
    
    public 
void OnGUI () {
        
GUI.DrawTexture(new Rect (00Screen.widthScreen.height), camTextureScaleMode.ScaleToFit);
    }




Часовой пояс GMT +4, время: 22:34.

vBulletin® Version 3.6.5.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot