Author |
Topic  |
|
mdgodfrey
 
USA
59 Posts |
Posted - Jun 06 2017 : 14:45:33
|
I am trying to get AutoBorderDetection to work.
I am replacing another component that acquires images and does trim the document to the size of the paper scanned. It works with two different scanners that I am using so I know that they both support Page Size detection. To get that component to do border detection I simply tell it that the page size is none.
I cannot get imageen to give me the same result however. The AutoBorderDetection property just seems to be ignored.
I am using the following code:
Procedure TfrmDocArchiveScan.SetTwainParams;
begin
Screen.Cursor := crHourGlass;
ImageEnMView1.MIO.TwainParams.PixelType.CurrentValue := Twain_PixelType_BW;
//ImageEnMView1.MIO.TwainParams.StandardSize.CurrentValue := IETW_NONE;
ImageEnMView1.MIO.TwainParams.YResolution.CurrentValue := 200;
ImageEnMView1.MIO.TwainParams.XResolution.CurrentValue := 200;
ImageEnMView1.MIO.TwainParams.BufferedTransfer := True;
ImageEnMView1.MIO.TwainParams.VisibleDialog := cbShowDialog.Checked;
ImageENMView1.MIO.TwainParams.AutoBorderDetection := True;
ImageENMView1.MIO.TwainParams.AutoDeskew := True;
ImageENMView1.MIO.TwainParams.AutoRotate := True;
ImageEnMView1.MIO.TwainParams.Update; // verify here...
Screen.Cursor := crDefault;
end;
procedure TfrmDocArchiveScan.actScanExecute(Sender: TObject);
begin
ImageENMView1.Clear;
SetTwainParams;
if ImageENMView1.MIO.Acquire then
begin
ImageENMView1.MIO.Params[0].TIFF_Compression := ioTIFF_G4FAX;
ImageENMView1.MIO.Params[0].BitsPerSample := 1;
ImageENMView1.MIO.Params[0].SamplesPerPixel := 1;
ImageENMView1.MIO.DuplicateCompressionInfo();
SaveDocToDB;
end;
end;
Any help appreciated. |
|
xequte
    
39061 Posts |
Posted - Jun 06 2017 : 17:41:46
|
Hi
I cannot see any issues in the code, but as a sanity check, can you also compare against:
ImageEnMView1.MIO.TwainParams.IsCapabilitySupported( ICAP_AUTOMATICBORDERDETECTION )
Perhaps the device also requires other properties to be set to enable border detection?
Or perhaps your previous library simply performed the task with its own code rather? You can do this using the cropping methods in TImageEnProc.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
mdgodfrey
 
USA
59 Posts |
Posted - Jun 07 2017 : 13:12:39
|
I am using version 4.3.1. The IsCapabilitySupported function is not available. Could the issue also be something that was a bug in that version?
Thanks for you reply |
 |
|
mdgodfrey
 
USA
59 Posts |
Posted - Jun 07 2017 : 13:56:12
|
Also I am trying the cropping as suggested and it seems to help but it is no where near as good as the image Imageen creates while showing thumbnails. Any suggestions for me there.
I am using: ImageEnMView1.Proc.AutoCrop(10, RGB(0,0,0), True); ImageEnMView1.Proc.AutoCrop(10, RGB(255,255,255), True); |
 |
|
xequte
    
39061 Posts |
Posted - Jun 08 2017 : 17:16:08
|
Cropping does not modify the content in any way, so there can be no loss of quality.
Presumably, this is a display issue. Where are you displaying the acquired/cropped image? Have you enabled the Zoom/Display Filter?
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
mdgodfrey
 
USA
59 Posts |
Posted - Jun 08 2017 : 18:19:05
|
Sorry, what I meant by that is that the image in the thumbnail is more cropped than the image I produce from my cropping. |
 |
|
xequte
    
39061 Posts |
Posted - Jun 08 2017 : 18:58:31
|
Hi
Well the cropping will remove *all* the border area, whereas a normal scan would have some border area, so you might want to pad it (and adjust to A4/US Letter ratio). Is that what you mean? If not, post a picture.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
mdgodfrey
 
USA
59 Posts |
Posted - Jun 12 2017 : 11:06:51
|
What I mean specifically is that the cropping code that I show above does a pretty good job of cropping but it leaves about a 1 inch white band at the bottom of the scanned page. Just trying to figure what I am doing wrong so that I can clean that up as well.
I really appreciate your help |
 |
|
xequte
    
39061 Posts |
|
mdgodfrey
 
USA
59 Posts |
Posted - Jun 15 2017 : 13:39:35
|
I couldn't quite figure out attaching here so I sent as email.
Thanks |
 |
|
xequte
    
39061 Posts |
Posted - Aug 04 2017 : 00:34:43
|
Okay so I have found my issue. If I save the scan to TIF the size is correct. When saving to PDF however it adds space to the image.
Hi Mitch
PDF is a document, rather than an image format, so it is expected to conform to standard page sizes, such as A4.
If you want PDF to simply output at the size of the image, use:
// Output at size of image ImageEnView1.IO.Params.PDF_PaperSize := iepAuto; ImageEnView1.IO.SaveToFile('D:\output.pdf');
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
mdgodfrey
 
USA
59 Posts |
Posted - Feb 26 2018 : 17:11:16
|
I have just never really been able to get a clean scan out of Imageen. I don't think that page detection works or at least not well. I scan a letter sized document and I get that it is 23 inches x whatever.
I also get black areas around the edges of the scan randomly depending on how well the scanner grabs the page. I also have not been able to clean up those edges with cropping so I am just hoping to get a best practice idea from you.
My users are use to the other product that I used previously that however they did it we always got a clean page out of the scan by using page detection. We still run both systems side by side and get clean scans out of that but not with Imageeen.
I can work around the page size problem by forcing some things but the clean edge is a real problem for me and I would appreciate any help on that.
Thanks |
 |
|
xequte
    
39061 Posts |
Posted - Feb 28 2018 : 13:41:45
|
Hi Mitch
ImageEn's AutoBorderDetection enables the ICAP_AUTOMATICBORDERDETECTION Twain property. According to the Twain specifications, ICAP_UNDEFINEDIMAGESIZE should also be enabled with ICAP_AUTOMATICBORDERDETECTION. So try also setting TwainParams.UndefinedImageSize := true. Though, of course you may get odd page sizes (i.e. not Letter/A4, etc...).
Also, you are still using v4.3.1, which is over five years old, so it is difficult to say whether you are affected by Twain issues that have been resolved over the years (particularly in 7.5.0, and also 7.0.1, where we resolved some issues related to the acquired image size).
If you create a simple demo, i can recompile it in v7.5.0, so you can test whether the issue has been resolved.
Nigel Xequte Software www.imageen.com
|
 |
|
|
Topic  |
|