This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, June 20, 2006 10:12:29 AM(UTC)
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
#2
Posted
:
Tuesday, June 20, 2006 1:52:58 PM(UTC)
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)
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)
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)
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
#6
Posted
:
Friday, June 30, 2006 10:12:02 AM(UTC)
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)
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)
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)
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)
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)
Groups: Registered
Posts: 16
<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/SupportPortal/cs/Themes/default/images/icon-quote.gif"> <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)
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.