logo
down
shadow

(Py)Tesseract failing to read text from simple image


(Py)Tesseract failing to read text from simple image

Content Index :

(Py)Tesseract failing to read text from simple image
Tag : python-3.x , By : beebob
Date : January 12 2021, 09:11 PM

I hope this helps you . I have solved it on my own. The issue was the fact that the image was too large. I had been under the impression that the bigger the better, as from what I was reading that seemed to be true, but decided to reduce size to see if that was an issue. It was! Everything works perfectly now.

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

The Tesseract OCR engine isn't able to read the text from an auto generated image, but can from a CUT in MS Paint


Tag : chash , By : CSCI GOIN KILL ME
Date : March 29 2020, 07:55 AM
I hope this helps . The default resolution of a new Bitmap is 96 DPI, which is not adequate for OCR purpose. Try to increase to 300 DPI, such as:
bmp.SetResolution(300, 300);
public static Image Rescale(Image image, int dpiX, int dpiY)
{
    Bitmap bm = new Bitmap((int)(image.Width * dpiX / image.HorizontalResolution), (int)(image.Height * dpiY / image.VerticalResolution));
    bm.SetResolution(dpiX, dpiY);
    Graphics g = Graphics.FromImage(bm);
    g.InterpolationMode = InterpolationMode.Bicubic;
    g.PixelOffsetMode = PixelOffsetMode.HighQuality;
    g.DrawImage(image, 0, 0);
    g.Dispose();

    return bm;
}

Unable to read the text from an image using tessnet2 and Tesseract-OCR


Tag : chash , By : Arun Thomas
Date : March 29 2020, 07:55 AM
help you fix your problem The issue is resolved: by downloading the LANG packages from here: https://github.com/tesseract-ocr/langdata
Which was missing previously.The most important thing for Tessnet2 work is to get the languages packages, get it here (https://github.com/tesseract-ocr/langdata) for the languages you want. For the sample, I use the English language.
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using tessnet2;
 using System.Drawing;
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.IO;

 namespace ConsoleApplication2
 {
class Program
{
    static void Main(string[] args)
    {
        var image = new Bitmap(@"D:\Python\download.jpg");
        tessnet2.Tesseract ocr = new tessnet2.Tesseract();
        ocr.Init(@"C:\Program Files (x86)\Tesseract-OCR\tessdata", "eng",false);
        List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
        foreach (tessnet2.Word word in result)
        {
            Console.WriteLine("{0} : {1}",word.Confidence,word.Text);

        }

        Console.Read();
    }

}
}

Read .jpeg image text using c# and Tesseract


Tag : chash , By : user183289
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Im trying to read the text content of an image using Tesseract. Im using the following code for that.
 ocr.Init(@"D:\Projects\Project Docs\Oasis\", "eng", false);

How to read black text on black background image through tesseract OCR?


Tag : python , By : Adrian Codrington
Date : March 29 2020, 07:55 AM
With these it helps What you need to do is make the whole image black and white before letting tesseract do its job.
Read image
import cv2
im_gray = cv2.imread('your_image_here', cv2.IMREAD_GRAYSCALE)
(thresh, im_bw) = cv2.threshold(im_gray, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
thresh = 127
im_bw = cv2.threshold(im_gray, thresh, 255, cv2.THRESH_BINARY)[1]
cv2.imwrite('bw_image.png', im_bw)

Tesseract works for images that contains only and only text- Crop image to get only the text part from image


Tag : ruby-on-rails , By : George Handlin
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • python3 take a callback that may take an argument and may not
  • How to make two iteration in for loop using for-in syntax
  • Finding Middle point of list in Python
  • using a for loop for web scraping - cannot "pass" certain data
  • Generate positive only distribution based on array
  • Why is numpy.random.choice modifying my data?
  • Pandas applymap loops twice, apply once?
  • Removing rows with specific text
  • Get the most repeated value from columns of list other than zero in pandas data frame
  • How to insert text in multiple files using python
  • Python merging excel files in directory
  • How to put the every start time as 0 in every day for specific column input data using panda python
  • Data Frame Error: UndefinedVariableError: name is not defined
  • Why won't a new line be created in this string? is it too long?
  • Python 3 - files imported as dictionary, but the values are lists - how to resolve?
  • Flask Tutorial: Could Not Import app in Visual Studio Code 1.37.1
  • 'TypeError: decoding str is not supported' when appending str in for loop within a for loop
  • How to scale a data using Python 3
  • How to create a matrix of characters with numpy broadcasting, meshgrid or other method
  • Is there any way of getting values from keys inside other keys?
  • Conditional Statements for dataframes
  • Python implementation of BFS to solve 8-puzzle takes too long to find a solution
  • Operand for matching any one of multiple cases
  • Is the rear item in a Queue the last item added or the item at the end of a Queue?
  • I am trying slicing but I have the following error message: slice indices must be integers or None or have an __index__
  • How to represent Binary tree into an array using python?
  • Vectorized implementation of field-aware factorization
  • 'Float' object has no attribute 'log'
  • pathlib mkdir creates a folder by filename
  • SyntaxError: invalid syntax for if statement
  • math.gcd() vs Euclidean Algo
  • Simplest way to read CSV file in a python function
  • How can I sort two lists identically?
  • Getting NaNs in X_train and X_test after training/splitting data
  • How to add extra information points to a Matplotlib plot?
  • How to Sort Alphabets
  • How could I fetch a secret from Secrets Manager and Pass it to my SSM Run Command Document via lambda?
  • I am getting failed to make TCP connection to port 8080: connection refused
  • How to get related field value from database in odoo 11 and postgresql?
  • How to remove the duplicates from a list
  • Rounding floating points in python
  • how to fix "There is at least 1 reference to internal data in the interpreter in the form of a numpy array or slice
  • calculate the arithmetic mean
  • ValueError: A merge layer should be called on a list of inputs. Tensorflow Keras
  • Generate random number with n digits and avoid using 0 as first digit?
  • Creating presigned url for a S3 folder in python
  • Is there a usecase for overriding __hash__?
  • Concatenating columns in pandas
  • How to create a dictionary using the the list of letters as keys with values being the uppercase version of the letters
  • Installing cwiid with Python 3 extension
  • sqlalchemy ORM query object returns result of different type depending on context
  • Concatenation of Lambda functions in Python 3
  • When Scraping got html with "encoded" part, is it possible to get it
  • Factor Analysis using Python Factor_Analyzer
  • opening csv file in a numpy.txt in python3
  • i tried installing tensorflow using 'pip install tensorflow ' in anaconda prompt and command prompt. its showing followi
  • Keras EarlyStopping is not recognized
  • Parallel processes overwriting progress bars (tqdm)
  • Even though strings in python are immutable how is that sort or sorted function works on it?
  • How to apply default value to python dataclass field when None was passed?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com