Closed ccoffey closed 9 years ago
@ccoffey, the modules/text/CMakeLists.txt file is used to build the text module, not the sample applications. You have to create new CMakeLists.txt to build that samples. Please, follow the instructions from the OpenCV cmake tutorial.
You may also need to install OpenCV libraries, the two ways are:
sudo make install
-DCMAKE_INSTALL_PREFIX=install
option when running cmake before OpenCV buildmake install
-DOpenCV_DIR=<path-to-build-directory>/install/share/OpenCV
option to cmake (location of the OpenCVConfig.cmake file)If you will meet more build problems, feel free to ask a question on the Q&A forum.
You have to create new CMakeLists.txt to build that samples. Please, follow the instructions from the OpenCV cmake tutorial.
I was wrong here, the contrib samples can be built automatically with OpenCV.
@ccoffey, you should install libtesseract
(libtesseract-dev package in ubuntu) and add -DBUILD_EXAMPLES=ON
option to cmake on step 5. example_text_*
executables will be created in bin
folder after step 6.
Also, I'd recommend you to take latest 3.0.0-rc1 version.
Do you ever get this working, and if so, how? I'm facing the same issue.
get the latest release, it worked for me. Although tesseract is pretty old and very sensitive to right orientation of the text, good quality and resolution of source image etc. Waste of time. Computers now can do much better ))
Thanks abratchik. Instead of tesseract, what would you recommend for OCR in the wild? As far as I know Google Computer Vision is very good, but it's paid and an on-line service so not ideal.
I tried several API for OCR, none of them are close to Google Vision. Abbey/FreeOCR are ok but also not free and they are worse than Google by far. Google uses dnn I guess, that is the only way you can achieve close-to-human quality recognition. Google is also quite tolerant to text rotation and skewing (i.e. their text blocks are arbitrary 4 vertex and not Rects like most of the competitors do)
This is indeed the impression that I have had as well. Either you feed software perfectly scanned text, or you correct the text very well yourself, or you use Google but with lots of limitations (if you want to detect text in video their pricing model really doesn't work). For this text module in opencv, where you you say the problem lies in general?
1 - Text detection 2 - Text enhancement 3 - OCR done by Tesseract
My text is semi-wild: products scanned with a mobile phone so it might still work.
I'd say 1) is the main problem. OCV implements Extremal Regions method by Neumann and Matas, which works ok but a bit slow and doesn't give good accuracy. If you check the original paper they achieved max ~73% accuracy on ICDAR 2011 dataset. This was pretty good result ... in 2012. Now you can check by yourself - leading methods are doing much better )) Tesseract itself is fine but it requires 300 dpi (pretty large images) for good results. When the quality of the source is worse than 300 dpi the accuracy drops quite dramatically even though the source text is still reasonably readable. However Google chews lower res text pretty well. Conclusion - OCV needs to re-focus on training AI for many areas, not only OCR. Algorithmic methods were good enough ... but not any more.
Very clear answer, thanks! I got it up and running by indeed building opencv entirely and then adding the option to for building the samples. The only thing I had to add was Tesseract and to put the language file in the /usr/local/share. Based on tests using an iPhone as a camera and detecting things in the wild it can recognize text with a height of 15 pixels upwards. Under that it's garbage, over that it becomes more and more reliable. The text has to be straight though since any angle will mess up recognition (although this is certainly just a parameter that needs to get set somewhere).
I am trying to build the sample applications from opencv-3.0.0-beta with opencv_contrib-3.0.0-beta.
Here is what I have done
However I was expecting the sample applications to build, the only one I really care about is: /home/me/opencv/opencv_contrib-3.0.0-beta/modules/text/
I have tried building it with the following steps
sudo cmake . However I get an error, here is the output I get!
-- Tesseract: NO CMake Error at CMakeLists.txt:21 (ocv_define_module): Unknown CMake command "ocv_define_module".
CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 2.8) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!