Comments (3)
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.
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.
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)
- Unable to build leptonica.dll. HOT 5
- RFE: open files with `O_CLOEXEC` HOT 6
- My. net6 program uses the Tesseract library, which works fine under Windows, but fails under Linux HOT 1
- Security binary scan reports XZ Utils library but unable to detect the version HOT 2
- Build fails under Windows HOT 27
- 1.83.1: test suite fails in `ioformats_reg` unit HOT 7
- JPEG decompression is not unique, which can cause colorcontent_reg to fail on the number of colors in wyom.jpg HOT 1
- Suggest noting that libtiff must have been compiled with JPEG compression support for tests to run correctly HOT 4
- Leptonica 1.84 release schedule HOT 28
- How to detect the four corners of paper or ID card HOT 8
- 1.84.0 fails to build in FreeBSD 14.0 due missing reference to libm using CMake HOT 24
- CMake build in 1.84.0 adds include to non-existant path
- 1.84.1: compile time warnings HOT 3
- pixWriteJp2k: unexpected strong color artifacts on featureless image HOT 7
- pixOrientDetect with .bmp file HOT 6
- Logic error in pixcmapIsValid() HOT 5
- Regression: file not found on MacOS when opening /tmp file HOT 2
- Identifying and removing asterisks HOT 8
- pixDeskewGeneral(...) failing to detect a 45 degree skew? HOT 2
- Application crashing while disposing Pix.Create object HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leptonica.