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
Date : March 29 2020, 07:55 AM
|