Skip to content

Merge 3.4 #2223

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

Merged
merged 7 commits into from
Aug 13, 2019
Merged
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
2 changes: 1 addition & 1 deletion modules/cudalegacy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif()

set(the_description "CUDA-accelerated Computer Vision (legacy)")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4130 /wd4324 /wd4512 /wd4310 -Wundef -Wmissing-declarations -Wuninitialized -Wshadow)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4130 /wd4324 /wd4512 /wd4310 -Wundef -Wmissing-declarations -Wuninitialized -Wshadow -Wdeprecated-declarations -Wstrict-aliasing -Wtautological-compare)

ocv_define_module(cudalegacy opencv_core opencv_video
OPTIONAL opencv_objdetect opencv_imgproc opencv_calib3d opencv_cudaarithm opencv_cudafilters opencv_cudaimgproc)
2 changes: 1 addition & 1 deletion modules/cudaobjdetect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ endif()

set(the_description "CUDA-accelerated Object Detection")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow -Wstrict-aliasing)

ocv_define_module(cudaobjdetect opencv_objdetect opencv_cudaarithm opencv_cudawarping OPTIONAL opencv_cudalegacy WRAP python)
2 changes: 1 addition & 1 deletion modules/cudaobjdetect/src/cuda/hog.cu
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ namespace cv { namespace cuda { namespace device
compute_confidence_hists_kernel_many_blocks<nthreads, nblocks><<<grid, threads>>>(
img_win_width, img_block_width, win_block_stride_x, win_block_stride_y,
block_hists, coefs, free_coef, threshold, confidences);
cudaSafeCall(cudaThreadSynchronize());
cudaSafeCall(cudaDeviceSynchronize());
}


Expand Down
2 changes: 1 addition & 1 deletion modules/cudaoptflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif()

set(the_description "CUDA-accelerated Optical Flow")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow -Wstrict-aliasing)

ocv_define_module(cudaoptflow opencv_video opencv_optflow opencv_cudaarithm opencv_cudawarping opencv_cudaimgproc OPTIONAL opencv_cudalegacy WRAP python)

Expand Down
1 change: 1 addition & 0 deletions modules/hfs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if(HAVE_CUDA)
add_definitions(-D_HFS_CUDA_ON_)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
endif()

set(the_description "Hierarchical Feature Selection for Efficient Image Segmentation")
Expand Down
32 changes: 14 additions & 18 deletions modules/text/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
set(the_description "Text Detection and Recognition")
ocv_define_module(text opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn OPTIONAL opencv_highgui WRAP python java)
set(__extra_deps "")
if(DEBUG_opencv_text)
list(APPEND __extra_deps PRIVATE_REQUIRED opencv_highgui)
endif()

ocv_define_module(text
opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn
${__extra_deps}
WRAP
python
java
)

if(NOT CMAKE_CROSSCOMPILING OR OPENCV_FIND_TESSERACT)
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
if(NOT Tesseract_FOUND)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindTesseract.cmake") # OpenCV's fallback
endif()
if(Tesseract_FOUND)
if(Tesseract_VERSION)
message(STATUS "Tesseract: YES (ver ${Tesseract_VERSION})")
else()
message(STATUS "Tesseract: YES (ver unknown)")
endif()
set(HAVE_TESSERACT 1)
ocv_include_directories(${Tesseract_INCLUDE_DIRS})
ocv_target_link_libraries(${the_module} ${Tesseract_LIBRARIES})
else()
message(STATUS "Tesseract: NO")
endif()
if(TARGET ocv.3rdparty.tesseract)
ocv_target_link_libraries(${the_module} LINK_PRIVATE ocv.3rdparty.tesseract)
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/text_config.hpp.in
Expand Down
12 changes: 12 additions & 0 deletions modules/text/cmake/checks/tesseract_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#if !defined(USE_STD_NAMESPACE)
#define USE_STD_NAMESPACE
#endif
#include <tesseract/baseapi.h>
#include <tesseract/resultiterator.h>

static void test()
{
tesseract::TessBaseAPI tess;
}

int main() { test(); return 0; }
59 changes: 59 additions & 0 deletions modules/text/cmake/init.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CROSSCOMPILING)
VERIFY HAVE_TESSERACT)

if(NOT HAVE_TESSERACT
AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT)
)
if(NOT Tesseract_FOUND)
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
endif()
if(NOT Tesseract_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/FindTesseract.cmake") # OpenCV's fallback
endif()
if(Tesseract_FOUND)
if(Tesseract_VERSION)
message(STATUS "Tesseract: YES (ver ${Tesseract_VERSION})")
else()
message(STATUS "Tesseract: YES (ver unknown)")
endif()
if(NOT ENABLE_CXX11 AND NOT OPENCV_SKIP_TESSERACT_BUILD_CHECK)
try_compile(__VALID_TESSERACT
"${OpenCV_BINARY_DIR}/cmake_check/tesseract"
"${CMAKE_CURRENT_LIST_DIR}/checks/tesseract_test.cpp"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${Tesseract_INCLUDE_DIRS}"
LINK_LIBRARIES ${Tesseract_LIBRARIES}
OUTPUT_VARIABLE TRY_OUT
)
if(NOT __VALID_TESSERACT)
if(OPENCV_DEBUG_TESSERACT_BUILD)
message(STATUS "${TRY_OUT}")
endif()
message(STATUS "Can't use Tesseract (details: https://github.com/opencv/opencv_contrib/pull/2220)")
return()
endif()
endif()
set(HAVE_TESSERACT 1)
set(HAVE_TESSERACT 1)

# TODO use ocv_add_external_target
set(name "tesseract")
set(inc "${Tesseract_INCLUDE_DIRS}")
set(link "${Tesseract_LIBRARIES}")
set(def "")
if(BUILD_SHARED_LIBS)
set(imp IMPORTED)
endif()
add_library(ocv.3rdparty.${name} INTERFACE ${imp})
set_target_properties(ocv.3rdparty.${name} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${inc}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${inc}"
INTERFACE_LINK_LIBRARIES "${link}"
INTERFACE_COMPILE_DEFINITIONS "${def}")
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ocv.3rdparty.${name} EXPORT OpenCVModules)
endif()

else()
message(STATUS "Tesseract: NO")
endif()
endif()
3 changes: 3 additions & 0 deletions modules/xfeatures2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
set(the_description "Contributed/Experimental Algorithms for Salient 2D Features Detection")

if(HAVE_CUDA)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
endif()
ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_shape opencv_ml opencv_cudaarithm WRAP python java)

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_vgg.cmake)
Expand Down