You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now I'm trying to detect a QR code with ZBar in both python and C#.
In python, I succeeded in detecting both string data and the 2D position of the QR code in the following way.
from pyzbar.pyzbar import decode
from pyzbar.pyzbar import ZBarSymbol
def __pyzbarDetect(self, image):
allCodes = decode(image)
data, x, y = "", 0, 0
for code in allCodes:
data = code.data.decode()
left, top, width, height = code.rect
x = left+round(width/2)
y = top +round(height/2)
return data, x, y
In C#, however, I succeeded only in detecting string data, but not in detecting the 2D position. My C# code is the following.
using ZBar;
private static string zbarDetect(Mat image)
{
using (var scanner = new ImageScanner { Cache = false })
{
var scanned = scanner.Scan(image.ToBitmap());
var symbol = scanned.LastOrDefault();
var data = symbol?.Data ?? string.Empty;
return data;
}
}
Is is possible to detect the 2D position of the QR code with C# (zbar-sharp) in a similar way to python (or in a totally different way)?
The text was updated successfully, but these errors were encountered:
@the-vindicar Thank you for your comment. I wrote my own wrapper methods to detect the 2D position by using original zlib methods as extern. In other aspects such as decoding of the string data, I used zbar-sharp methods as shown above.
Now I'm trying to detect a QR code with ZBar in both python and C#.
In python, I succeeded in detecting both string data and the 2D position of the QR code in the following way.
In C#, however, I succeeded only in detecting string data, but not in detecting the 2D position. My C# code is the following.
Is is possible to detect the 2D position of the QR code with C# (zbar-sharp) in a similar way to python (or in a totally different way)?
The text was updated successfully, but these errors were encountered: