I am building a QR code reader using zxing.net, and I want to access the latest camera frame from inside a coroutine. How to access the camera frames.
Also, Can we test the camera part in the emulator that comes with nrsdk.
Example code snippets are appreciated.
Access RGB Camera - NRSDK (gitbook.io)
Not sure about the emulator though⌠I think the challenge there would be the camera pose would not be relative to the images. You could create a âpretendâ camera using the WebcamTexture instead, and have that be used in the designerâŚ
Hey, did the code I sent in the PM not work? It doesnât read a QR code in the emulator, but it definitely does when built to the glasses, as itâs exactly what I use.
Set a private variable
private NRRGBCamTexture RGBCamTexture { get; set; }
I had a bool and a function to activate and de-active the QR code scanner, but hereâs how to get the cam texture
RGBCamTexture = new NRRGBCamTexture();
RGBCamTexture.Play();
Then in update I used the bool I set to activate/deactivate the scanner, and if I was allowed to scan, I cased a few strings that the different QR codes contained from âresultâ, but obviously you can do whatever you like and is needed here, this is just an example.
IBarcodeReader barcodeReader = new BarcodeReader();
var result = barcodeReader.Decode(this.RGBCamTexture.GetTexture().GetPixels32(), this.RGBCamTexture.Width, this.RGBCamTexture.Height);
if (result != null)
{
// QRCode detected
}
else
{
// QRCode not detected
}
}