I use webcam to get bitmap image and generate QR Code. THen pass it into picture box which is "QRLiveBox".
But while debugging there is an error in this particular code.
Result result = barcodeReader.Decode(new Bitmap(QRLiveBox.Image as Bitmap));
if (QRLiveBox.Image != null)
{
BarcodeReader barcodeReader = new BarcodeReader();
//Result result = barcodeReader.Decode((Bitmap)QRLiveBox.Image);
Result result = barcodeReader.Decode(new Bitmap(QRLiveBox.Image as Bitmap));
if (result != null)
{
string qrResult = result.ToString();
txtDecodedQRCode.Text = qrResult;
//captureDevice.Stop();
}
}
What you guys think the problem or solution. And how to code it.
- Isn't two threads from accessing a bitmap at the same time?
- Isn't the interface is the problem?
- How I should not access any controls without using Control.Invoke?
I found clue in this:
- Best Way to Invoke Any Cross-Threaded Code?
- InvalidOperationException - object is currently in use elsewhere
but I don't know how to implement it into my project.