This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, November 2, 2010 7:10:40 AM(UTC)
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);
#2
Posted
:
Wednesday, November 3, 2010 5:16:00 AM(UTC)
Groups: Guests
Posts: 3,022
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)
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)
Groups: Guests
Posts: 3,022
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.