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, December 22, 2009 9:21:56 AM(UTC)

Kiima  
Kiima

Groups: Registered
Posts: 25


The BlankPageDetectorCommand does not appear to be working right. I have an image that the command thinks is empty, even though it is not. Attached is the image and my code is below.

    Public Shared Function WhitePage(ByRef myImage As RasterImage) As Boolean
        Try
            'Determining whether the image is blank.
            Dim command As New BlankPageDetectorCommand()
            'command.TopMargin = 0
            'command.BottomMargin = 0
            'command.LeftMargin = 0
            'command.RightMargin = 0
            command.Flags = BlankPageDetectorCommandFlags.DetectEmptyPage
            command.Run(myImage)
            If command.IsBlank Then
                'Blank
                Return True
            End If
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try
        'Not blank.
        Return False
    End Function


Thanks,
-Kiima
LeadTools 16.5
VB.NET
File Attachment(s):
BF-00001100-5.tif (10kb) downloaded 25 time(s).
 

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 : Wednesday, December 23, 2009 7:45:49 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

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

Kiima,

I modified your code as follows to get a correct result:
/***************************/
Try
RasterCodecs.Startup()
Dim _codecs As New RasterCodecs
Dim myImage As RasterImage = _codecs.Load("BF-00001100-5.tif")
'Determining whether the image is blank.
Dim command As New BlankPageDetectorCommand()
command.TopMargin = 0
command.BottomMargin = 0
command.LeftMargin = 0
command.RightMargin = 0
command.Flags = BlankPageDetectorCommandFlags.DetectEmptyPage + BlankPageDetectorCommandFlags.UseUserMargins
command.Run(myImage)
If command.IsBlank Then
'Blank
MessageBox.Show(command.Accuracy.ToString)
Else
MessageBox.Show("Image is not Blank")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try
/***************************/
The content of your image is close to the default margins. If you do not specify the margins value and set them to 0 then use the BlankPageDetectorCommandFlags.UseUserMargins, you'll get that the image is totally blank.
 
#3 Posted : Wednesday, December 23, 2009 9:58:43 AM(UTC)

Kiima  
Kiima

Groups: Registered
Posts: 25


Works great. Thanks.
 
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.073 seconds.