Comments (12)
Could you add some example code? What does repage do?
from magick.
It removes/resets the virtual canvas meta-data from the images.
I've read that it solves the solution here: https://www.imagemagick.org/discourse-server/viewtopic.php?t=25961
from magick.
Do you have an example image/code that I can use to test this?
from magick.
I also added an magick::image_ocr()
wrapper.
from magick.
Sure, this is the image: https://github.com/ShirinG/blog_posts_prep/blob/master/ocr/beispiel_scan.png
And the code:
library(tidyverse)
library(tesseract)
library(magick)
image <- image_read("https://raw.githubusercontent.com/ShirinG/blog_posts_prep/master/ocr/beispiel_scan.png")
image_bearb <- image %>%
image_scale("x2000") %>% # rescale
image_background("white", flatten = TRUE) %>% # set background to white
image_trim() %>% # Trim edges that are the background color from the image.
image_noise() %>% # Reduce noise in image using a noise peak elimination filter.
image_enhance() %>% # Enhance image (minimize noise)
image_normalize() %>% # Normalize image (increase contrast by normalizing the pixel values to span the full range of color values).
image_contrast(sharpen = 1) %>% # increase contrast
image_deskew(treshold = 40) # deskew image -> creates negative offset in some scans == error
text_2 <- ocr(image_bearb,
engine = tesseract(language = "deu"))
from magick.
Hmm it could actually be a problem with the dictionary. Do you get the same error if you don't set the language
parameter?
from magick.
Yes, I do get the same error when I use
text_2 <- ocr(image_bearb)
from magick.
Hmm I can't reproduce the problem here. But it is probably caused by the fact that I use tiff
to get the image from magick to tesseract format but maybe I should change that.
Could you try if the problem disappears when you save as png instead?
image_write(image_bearb, "test.png", format = "png")
tesseract::ocr("test.png", engine = tesseract(language = "deu"))
from magick.
Yeah, this works. So, there is no way to have one consecutive pipeline for the whole analysis?
from magick.
It will be fixed in the next version.
from magick.
Thank you!
from magick.
This should be fixed in the new version on CRAN.
Note that the magick
package now also has a convenience wrapper for tesseract so you can pipe to image_ocr(language = "deu")
without specifically loading the tesseract package.
from magick.
Related Issues (20)
- hexlogo.png is missing
- svg to png conversion using magick::image_read() HOT 5
- librsvg delegate broken on Windows HOT 13
- image_composite "reflects" image position when offset moves composite_image out of area of image HOT 2
- CRAN incoming checks fail due to magick's usage of more than 2 cores HOT 6
- image in (kable) table HOT 1
- Attempt to perform an operation not allowed by the security policy `PDF' HOT 5
- Where to find policy.xml used by magick on osx? HOT 2
- Wrappers for opencv functions
- Dplyr/tidyverse verbs do not work with magick-image tibbles. HOT 4
- Looping mutates HOT 1
- dng pitcure to jpg HOT 2
- image_annotate(): Get available fonts HOT 6
- Support listing other types of options HOT 2
- Comparison warning when compiling options.cpp
- Error: package or namespace load failed for βmagickβ in dyn.load(file, DLLpath = DLLpath, ...):
- Error message: PDF Error: Unexpected MC Type: 7 HOT 5
- The problem of not installing in anaconda HOT 2
- image_read fails to execute `gs` on Windows for reading PDF HOT 14
- `image_splice()`
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 magick.