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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEVision - TIEBitmapHelper - ImageEnView1.SelectedRect

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
aleatprog Posted - Jan 23 2026 : 10:23:59
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


3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 28 2026 : 21:15:34
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
aleatprog Posted - Jan 26 2026 : 04:43:19
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
xequte Posted - Jan 25 2026 : 21:38:11
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