Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, June 20, 2006 10:12:29 AM(UTC)

joee  
joee

Groups: Registered
Posts: 7


Small problem,
    While testing document repair I have found that I have to destroy the quality of the document for autotrim to accuratly trim the image (invert, dot removal, invert).  This makes a's e's and other letters with small spaces turn into blobs, however if I don't perform this step the autotrim can't handle the noise on the edges of the image. (yes I have tried different settings, this can't be avoided)
Using VB how can I replicate the effects of the L_GetAutoTrimRect API call.  That way I can convolute the image, get the correct rectangle, reload the original image and manually trim using the coordinates obtained in the first step.

This seems like something that others would need as well as straight auto-trim when dealing with binary is mostly useless.

Joe
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, June 20, 2006 1:52:58 PM(UTC)

joee  
joee

Groups: Registered
Posts: 7


Still would really like to know if the above is possible.
I did come up with a possible alternative though.
(let me know if you see any potential issues with this)
Using a Border Remove with an extremely large variance (2000) not changing the image, just selecting the region.
Filling the region with black
then freeing the region and performing auto-trim.
Still playing with the settings and some sample images, but this appears to work so far.

Joe
 
#3 Posted : Saturday, June 24, 2006 11:58:24 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

Do you mean that you want to call the AutoTrim method, and then you want to get the trim rectangle?
To do this, you need to call the L_AutoTrimBitmap and the L_GetAutoTrimRect API methods under VB.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#4 Posted : Monday, June 26, 2006 8:07:23 AM(UTC)

joee  
joee

Groups: Registered
Posts: 7


Yes that would be what I need to do.  I'm not regularly a VB programmer though, Are there any examples of how to do this?

 
#5 Posted : Wednesday, June 28, 2006 12:34:18 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

I am attaching a small VB6.0 project that shows how to use the L_AutoTrimBitmap and the L_GetAutoTrimRect API functions with the LEAD Main OCX control.

Please check the project and let me know if this helps.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
VBTest_Trim.zip (2kb) downloaded 31 time(s).
 
#6 Posted : Friday, June 30, 2006 10:12:02 AM(UTC)

joee  
joee

Groups: Registered
Posts: 7


Thank you for the code that helped a great deal.
FYI if you auto trim before getting the rectangle the data obtained is useless.  It will always return 0,0 for top, left.  If you just run the L_GetAutoTrimRect then it works correctly and you obtain the full rectangle that it would crop to.

 
#7 Posted : Thursday, October 25, 2007 4:34:18 AM(UTC)
AlexanderVanMeerten

Groups: Registered
Posts: 4


Is there away to use the L_GetAutoTrimRect through the COM interface?

 

 
#8 Posted : Sunday, October 28, 2007 5:13:05 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

You can use the following code for COM interface:
+--------------+
Option Explicit
Dim pBimap As LEADBitmapHandle 'You can find this in L_OCXADD.BAS

Private Declare Function RasComL_GetControlBitmap Lib "LTR14N" Alias "L_GetControlBitmap" (Ctrl As Object, hBitmap As _
LEADBitmapHandle) As Long
Private Declare Function RasComL_SetControlBitmap Lib "LTR14N" Alias "L_SetControlBitmap" (Ctrl As Object, hBitmap As _
LEADBitmapHandle) As Long

Private Declare Function RasComL_AutoTrimBitmap Lib "LTRPR14n" Alias "L_AutoTrimBitmap" (hBitmap As _
LEADBitmapHandle, ByVal uThreshold&) As Long

Private Declare Function RasComL_GetAutoTrimRect Lib "LTRPR14n" Alias "L_GetAutoTrimRect" (hBitmap As _
LEADBitmapHandle, ByVal uThreshold&, ByRef pRect As RECT) As Long


Private Sub Command1_Click()
   Dim RasterIO As LEADRasterIO
   Set RasterIO = New LEADRasterIO
   RasterIO.Load LEADRasterView1.Raster, "c:\Sunset.jpg", 24, 0, 1
End Sub

Private Sub Command2_Click()
   Dim TRect As RECT
   RasComL_GetControlBitmap LEADRasterView1.Raster, pBimap
   RasComL_GetAutoTrimRect pBimap, 60, TRect
   MsgBox "The Trim rectangle dimensions: Left= " + Str(TRect.left) + ", Top= " + Str(TRect.top) + ", Right= " + Str(TRect.right) + ", Bottom=" + Str(TRect.bottom)
   RasComL_AutoTrimBitmap pBimap, 60
   RasComL_SetControlBitmap LEADRasterView1.Raster, pBimap
End Sub
+--------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#9 Posted : Wednesday, December 5, 2007 9:36:07 AM(UTC)

blitzy  
blitzy

Groups: Registered
Posts: 16


Is there also an example of how to do this in VB.NET 2005?

Can I use the AutoTrim function to check if the actual page size is legal or normal? For instance, if all users scan with the page set to legal but some regular 8.5" x 11" documents are mixed in, I would like to be able to check the image for the white space at the bottom and then crop/trim it down to normal paper size. Is there an example on how to do this?
 
#10 Posted : Wednesday, December 5, 2007 11:35:29 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

If you want to use Auto Cropping (Trimming) in our v15 .NET classes, the equivalent is AutoCropCommand Class.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#11 Posted : Thursday, December 6, 2007 4:31:37 AM(UTC)

blitzy  
blitzy

Groups: Registered
Posts: 16


<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/SupportPortal/cs/Themes/default/images/icon-quote.gif">&nbsp;<strong>Maen Hasan wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Hello,<br><br>If you want to use Auto Cropping (Trimming) in our v15 .NET classes, the equivalent is AutoCropCommand Class.<br><br>Thanks,<br>Maen Badwan<br>LEADTOOLS Technical Support</td></tr></table></td></tr></table></BLOCKQUOTE>

What about in v14.5 for .NET?
 
#12 Posted : Thursday, December 6, 2007 5:34:37 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

The same command (AutoCropCommand Class) is available in LEADTOOLS v14.5 .Net.
For more information, please refer to the LEADTOOLS .Net documentation.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.122 seconds.