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, November 2, 2010 7:10:40 AM(UTC)
buildinglink

Groups: Registered
Posts: 2


I am using LeadTools 17. I am trying to implement the BorderRemoveCommand in the following code. I get an "Invalid Bits/Pixel" error on the Run method regardless of the type of image file I select. I have referenced the the proper Codec dlls. for the image formats.

OpenFileDialog open = new OpenFileDialog();
if (open.ShowDialog().Value == true)
{
using (Stream stream = open.OpenFile())
{
RasterCodecs.Startup();
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
_viewer.Image = codecs.Load(stream);
}
}

BorderRemoveCommand borderRemove = new BorderRemoveCommand();

borderRemove.Border = BorderRemoveBorderFlags.All;
borderRemove.Flags = BorderRemoveCommandFlags.UseVariance ;
borderRemove.Percent = 20;
borderRemove.Variance = 3;
borderRemove.WhiteNoiseLength = 9;
borderRemove.Run(_viewer.Image);
 

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, November 3, 2010 5:16:00 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

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

BorderRemoveCommand works only with 1-bit black and white image. You can convert your images to 1-bit black and white using Leadtools.ImageProcessing.ColorResolutionCommand Class and setting PaletteFlags to Fixed.

 
#3 Posted : Wednesday, November 3, 2010 5:52:23 AM(UTC)
buildinglink

Groups: Registered
Posts: 2


Thanks for that information. Your documentation does not make that clear. Unfortunately it does not solve our problem which is to remover borders from 24 bit color images. The autocrop command does not really work at all for us.
 
#4 Posted : Wednesday, November 3, 2010 7:32:09 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

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

You can create a copy of that image and convert it to 1-bit Black and White and then use BorderRemoveCommandEventArgs Class to read the regions. Use that region to apply them to the original image and fill the region with a white color.
 
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-2020, Yet Another Forum.NET
This page was generated in 0.057 seconds.