File tree 3 files changed +66
-18
lines changed
3 files changed +66
-18
lines changed Original file line number Diff line number Diff line change 1
1
set (the_description "Text Detection and Recognition" )
2
- ocv_define_module(text opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn OPTIONAL opencv_highgui WRAP python java)
2
+ set (__extra_deps "" )
3
+ if (DEBUG_opencv_text)
4
+ list (APPEND __extra_deps PRIVATE opencv_highgui)
5
+ endif ()
6
+
7
+ ocv_define_module(text
8
+ opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn
9
+ ${__extra_deps}
10
+ WRAP
11
+ python
12
+ java
13
+ )
3
14
4
- if (NOT CMAKE_CROSSCOMPILING OR OPENCV_FIND_TESSERACT)
5
- find_package (Tesseract QUIET ) # Prefer CMake's standard locations (including Tesseract_DIR)
6
- if (NOT Tesseract_FOUND)
7
- include ("${CMAKE_CURRENT_SOURCE_DIR} /cmake/FindTesseract.cmake" ) # OpenCV's fallback
8
- endif ()
9
- if (Tesseract_FOUND)
10
- if (Tesseract_VERSION)
11
- message (STATUS "Tesseract: YES (ver ${Tesseract_VERSION} )" )
12
- else ()
13
- message (STATUS "Tesseract: YES (ver unknown)" )
14
- endif ()
15
- set (HAVE_TESSERACT 1)
16
- ocv_include_directories(${Tesseract_INCLUDE_DIRS} )
17
- ocv_target_link_libraries(${the_module} ${Tesseract_LIBRARIES} )
18
- else ()
19
- message (STATUS "Tesseract: NO" )
20
- endif ()
15
+ if (HAVE_TESSERACT)
16
+ ocv_include_directories(${Tesseract_INCLUDE_DIRS} )
17
+ ocv_target_link_libraries(${the_module} ${Tesseract_LIBRARIES} )
21
18
endif ()
22
19
23
20
configure_file (${CMAKE_CURRENT_SOURCE_DIR} /text_config.hpp.in
Original file line number Diff line number Diff line change
1
+ #if !defined(USE_STD_NAMESPACE)
2
+ #define USE_STD_NAMESPACE
3
+ #endif
4
+ #include < tesseract/baseapi.h>
5
+ #include < tesseract/resultiterator.h>
6
+
7
+ static void test ()
8
+ {
9
+ tesseract::TessBaseAPI tess;
10
+ }
11
+
12
+ int main () { test (); return 0 ; }
Original file line number Diff line number Diff line change
1
+ OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CROSSCOMPILING )
2
+ VERIFY HAVE_TESSERACT)
3
+
4
+ if (NOT HAVE_TESSERACT
5
+ AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT)
6
+ )
7
+ if (NOT Tesseract_FOUND)
8
+ find_package (Tesseract QUIET ) # Prefer CMake's standard locations (including Tesseract_DIR)
9
+ endif ()
10
+ if (NOT Tesseract_FOUND)
11
+ include ("${CMAKE_CURRENT_LIST_DIR} /FindTesseract.cmake" ) # OpenCV's fallback
12
+ endif ()
13
+ if (Tesseract_FOUND)
14
+ if (Tesseract_VERSION)
15
+ message (STATUS "Tesseract: YES (ver ${Tesseract_VERSION} )" )
16
+ else ()
17
+ message (STATUS "Tesseract: YES (ver unknown)" )
18
+ endif ()
19
+ if (NOT ENABLE_CXX11 AND NOT OPENCV_SKIP_TESSERACT_BUILD_CHECK)
20
+ try_compile (__VALID_TESSERACT
21
+ "${OpenCV_BINARY_DIR} /cmake_check/tesseract"
22
+ "${CMAKE_CURRENT_LIST_DIR} /checks/tesseract_test.cpp"
23
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${Tesseract_INCLUDE_DIRS} "
24
+ LINK_LIBRARIES ${Tesseract_LIBRARIES}
25
+ OUTPUT_VARIABLE TRY_OUT
26
+ )
27
+ if (NOT __VALID_TESSERACT)
28
+ if (OPENCV_DEBUG_TESSERACT_BUILD)
29
+ message (STATUS "${TRY_OUT} " )
30
+ endif ()
31
+ message (STATUS "Can't use Tesseract (details: https://github.com/opencv/opencv_contrib/pull/2220)" )
32
+ return ()
33
+ endif ()
34
+ endif ()
35
+ set (HAVE_TESSERACT 1)
36
+ else ()
37
+ message (STATUS "Tesseract: NO" )
38
+ endif ()
39
+ endif ()
You can’t perform that action at this time.
0 commit comments