first my final goal is to process the following image with tesseract:
http://ubuntuone.com/72m0ujsL9RhgfMIlugRDWP
(I wiped out the second and the third column...)
However tesseract has problems with the dotted background. So my idea is to pre-process the image with OpenCV. The best would be if I could somehow detect each line, because I need to remove the dotted background by applying a different threshold than to even lines. Is there any solution to solve my problem? So far I have found Hough Transformation and maybe segmentation, but the results weren't very good (maybe because of wrong parameter)... But I'm not sure, if these are possible approaches and what I invest my time best on.
Column detection would be fine, too, because the second column contains numbers and the third characters, only. Passing this "knowledge" to tesseract could improve its detection rate even more.
I would be really thankful if somebody could give me some hints how to solve this issue and which OpenCV functions are used best, with which paremeters. Some snippets that give me a fair idea about the different steps would be helpful, too.
Thank in advance!!!
Kind regards.
I would suggest you use something like erosion, as the dots seem to be rather small as compared to the width of the letters.
OR I would Canny edge detection with proper thresholds so that I would discard the rather short and thin edges of the dots.
Hope this helps, have fun!
Related
It seems that I need some advice on segmenting connected characters (see the image below).
As you can see, C and U, as well as 4,9 and 9 are connected and therefore when I try to draw contours they are joined into one block. Unfortunately, there are plenty of such problematic images so I think I need to find some solution.
I have tried using different morphological transforms (erosion, dilation, opening), but that doesn't solve the problem.
Thanks in advance for any recommendations.
It seems to me that the best solution will be to work on the preprocessing, if there is a possibility.
Otherwise, you can try Machine Learning techniques. You may get inspiration from Viola-Jones or Histograms of Oriented Gradients + SVM algorithms (even though those algorithms solve a problem that differs from Optical Character Recognition, I had plenty of insights from them). In other words, try "sliding" a window along a horizontal of predefined aspect ratio and recognize characters. But the problem may be that you will need to train a model, which may require a lot of data.
As I said earlier, it may be a good idea to reconsider the image preprocessing step. By the way, it seems that in the case of "C" and "U", erosion may help.
Good luck!:)
I've been trying to extract hand-drawn circles from a document for a while now but every attempt I make doesn't have the level of consistency I need.
Process Album
The problem I keep coming up against is when 2 "circles" are too close they become a single contour, ruining my attempt to detect if a contour is curved. I'm sure there must be a better way to extract these circles, but their imperfection and inconsistency are really stumping me.
I've tried many other ways to single out the curves, the most accurate of which being:
Rather than use dilation to bridge the gap between the segmented contours, find the endpoints and attempt to continue the curve until it hits another contour.
Problem: I can't effectively find the turning points of the contour, otherwise this would be my preferable method
I apologize if this question is deemed "too specific", but I feel like Computer Vision stuff like this can always be applied elsewhere.
Thanks ahead of time for any and all help, I'm about at the end of my rope here.
EDIT: I've just realized the album wasn't working correctly, I think it should be fixed now though.
It looks like a very challenging problem so it is very likely that the things I am going to write wouldn't work very well in practice.
In order to ease the problem, I would probably try to remove as much of other stuff from the image as possible.
If the template of the document is always the same, it might be worth trying to remove horizontal and vertical lines along with grayed areas. For example, given the empty template, substract it from the document that you are processing. Probably, it might be possible to get rid of the text also. This would result in an image with only parts of hand drawn circles.
On such image, detecting circles or ellipses with hough transform might give some results (although shapes might be far from circles or ellipses).
I'd like to check one feature (The lower part of the RAI) if it does appear at the top of the given images. Occasionally, there may be some noises at the left or right of the images affecting the detection such as some vertical lines or the to-be-detected image is a totally different image without the feature(RAI).
What would be the best way to achieve my expectation?
I prefer to use OpenCV. But should I use ORB,FREAK,BRISK,SURF algorithms for the detection? I'm not sure if this is the approximate case to use. I wonder if there are any other good choices and ask for help. Thanks in advance. This problem bothers me quite a long time.
Is it possible to compare two intensity histograms (derived from gray-scale images) and obtain a likeness factor? In other words, I'm trying to detect the presence or absence of an soccer ball in an image. I've tried feature detection algorithms (such as SIFT/SURF) but they are not reliable enough for my application. I need something very reliable and robust.
Many thanks for your thoughts everyone.
This answer (Comparing two histograms) might help you. Generally, intensity comparisons are quite sensitive as e.g. white during day time is different from white during night time.
I think you should be able to derive something from compareHist() in openCV (http://docs.opencv.org/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.html) to suit your needs if compareHist() does fit your purpose.
If not, this paper http://www.researchgate.net/publication/222417618_Tracking_the_soccer_ball_using_multiple_fixed_cameras/file/32bfe512f7e5c13133.pdf
tracks the ball from multiple cameras and you might get some more ideas from that even though you might not be using multiple cameras.
As kkuilla have mentioned, there is an available method to compare histogram, such as compareHist() in opencv
But I am not certain if it's really applicable for your program. I think you will like to use HoughTransfrom to detect circles.
More details can be seen in this paper:
https://files.nyu.edu/jb4457/public/files/research/bristol/hough-report.pdf
Look for the part with coins for the circle detection in the paper. I did recall reading up somewhere before of how to do ball detection using Hough Transform too. Can't find it now. But it should be similar to your soccer ball.
This method should work. Hope this helps. Good luck(:
I'm trying to detect the presence of lines from a picture of a geometrical drawing. For example, there is a triangle, and I'm looking for the bisector of one of its angles. So I know exactly where and how long the line should be.
My approach so far is to detect all the lines with the Hough transform function and look for my line among those. However, this is rather slow and conceptually not very nice. Indeed, since I know the two extremities of the segment I'm looking for, it seems more natural to directly look for at this very place.
To do this, my first intuition was to use the result of Canny and loop through each pixel that should contain a line. Before I implement this, I was wondering if something similar already existed or if someone more expert in CV would recommend another approach. I've seen this but I'm looking for lines, not contour, so not sure this would work...
The Canny idea might work quite well. Since you were looking for other ideas, you might also consider trying corner detection. Assuming the geomerical shape is segmented you might try either the classic Harris corners or you might try some of the newer feature detectors like SURF, SIFT, FAST, etc. You may have to adjust the parameter sensitivities of these detectors in order to isolate the corners, but that might allow you to compute the lines based on a set of points. Also, a combination of Canny edge detection and feature detection might be more robust as well.
Just a thought :) Hope it helps!