There are multiple ways to retrieve text written vertically (in Japanese format) from png images using R, but one possible method is to use OCR (Optical Character Recognition) software.
OCR software is designed to recognize and convert text within an image into a machine-readable format, such as a text file. To use OCR in R, the "tesseract" package can be installed (using the command "install.packages('tesseract')") and loaded ("library(tesseract)").
Once the package is loaded, the "ocr" function can be used to extract the text from the image. For example:
library(tesseract)
img <- image_read("path/to/image.png")
text <- ocr(img, engine = tesseract("jpn", options = list(page_orientation = "vertical")))
In this example, the "image_read" function loads the png image from the specified path, and the "ocr" function applies OCR to the image using the Japanese language ("jpn") and specifying the page orientation as vertical. The resulting text is stored in the "text" variable as a character vector.
Note that the accuracy of OCR may vary depending on the quality of the image and the complexity of the text. In some cases, pre-processing techniques such as image binarization and deskewing may be necessary to improve the OCR results.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-12-16 11:00:00 +0000
Seen: 8 times
Last updated: Apr 22 '21