Comments (4)
What will this change in the outputted PDF? CC @jbreiden @kba
from hocr-tools.
So if I am understanding correctly.
Your calculation is
b = polyval(baseline, (box[0] + box[2]) / 2 - linebox[0]) + linebox[3]
which based on the HOCR spec is
b = polyval(baseline, (bbox-left + bbox-right) / 2 - linebox-left) + linebox-bottom
which you then use here
text.setTextOrigin(box[0] * 72 / dpi, height - b * 72 / dpi)
So this calculation is using Left and Right to calculate an average then subtracting that from height. It seems to me the you'd want to get the average of Top and Bottom (ie. box[1] and box[3]).
So to my mind this makes more sense
b = polyval(baseline, (box[1] + box[3]) / 2 - linebox[1]) + linebox[3]
or
b = polyval(baseline, (bbox-top + bbox-bottom) / 2 - linebox-top) + linebox-bottom
The difference would be seem more obviously in longer words where the difference between Left and Right would be larger. But (as I said before) perhaps I am not understanding what you are trying to accomplish with this calculation.
from hocr-tools.
I don't actively use this program any more, so have not been paying attention. Test with descenders like 'yyy', without descenders like 'xxx' and mixed like 'xxxyyy'.
from hocr-tools.
@zuphilip @jbreiden Can you elaborate on this calculation. I am not getting the proper selection for my text.
Here the selection goes to the bottom of the text.
from hocr-tools.
Related Issues (20)
- hocr-combine file counter HOT 11
- Fix tests
- encoding errors HOT 1
- hocr-cut gives error HOT 6
- alto input? HOT 2
- Output hocr files besides images in hocr-cut HOT 1
- move to python3 HOT 7
- Line images using HOCR HOT 2
- hocr-pdf does not work with tesseract HOT 2
- Installation instructions for Python packages need update for Python 3 HOT 2
- hocr-pdf printing Hebrew text in opposite direction in the generated pdf file HOT 4
- Does it work for windows? HOT 1
- AttributeError: module 'base64' has no attribute 'decodestring' HOT 5
- decodebytes() Depreciated in hocr-pdf use decodestring() HOT 4
- hocr-pdf: change encoding from latin1 to utf-8 HOT 3
- a proposition to help hocr-tools become ZE best HOT 2
- Bilingual Text Encoding is not Working for Kannada-English Output Hocr File
- Font "Invisible" is of dubious copyright
- Link to hOCR spec doesn't work HOT 1
- hocr-extract-images doesn't see image HOT 4
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 hocr-tools.