This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, December 22, 2009 9:21:56 AM(UTC)
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
#2
Posted
:
Wednesday, December 23, 2009 7:45:49 AM(UTC)
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)
Groups: Registered
Posts: 25
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.