OpenCV Adaptive Threshold OCR

Here is my result: Here is the code: #include <iostream> #include <vector> #include <stdio.h> #include <stdarg.h> #include “opencv2/opencv.hpp” #include “fstream” #include “iostream” using namespace std; using namespace cv; //—————————————————————————————————– // //—————————————————————————————————– void CalcBlockMeanVariance(Mat& Img,Mat& Res,float blockSide=21) // blockSide – the parameter (set greater for larger font on image) { Mat I; Img.convertTo(I,CV_32FC1); Res=Mat::zeros(Img.rows/blockSide,Img.cols/blockSide,CV_32FC1); Mat inpaintmask; … Read more

Converting YUV->RGB(Image processing)->YUV during onPreviewFrame in android?

Although the documentation suggests that you can set which format the image data should arrive from the camera in, in practice you often have a choice of one: NV21, a YUV format. For lots of information on this format see http://www.fourcc.org/yuv.php#NV21 and for information on the theory behind converting it to RGB see http://www.fourcc.org/fccyvrgb.php. There … Read more

Limit characters tesseract is looking for

Create a config file (e.g “letters”) in tessdata/configs directory – usually /usr/share/tesseract/tessdata/configs or /usr/share/tesseract-ocr/tessdata/configs And add this line to the config file: tessedit_char_whitelist abcdefghijklmnopqrstuvwxyz …or maybe [a-z] works. I don’t know. Then call tesseract similar to this: tesseract input.tif output nobatch letters That will limit tesseract to recognize only the wanted characters.

How to make the blackboard text appear clearer using MATLAB?

When it comes to identifying text in images you better use Stroke Width Transform. Here’s a little result I obtained on your image (the basic transform + connected component w/o filtering): My mex implementation based on code from here #include “mex.h” #include <vector> #include <map> #include <set> #include <algorithm> #include <math.h> using namespace std; #define … Read more

OCR and character similarity

for recognition or classification most OCR’s use neural networks These must be properly configured to desired task like number of layers internal interconnection architecture , and so on. Also problem with neural networks is that they must be properly trained which is pretty hard to do properly because you will need to know for that … Read more

How to de-skew a text image and retrieve the new bounding box of that image Python OpenCV?

Here’s a modified implementation of the Projection Profile Method to correct skewed images as described in Projection profile based skew estimation algorithm for JBIG compressed images. After obtaining a binary image, the idea is to rotate the image at various angles and generate a histogram of pixels in each iteration. To determine the skew angle, … Read more

Python OpenCV skew correction for OCR

Here’s an implementation of the Projection Profile Method algorithm for skew angle estimation. Various angle points are projected into an accumulator array where the skew angle can be defined as the angle of projection within a search interval that maximizes alignment. The idea is to rotate the image at various angles and generate a histogram … Read more

tech