I'm using the image ocr from the tesseract package to try and extract a value from an image:
Here's my code for trying to extract "2" using the ocr:
library(tesseract)
library(magick)
library(dplyr)
crop <- image_read("2.jpeg")
text <- crop %>%
image_convert(colorspace = 'gray') %>%
image_trim() %>%
image_ocr()
cat(text)
An empty string is outputted, when I'd like the ocr to be able to extract "2". I've messed around with the colorspace and cropping of the image, but nothing has worked so far.
Using R version 4.0.2, Mac OS X 10.13.6