Skip to content

Commit dc48968

Browse files
committed
removed blanks, fixed Cmake issue
1 parent c697e41 commit dc48968

File tree

6 files changed

+16
-90
lines changed

6 files changed

+16
-90
lines changed

modules/text/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
set(the_description "Text Detection and Recognition")
22

3+
if(POLICY CMP0023)
4+
message(STATUS "Explicitly setting policy CMP0023 to OLD")
5+
cmake_policy(SET CMP0023 OLD)
6+
endif(POLICY CMP0023)
7+
38
# Using cmake scripts and modules
49
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
510

modules/text/README.md

Lines changed: 11 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,22 @@ Notes
4949
3. You are encouraged to search the Net for some better pre-trained classifiers, as well as classifiers for other languages.
5050

5151

52-
Word spotting CNN
52+
Text Detection CNN
5353
=================
5454

5555
Intro
5656
-----
5757

58-
A word spotting CNN is a CNN that takes an image assumed to contain a single word and provides a probabillity over a given vocabulary.
59-
Although other backends will be supported, for the moment only the Caffe backend is supported.
58+
The text module now have a text detection and recognition using deep CNN. The text detector deep CNN that takes an image which may contain multiple words. This outputs a list of Rects with bounding boxes and probability of text there. The text recognizer provides a probabillity over a given vocabulary for each of these rects.
59+
60+
Two backends are supported 1) caffe 2) opencv-dnn
6061

6162

6263

6364

6465
Instalation of Caffe backend
6566
----------------------------
67+
* Please note a custom caffe based on SSD branch is required, the link of the custom caffe is provided below
6668
The caffe wrapping backend has the requirements caffe does.
6769
* Caffe can be built against OpenCV, if the caffe backend is enabled, a circular bependency arises.
6870
The simplest solution is to build caffe without support for OpenCV.
@@ -77,10 +79,8 @@ Sample script for building Caffe
7779
SRCROOT="${HOME}/caffe_inst/"
7880
mkdir -p "$SRCROOT"
7981
cd "$SRCROOT"
80-
git clone https://github.com/BVLC/caffe.git
81-
cd caffe
82-
git checkout 91b09280f5233cafc62954c98ce8bc4c204e7475
83-
git branch 91b09280f5233cafc62954c98ce8bc4c204e7475
82+
git clone https://github.com/sghoshcvc/TextBoxes.git
83+
cd TextBoxes
8484
cat Makefile.config.example > Makefile.config
8585
echo 'USE_OPENCV := 0' >> Makefile.config
8686
echo 'INCLUDE_DIRS += /usr/include/hdf5/serial/' >> Makefile.config
@@ -115,77 +115,15 @@ make distribute
115115
cd $OPENCV_BUILD_DIR #You must set this
116116
CAFFEROOT="${HOME}/caffe_inst/" #If you used the previous code to compile Caffe in ubuntu 16.04
117117

118-
cmake -DCaffe_LIBS:FILEPATH="$CAFFEROOT/caffe/distribute/lib/libcaffe.so" -DBUILD_opencv_ts:BOOL="0" -DBUILD_opencv_dnn:BOOL="0" -DBUILD_opencv_dnn_modern:BOOL="0" -DCaffe_INCLUDE_DIR:PATH="$CAFFEROOT/caffe/distribute/include" -DWITH_MATLAB:BOOL="0" -DBUILD_opencv_cudabgsegm:BOOL="0" -DWITH_QT:BOOL="1" -DBUILD_opencv_cudaoptflow:BOOL="0" -DBUILD_opencv_cudastereo:BOOL="0" -DBUILD_opencv_cudafilters:BOOL="0" -DBUILD_opencv_cudev:BOOL="1" -DOPENCV_EXTRA_MODULES_PATH:PATH="/home/anguelos/work/projects/opencv_gsoc/opencv_contrib/modules" ./
118+
cmake -DCaffe_LIBS:FILEPATH="$CAFFEROOT/caffe/distribute/lib/libcaffe.so" -DBUILD_opencv_ts:BOOL="0" -DBUILD_opencv_dnn:BOOL="0" -DBUILD_opencv_dnn_modern:BOOL="0" -DCaffe_INCLUDE_DIR:PATH="$CAFFEROOT/caffe/distribute/include" -DWITH_MATLAB:BOOL="0" -DBUILD_opencv_cudabgsegm:BOOL="0" -DWITH_QT:BOOL="1" -DBUILD_opencv_cudaoptflow:BOOL="0" -DBUILD_opencv_cudastereo:BOOL="0" -DBUILD_opencv_cudafilters:BOOL="0" -DBUILD_opencv_cudev:BOOL="1" -DOPENCV_EXTRA_MODULES_PATH:PATH="$OPENCV_CONTRIB/modules" ./
119119

120120

121121
```
122-
123-
Text Detection CNN
124-
=================
125-
126-
Intro
127-
-----
128-
129-
A text detection CNN is a CNN that takes an image which may contain multiple words. This outputs a list of Rects with bounding boxes and probability of text there.
130-
Although other backends will be supported, for the moment only the Caffe backend is supported.
131-
132-
133-
122+
where $OPECV_CONTRIB is the root directory containing opencv_contrib module
134123

135124
Instalation of Caffe backend
136125
----------------------------
137-
* Please note a custom caffe based on SSD branch is required, the link of the custom caffe is provided below
138-
The caffe wrapping backend has the requirements caffe does.
139-
* Caffe can be built against OpenCV, if the caffe backend is enabled, a circular bependency arises.
140-
The simplest solution is to build caffe without support for OpenCV.
141-
* Only the OS supported by Caffe are supported by the backend.
142-
The scripts describing the module have been developed in ubuntu 16.04 and assume such a system.
143-
Other UNIX systems including OSX should be easy to adapt.
144126

145-
Sample script for building Caffe
127+
Use of opencv-dnn does not need any additional library.
146128

147-
```bash
148-
#!/bin/bash
149-
SRCROOT="${HOME}/caffe_inst/"
150-
mkdir -p "$SRCROOT"
151-
cd "$SRCROOT"
152-
git clone https://github.com/sghoshcvc/TextBoxes.git
153-
cd TextBoxes
154-
cat Makefile.config.example > Makefile.config
155-
echo 'USE_OPENCV := 0' >> Makefile.config
156-
echo 'INCLUDE_DIRS += /usr/include/hdf5/serial/' >> Makefile.config
157-
echo 'LIBRARY_DIRS += /usr/lib/x86_64-linux-gnu/hdf5/serial/' >> Makefile.config
158-
159-
160-
echo "--- /tmp/caffe/include/caffe/net.hpp 2017-05-28 04:55:47.929623902 +0200
161-
+++ caffe/distribute/include/caffe/net.hpp 2017-05-28 04:51:33.437090768 +0200
162-
@@ -234,6 +234,7 @@
163-
164-
template <typename T>
165-
friend class Net;
166-
+ virtual ~Callback(){}
167-
};
168-
const vector<Callback*>& before_forward() const { return before_forward_; }
169-
void add_before_forward(Callback* value) {
170-
">/tmp/cleanup_caffe.diff
171-
172-
patch < /tmp/cleanup_caffe.diff
173-
174-
175-
make -j 6
176-
177-
make pycaffe
178-
179-
make distribute
180-
```
181-
182-
183-
```bash
184-
#!/bin/bash
185-
cd $OPENCV_BUILD_DIR #You must set this
186-
CAFFEROOT="${HOME}/caffe_inst/" #If you used the previous code to compile Caffe in ubuntu 16.04
187-
188-
cmake -DCaffe_LIBS:FILEPATH="$CAFFEROOT/caffe/distribute/lib/libcaffe.so" -DBUILD_opencv_ts:BOOL="0" -DBUILD_opencv_dnn:BOOL="0" -DBUILD_opencv_dnn_modern:BOOL="0" -DCaffe_INCLUDE_DIR:PATH="$CAFFEROOT/caffe/distribute/include" -DWITH_MATLAB:BOOL="0" -DBUILD_opencv_cudabgsegm:BOOL="0" -DWITH_QT:BOOL="1" -DBUILD_opencv_cudaoptflow:BOOL="0" -DBUILD_opencv_cudastereo:BOOL="0" -DBUILD_opencv_cudafilters:BOOL="0" -DBUILD_opencv_cudev:BOOL="1" -DOPENCV_EXTRA_MODULES_PATH:PATH="/home/anguelos/work/projects/opencv_gsoc/opencv_contrib/modules" ./
189-
190-
191-
```
129+
The recent opencv-3.3.0 needs to be build with extra modules to use text module.

modules/text/include/opencv2/text/ocr.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ CV_EXPORTS_W Ptr<OCRBeamSearchDecoder::ClassifierCallback> loadOCRBeamSearchClas
657657

658658

659659
//Classifiers should provide diferent backends
660-
//For the moment only caffe is implemeted
661660

662661
enum{
663662
OCR_HOLISTIC_BACKEND_NONE, //No back end

modules/text/src/precomp.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545

4646
#include "opencv2/text.hpp"
4747

48-
//#include "text_config.hpp"
49-
5048
#ifdef HAVE_TESSERACT
5149
#include <tesseract/baseapi.h>
5250
#include <tesseract/resultiterator.h>

modules/text/src/text_detectorCNN.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class DeepCNNTextDetectorCaffeImpl: public DeepCNNTextDetector{
9191
}
9292

9393

94-
9594
#ifdef HAVE_CAFFE
9695
Ptr<caffe::Net<float> > net_;
9796
#endif
@@ -160,10 +159,6 @@ class DeepCNNTextDetectorCaffeImpl: public DeepCNNTextDetector{
160159
this->outputGeometry_.height =net_->output_blobs()[0]->height();
161160
this->outputGeometry_.width = net_->output_blobs()[0]->width();
162161

163-
164-
165-
166-
167162
#else
168163
CV_Error(Error::StsError,"Caffe not available during compilation!");
169164
#endif

modules/text/text_config.hpp.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
#ifndef __OPENCV_TEXT_CONFIG_HPP__
22
#define __OPENCV_TEXT_CONFIG_HPP__
33

4-
// HAVE QT5
5-
//#cmakedefine HAVE_QT5GUI
6-
7-
// HAVE CAFFE
8-
//#cmakedefine HAVE_CAFFE
9-
10-
// HAVE OCR Tesseract
11-
//#cmakedefine HAVE_TESSERACT
12-
134
#endif

0 commit comments

Comments
 (0)