Reputation: 29
I am making a qr code reader that pulls qr codes from the webcam video feed using zxing.net the basic code is the following:
Bitmap unresized = (Bitmap)eventArgs.Frame.Clone();
Bitmap newFrame = new Bitmap(unresized, 640, 500);
if (newFrame != null)
{
BarcodeReader barcodeReader = new BarcodeReader();
var options = new DecodingOptions
{
PossibleFormats = new List<BarcodeFormat>
{
BarcodeFormat.QR_CODE
},
TryHarder = true
};
barcodeReader.Options = options;
Result[] results = barcodeReader.DecodeMultiple((Bitmap)newFrame);
if (results != null && results.Length > 0)
{
foreach (var result in results)
{
also this:
if (!detectedQRCodes.ContainsKey(result.Text))
{
CodeInfo Code = new CodeInfo();
Code.Content = result.Text;
Code.Format = result.BarcodeFormat;
Code.RotationAngle = rotationAngle;
Code.MidPoint = midPoint;
Code.Points = points;
detectedQRCodes.Add(Code.Content, Code);
qrCodeDataTable.Rows.Add(result.Text, result.BarcodeFormat.ToString(), angle, midPointString);
}
else // if the code was detected before
{
detectedQRCodes[result.Text].RotationAngle = rotationAngle;
detectedQRCodes[result.Text].MidPoint = midPoint;
detectedQRCodes[result.Text].Points = points;
DataRow existingRow = qrCodeDataTable.Rows.Find(result.Text);
existingRow["RotationAngle"] = angle;
existingRow["MidPoint"] = midPointString;
}
}
so basically it's saving and printing QR code different elements to a datagridview however I want to do the same for the QR codes that have the same content but are in different locations in the same frame as well. So my question would be does ZXing recognize the multiple instances of the same QR code and if it does how can I store and track them as different objects?
Upvotes: 0
Views: 333