Skip to content

This commit contains all significant contributions until 23/8/2016 #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 59 additions & 12 deletions modules/text/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,72 @@
set(the_description "Text Detection and Recognition")
ocv_define_module(text opencv_ml opencv_highgui opencv_imgproc opencv_core opencv_features2d WRAP python)
ocv_define_module(text opencv_ml opencv_highgui opencv_imgproc opencv_core opencv_features2d opencv_calib3d WRAP python)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})

find_package(Tesseract)
if(Tesseract_FOUND)
message(STATUS "Tesseract: YES")
set(HAVE_TESSERACT 1)
if(${Tesseract_FOUND})
message(STATUS "Tesseract: YES")
include_directories(${Tesseract_INCLUDE_DIR})
target_link_libraries(opencv_text ${Tesseract_LIBS})
add_definitions(-DHAVE_TESSERACT)
else()
message(STATUS "Tesseract: NO")
message(STATUS "Tesseract: NO")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/text_config.hpp.in
${CMAKE_BINARY_DIR}/text_config.hpp @ONLY)
find_package(Protobuf)
if(Protobuf_FOUND)
message(STATUS "Protobuf: YES")
set(HAVE_PROTOBUF 1)
else()
message(STATUS "Protobuf: NO")
endif()

include_directories(${CMAKE_CURRENT_BINARY_DIR})
find_package(Glog)
if(Glog_FOUND)
message(STATUS "Glog: YES")
set(HAVE_GLOG 1)
else()
message(STATUS "Glog: NO")
endif()

if(${Tesseract_FOUND})
include_directories(${Tesseract_INCLUDE_DIR})
find_package(Caffe)
if(Caffe_FOUND)
message(STATUS "Caffe: YES")
set(HAVE_CAFFE 1)
else()
message(STATUS "Caffe: NO")
endif()

if(${Tesseract_FOUND})
target_link_libraries(opencv_text ${Tesseract_LIBS})

if(HAVE_CAFFE AND HAVE_GLOG AND HAVE_PROTOBUF)
include_directories(${Caffe_INCLUDE_DIR})
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES})
find_package(Boost 1.46 REQUIRED COMPONENTS system thread filesystem)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
include_directories(SYSTEM /usr/local/cuda-7.5/targets/x86_64-linux/include/)
list(APPEND Caffe_LINKER_LIBS ${Boost_LIBRARIES})
target_link_libraries(opencv_text ${Caffe_LIBS} ${Glog_LIBS} ${Protobuf_LIBS} ${HDF5_LIBRARIES} ${Boost_LIBRARIES})
add_definitions(-DHAVE_CAFFE)
endif() #HAVE_CAFFE

message(STATUS "TEXT CAFFE SEARCH")
if()
message(STATUS "TEXT NO CAFFE CONFLICT")
else()
message(STATUS "TEXT CAFFE CONFLICT")
endif()

find_package(Qt5Gui)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be better to use HAVE_QT5 from the main repository. (examples)

if(Qt5Gui_FOUND)
message(STATUS "text module found Qt5Gui: YES")
add_definitions(-DHAVE_QT5GUI)
foreach(dt5_dep Gui)
add_definitions(${Qt5${dt5_dep}_DEFINITIONS})
include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS})
target_link_libraries(opencv_text ${Qt5${dt5_dep}_LIBRARIES})
endforeach()
else()
message(STATUS "text module found Qt5Gui: NO")
endif()
14 changes: 14 additions & 0 deletions modules/text/FindCaffe.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Caffe package for CNN Triplet training
unset(Caffe_FOUND)

find_path(Caffe_INCLUDE_DIR NAMES caffe/caffe.hpp caffe/common.hpp caffe/net.hpp caffe/proto/caffe.pb.h caffe/util/io.hpp caffe/vision_layers.hpp
HINTS
/usr/local/include)

find_library(Caffe_LIBS NAMES caffe
HINTS
/usr/local/lib)

if(Caffe_LIBS AND Caffe_INCLUDE_DIR)
set(Caffe_FOUND 1)
endif()
10 changes: 10 additions & 0 deletions modules/text/FindGlog.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Required for Caffe
unset(Glog_FOUND)

find_library(Glog_LIBS NAMES glog
HINTS
/usr/local/lib)

if(Glog_LIBS)
set(Glog_FOUND 1)
endif()
10 changes: 10 additions & 0 deletions modules/text/FindProtobuf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Protobuf package required for Caffe
unset(Protobuf_FOUND)

find_library(Protobuf_LIBS NAMES protobuf
HINTS
/usr/local/lib)

if(Protobuf_LIBS)
set(Protobuf_FOUND 1)
endif()
Binary file added modules/text/doc/DeepCNN_classdiagram.pdf
Binary file not shown.
Loading