GithubHelp home page GithubHelp logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
Ah... actually after further investigation with rotating larger angles (like 5
degrees), I discovered that the problem is NOT with pixRotate() but with my
binImageDiff() routine. That was creating the diff image by starting out with 
the
original image. This means the width & height are wrong unless you center that 
image
within the rotated image's width and height. Sorry for false alarm.

However, the artifacts are still there when you directly rotate 1bpp images.


Original comment by [email protected] on 6 Dec 2009 at 10:35

from leptonica.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
You probably thought I forgot about this...

You are right: when you rotate a 1 bpp image you get horizontal and vertical 
shear
lines.  The horizontal ones are most visible when they go through a line of 
text,
making the text even look tilted in some situations.  And the eye is very 
sensitive
to a line of shears, even a single pixel.

There are various ways that have been suggested to prevent this.  One way is to
choose the horizontal shear lines to be in the white background between text 
lines
(for horizontal text).  Another is to put some randomness into the shearing, so 
that
you don't get full lines of shear.

Your suggestion is actually better.  Here is a simple set of operations that 
does a
pretty good job on your declaration of independence.  I've added in some unsharp
masking to counter the blurring in the convolution.

    angletorad = 3.14159 / 180.;
    pix1 = pixRead("doi.tif");
    pix2 = pixConvertTo8(pix1, 0);
    pix3 = pixBlockconv(pix2, 1, 1);
    pixFindSkewSweepAndSearch(pix1, &angle, &conf, 2, 2, 3.0, 0.5, 0.01);
    radangle = angletorad * angle;
    pix4 = pixRotateAM(pix3, radangle, L_BRING_IN_WHITE);
    pix5 = pixUnsharpMasking(pix4, 1, 1.0);
    pix6 = pixThresholdToBinary(pix5, 128);
    pix7 = pixRotateBySampling(pix1, 0, 0, radangle, L_BRING_IN_WHITE);
    pixDisplay(pix6, 100, 100);
    pixDisplay(pix7, 600, 100);
    pixWrite("junkpix6", pix6, IFF_PNG);
    pixWrite("junkpix7", pix7, IFF_PNG);

With some playing around to choose parameters, this would certainly be nice 
enough to
put into the library.

Original comment by [email protected] on 4 Jan 2010 at 5:08

  • Changed title: pixRotate() leaves shear lines on 1 bpp images
  • Changed state: Started

from leptonica.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
This feature has been added to 1.65.
The function is pixRotateBinaryNice().

Original comment by [email protected] on 8 Apr 2010 at 6:00

  • Changed state: Fixed

from leptonica.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.