Rank: Advanced Member
Groups: Guest
Joined: 3/8/2018(UTC) Posts: 45
Thanks: 21 times
|
Hi friends, I´m working in a project where I need cropping images, usually BIG TIFF images. I´m newbie with this libraries, so I´m reading and reading the documentation, but I can´t find any function to do a auto-deskew (based on edges, or based on text) before apply the crop. Is there any way to do this...?? Thanks in advance
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Hi, Graphics Mill doesn't implement the deskew algorithm. The general approach of the algorithm (Hough transform) is described here : https://stackoverflow.co...05/deskew-scanned-imagesI have added your request to our backlog, but we don't have any specific plans to implement it. If this feature is critical for you please let me know. |
Best regards, Fedor Skvortsov
|
1 user thanked Fedor for this useful post.
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/8/2018(UTC) Posts: 45
Thanks: 21 times
|
Morning Fedor, thanks again. In my project, I´m trying understand the Pipeline performance and may be I´m doing something wrong. In this moment I´m trying process a Tiff image. I must crop the input tiff, apply border if selected and write in the output path. In the next code I´m using Pipeline, if I use the generator I receive an error: (Either a PipelineElement instance, which cannot act as a receiver, has been passed to a PipelineElement.Receivers collection or a PipelineElement instance, which cannot act as a source, has entries in its PipelineElement.Receivers collection. Nombre del parámetro: element')And if I don´t use the generator my output image has only 1Kb and it´s a invalid image. The problem is that I don´t know how to indicate to the blender that the blender.TopImage is the result of the crop operation. I guess this is the cause of my output bad image. I really don´t know why I don´t need include the reader into my Pipeline sequence (If I do, Pipeline results an exception error saying that TiffReader is included more than one time). Please, could you help me..?? Thanks in advance. Code:using (var reader = TiffReader.Create(ficheroIN))
using (var crop = new Crop(rectangulo))
using (var writer = new TiffWriter(ficheroOUT))
{
if (procesar_exif)
{
var exif = reader.Exif;
writer.Exif = exif;
}
if (border_size != 0)
{
using (var borderColor = new RgbColor(0, 0, 0))
using (var generator = new ImageGenerator(crop.Rectangle.Width + border_size * 2, crop.Rectangle.Height + border_size * 2, reader.PixelFormat, borderColor))
using (var blender = new Blender())
{
//blender.TopImage = reader; How do I use as TopImage the crop result ???
blender.X = border_size;
blender.Y = border_size;
Pipeline.Run(crop + generator + blender + writer);
}
}
else
{
Pipeline.Run(reader + crop + writer);
}
}
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/8/2018(UTC) Posts: 45
Thanks: 21 times
|
I did it on this way, but I don´t know if it´s possible optimize the method including the crop in the Pipeline. Thanks again. Code:using (var reader = TiffReader.Create(ficheroIN))
using (var crop = new Crop(rectangulo))
using (var writer = new TiffWriter(ficheroOUT))
{
var bitmap = new Aurigma.GraphicsMill.Bitmap(rectangulo.Width, rectangulo.Height, reader.PixelFormat);
if (procesar_exif)
{
var exif = reader.Exif;
writer.Exif = exif;
}
if (border_size != 0)
{
using (var borderColor = RgbColor.Black)
using (var generator = new ImageGenerator(crop.Rectangle.Width + border_size * 2, crop.Rectangle.Height + border_size * 2, reader.PixelFormat, borderColor))
using (var blender = new Blender())
{
bitmap = reader.Frames[0].GetBitmap();
bitmap.Transforms.Crop(rectangulo);
blender.TopImage = bitmap;
blender.X = border_size;
blender.Y = border_size;
generator.DpiX = reader.DpiX;
generator.DpiY = reader.DpiY;
Pipeline.Run(generator + blender + writer);
bitmap.Dispose();
}
}
else
{
Pipeline.Run(reader + crop + writer);
}
}
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
Hi, This line should do the trick. Code:blender.TopImage = reader.Frames[0] + crop;
|
Best regards, Eugene Kosmin The Aurigma Development Team
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/8/2018(UTC) Posts: 45
Thanks: 21 times
|
Thanks Eugene, I´ll try it and let you know. Regards.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/8/2018(UTC) Posts: 45
Thanks: 21 times
|
Originally Posted by: Eugene Kosmin Hi, This line should do the trick. Code:blender.TopImage = reader.Frames[0] + crop;
It works...!!!! Thanks a lot...!!! Regards.
|
|
|
|
Forum Jump
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.