Hello to all,
I have a camera scanner which takes image barcode when is available. The image is treated following process:
I send the generated image to GDPicture in order to be decoded. Until now I have been using these functions:
_mGdPictureImaging.Barcode1DReaderDoScan(imageId, scaneMode, barcode1DTypes, false, 1);
_mGdPictureImaging.BarcodeMicroQRReaderDoScan(imageId, scaneMode, 1);
_mGdPictureImaging.BarcodeQRReaderDoScan(imageId, scaneMode, 1);
I get a queue of images, for each image used I start testing with 1D barcode. When no barcode detected I try QR, and if also not detected I try the next type, because I don’t know the type of barcode on the current image. Like :
BarcodeResult barcodeResult = DecodeD1Barcode(bitmap);
if (barcodeResult.Result != BarcodeDecodeResult.Success)
{
barcodeResult = DecodeDataMatrix(bitmap);
if (barcodeResult.Result != BarcodeDecodeResult.Success)
{
barcodeResult = DecodeQRCode(bitmap);
if (barcodeResult.Result != BarcodeDecodeResult.Success)
barcodeResult = DecodeMicroQRBarcode(bitmap);
}
}
Question : Is there any way using GDPicture to ask only to decode Barcode without specifying a type Barcode1DReaderDoScan, BarcodeMicroQRReaderDoScan or BarcodeQRReaderDoScan …? Like : BarcodeDoScan
Remark :
- The taken image has a fixed size
- The image content is a barcode and only one barcode.
Thanks
Eric
Decode barcode when the barcode type is unknown
Re: Decode barcode when the barcode type is unknown
Hi Eric,
There is no such method that reads a barcode without specifying the barcode type, but it is easy to write it. It should be something like:
Best regards,
Costinel
There is no such method that reads a barcode without specifying the barcode type, but it is easy to write it. It should be something like:
Code: Select all
private string DetectSingleBarcode(GdPictureImaging gdp, int imageId)
{
string result = null;
if (gdp.Barcode1DReaderDoScan(imageId) == GdPictureStatus.OK)
{
if (gdp.Barcode1DReaderGetBarcodeCount() > 0)
{
result = gdp.Barcode1DReaderGetBarcodeValue(1);
}
gdp.Barcode1DReaderClear();
}
if (result == null && gdp.BarcodeQRReaderDoScan(imageId) == GdPictureStatus.OK)
{
if (gdp.BarcodeQRReaderGetBarcodeCount() > 0)
{
result = gdp.BarcodeQRReaderGetBarcodeValue(1);
}
gdp.BarcodeQRReaderClear();
}
if (result == null && gdp.BarcodeMicroQRReaderDoScan(imageId) == GdPictureStatus.OK)
{
if (gdp.BarcodeMicroQRReaderGetBarcodeCount() > 0)
{
result = gdp.BarcodeMicroQRReaderGetBarcodeValue(1);
}
gdp.BarcodeMicroQRReaderClear();
}
if (result == null && gdp.BarcodeDataMatrixReaderDoScan(imageId) == GdPictureStatus.OK)
{
if (gdp.BarcodeDataMatrixReaderGetBarcodeCount() > 0)
{
result = gdp.BarcodeDataMatrixReaderGetBarcodeValue(1);
}
gdp.BarcodeDataMatrixReaderClear();
}
return result;
}
Costinel
Who is online
Users browsing this forum: No registered users and 1 guest