ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEVision - TIEBitmapHelper - ImageEnView1.SelectedRect
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

aleatprog

146 Posts

Posted - Jan 23 2026 :  10:23:59  Show Profile  Reply
Hi,

may I please get some additional information about the IEVision function ScanBarcode.

TIEBitmapHelper.OCR
function OCR(OcrRect: TRect; const LanguageCode: string; SegmentationMode: TIEVisionOCRPageSegmentationMode = ievOCRAuto; const LanguagePath: string = ''; Engine: TIEVisionOCREngine = ievOCRDefault): string; overload;

The following code extracts the text contained in ImageEnView1.SelectedRect (expected behaviour of OcrRect parameter):

if ImageEnView1.Selected then
  begin
    r := IERectangleToRect(ImageEnView1.SelectedRect);
    s := ImageEnView1.IEBitmap.OCR(r, OCR_English_Language, ievOCRAuto, LanguagePath);
  end;


TIEBitmapHelper.ScanBarcode
function ScanBarcode(ScanRect: TRect; out BCData: string; out BCType: string; out BCRect: TRect): Integer; overload;

The following code opens up an identical ShowMessage for both, barcode position inside or outside of ImageEnView1.SelectedRect (not expected behaviour of ScanRect parameter; see attached image):

if ImageEnView1.Selected then
  begin
    r := IERectangleToRect(ImageEnView1.SelectedRect);
    count := ImageEnView1.IEBitmap.ScanBarcode(r, ObrData, ObrType, ObrRect);
    if count > 0 then
      ShowMessage('Barcodes found: ' + count.ToString + #13#10 + #13#10 +
                  'Barcode value: ' + ObrData + #13#10 +
                  'Type: ' + ObrType + #13#10 +
                  'Position: ' + ObrRect.Left.ToString + ', ' +
                                 ObrRect.Top.ToString + ', ' +
                                 ObrRect.Right.ToString + ', ' +
                                 ObrRect.Bottom.ToString);
  end;


Q1: Is it possible that TIEBitmapHelper.ScanBarcode doesn't consider the ScanRect parameter but always scans the complete page?

Q2: Is it possible that, in case of multiple barcodes with identical value (see point [2.] below), the parameter BCRect returns the TRect position of the merged area?

[1.] x,y coordinates of ImageEnView1.SelectedRect: 130, 379, 577, 569
[2.] x,y of BCRect scanning an image with identical top + buttom barcode: 147, 116, 2407, 3373
[3.] x,y of BCRect scanning an image with only top barcode: 147, 116, 561, 274
[4.] x,y of BCRect scanning an image with only buttom barcode: 1987, 3204, 2407, 3373

Q3: Do you confirm that TIEBitmapHelper.ScanBarcode scans the page from buttom to top (and from right to left), so the first barcode extracted by TIEBitmapHelper.ScanBarcode, as indicated in the manual, is the one at the buttom of the page?

P.S.: Unlike TIEBitmapHelper.ScanBarcode, TIEVisionBarCodeScanner.scan works as expected, reading only the barcodes located inside of ImageEnView1.SelectedRect.

Ale


xequte

39327 Posts

Posted - Jan 25 2026 :  21:38:11  Show Profile  Reply
Hi Ale

1. Yes, that is an issue in the ScanBarcode() helper. It is fixed in the latest beta

2. Yes, it does appear that identical barcodes return a merged rect (this occurs within the ZBar library)

3. No, that does not appear to be the case. There is no guarantee that the first barcode will be the bottom left.

Essentially the ScanBarcode() helper is intended for retrieval when there is only a single barcode on the page. For multiple barcodes you are better to use the original methods.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

146 Posts

Posted - Jan 26 2026 :  04:43:19  Show Profile  Reply
Hi Nigel,

thank you for your prompt response. Precisely for returning only one barcode, I implemented TIEBitmapHelper + ImageEnView1.SelectedRect. All other cases of multiple barcodes are handled using TIEVisionBarCodeScanner.scan.

A predefined barcode scanning direction could be relevant to speed up OBR processing.

Best regards,
Ale
Go to Top of Page

xequte

39327 Posts

Posted - Jan 28 2026 :  21:15:34  Show Profile  Reply
Hi Ale

We're limited by the functionality that is provided by the library. You should parse the returned list.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: