Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Commit 8fedcda

Browse files
committed
Merge branch 'upstream.master' into hunter-3.0.0
2 parents d6b5a2d + eb4bd6b commit 8fedcda

File tree

72 files changed

+6094
-12922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+6094
-12922
lines changed

cmake/OpenCVFindLibsGrfmt.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ else()
99
hunter_add_package(ZLIB)
1010
find_package(ZLIB "${MIN_VER_ZLIB}")
1111
if(ZLIB_FOUND AND ANDROID)
12-
if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so")
12+
if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so" OR
13+
ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib64/libz.so")
1314
set(ZLIB_LIBRARIES z)
1415
endif()
1516
endif()

cmake/OpenCVGenAndroidMK.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ if(ANDROID)
3030
# replace 'opencv_<module>' -> '<module>''
3131
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
3232

33-
34-
# prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there.
35-
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
36-
foreach(mod ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB})
37-
string(REPLACE "tbb" "" OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB}")
38-
endforeach()
39-
4033
if(BUILD_FAT_JAVA_LIB)
4134
set(OPENCV_LIBS_CONFIGMAKE java3)
4235
else()
@@ -52,6 +45,7 @@ if(ANDROID)
5245
set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/3rdparty/lib/\$(OPENCV_TARGET_ARCH_ABI)")
5346

5447
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" @ONLY)
48+
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV-abi.mk.in" "${CMAKE_BINARY_DIR}/OpenCV-${ANDROID_NDK_ABI_NAME}.mk" @ONLY)
5549

5650
# -------------------------------------------------------------------------------------------
5751
# Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
@@ -62,5 +56,7 @@ if(ANDROID)
6256
set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../3rdparty/libs/\$(OPENCV_TARGET_ARCH_ABI)")
6357

6458
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" @ONLY)
59+
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV-abi.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV-${ANDROID_NDK_ABI_NAME}.mk" @ONLY)
6560
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev)
61+
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV-${ANDROID_NDK_ABI_NAME}.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev)
6662
endif(ANDROID)

cmake/OpenCVModule.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,11 @@ macro(ocv_add_module _name)
176176
endif()
177177
endif()
178178

179-
# add HAL as dependency
180-
if(NOT "${the_module}" STREQUAL "opencv_hal")
181-
ocv_add_dependencies(${the_module} opencv_hal)
182-
endif()
183-
184179
# add self to the world dependencies
185180
if((NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD
186181
AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS"
187-
AND NOT OPENCV_PROCESSING_EXTRA_MODULES)
182+
AND NOT OPENCV_PROCESSING_EXTRA_MODULES
183+
AND (NOT BUILD_SHARED_LIBS OR NOT "x${OPENCV_MODULE_TYPE}" STREQUAL "xSTATIC"))
188184
OR OPENCV_MODULE_IS_PART_OF_WORLD
189185
)
190186
set(OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD ON CACHE INTERNAL "")
@@ -662,7 +658,7 @@ macro(ocv_glob_module_sources)
662658
ocv_include_directories(${OPENCL_INCLUDE_DIRS})
663659
add_custom_command(
664660
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp"
665-
COMMAND ${CMAKE_COMMAND} -DMODULE_NAME="${name}" -DCL_DIR="${CMAKE_CURRENT_LIST_DIR}/src/opencl" -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
661+
COMMAND ${CMAKE_COMMAND} "-DMODULE_NAME=${name}" "-DCL_DIR=${CMAKE_CURRENT_LIST_DIR}/src/opencl" "-DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
666662
DEPENDS ${cl_kernels} "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake")
667663
ocv_source_group("Src\\opencl\\kernels" FILES ${cl_kernels})
668664
ocv_source_group("Src\\opencl\\kernels\\autogenerated" FILES "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp")

cmake/OpenCVUtils.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,12 @@ macro(ocv_get_all_libs _modules _extra _3rdparty)
795795
set(${_extra} "")
796796
set(${_3rdparty} "")
797797
foreach(m ${OPENCV_MODULES_PUBLIC})
798-
get_target_property(deps ${m} INTERFACE_LINK_LIBRARIES)
799-
if(NOT deps)
798+
if(TARGET ${m})
799+
get_target_property(deps ${m} INTERFACE_LINK_LIBRARIES)
800+
if(NOT deps)
801+
set(deps "")
802+
endif()
803+
else()
800804
set(deps "")
801805
endif()
802806
list(INSERT ${_modules} 0 ${deps} ${m})
@@ -824,7 +828,7 @@ macro(ocv_get_all_libs _modules _extra _3rdparty)
824828
endif()
825829

826830
# split 3rdparty libs and modules
827-
list(REMOVE_ITEM ${_modules} ${${_3rdparty}} ${${_extra}})
831+
list(REMOVE_ITEM ${_modules} ${${_3rdparty}} ${${_extra}} non_empty_list)
828832

829833
# convert CMake lists to makefile literals
830834
foreach(lst ${_modules} ${_3rdparty} ${_extra})

cmake/cl2cpp.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
if (NOT EXISTS "${CL_DIR}")
2+
message(FATAL_ERROR "Specified wrong OpenCL kernels directory: ${CL_DIR}")
3+
endif()
4+
15
file(GLOB cl_list "${CL_DIR}/*.cl" )
26
list(SORT cl_list)
37

8+
if (NOT cl_list)
9+
message(FATAL_ERROR "Can't find OpenCL kernels in directory: ${CL_DIR}")
10+
endif()
11+
412
string(REPLACE ".cpp" ".hpp" OUTPUT_HPP "${OUTPUT}")
513
get_filename_component(OUTPUT_HPP_NAME "${OUTPUT_HPP}" NAME)
614

cmake/templates/OpenCV-abi.mk.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
2+
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@

cmake/templates/OpenCV.mk.in

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ OPENCV_3RDPARTY_LIBS_DIR:=@OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE@
1919
OPENCV_BASEDIR:=@OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE@
2020
OPENCV_LOCAL_C_INCLUDES:=@OPENCV_INCLUDE_DIRS_CONFIGCMAKE@
2121
OPENCV_MODULES:=@OPENCV_MODULES_CONFIGMAKE@
22+
OPENCV_SUB_MK:=$(call my-dir)/OpenCV-$(TARGET_ARCH_ABI).mk
2223

2324
ifeq ($(OPENCV_LIB_TYPE),)
2425
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
@@ -36,22 +37,7 @@ ifeq ($(OPENCV_LIB_TYPE),SHARED)
3637
OPENCV_3RDPARTY_COMPONENTS:=
3738
OPENCV_EXTRA_COMPONENTS:=
3839
else
39-
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
40-
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
41-
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
42-
endif
43-
ifeq ($(TARGET_ARCH_ABI),x86)
44-
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
45-
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
46-
endif
47-
ifeq ($(TARGET_ARCH_ABI),armeabi)
48-
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB@
49-
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
50-
endif
51-
ifeq ($(TARGET_ARCH_ABI),mips)
52-
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
53-
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
54-
endif
40+
include $(OPENCV_SUB_MK)
5541
endif
5642

5743
ifeq ($(OPENCV_LIB_TYPE),SHARED)

cmake/templates/OpenCVConfig.cmake.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# In your CMakeLists.txt, add these lines:
88
#
99
# find_package(OpenCV REQUIRED)
10-
# include_directories(${OpenCV_INCLUDE_DIRS})
10+
# include_directories(${OpenCV_INCLUDE_DIRS}) # Not needed for CMake >= 2.8.11
1111
# target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})
1212
#
1313
# Or you can search for specific OpenCV modules:
@@ -180,11 +180,15 @@ endif()
180180
if(NOT CMAKE_VERSION VERSION_LESS "2.8.11")
181181
# Target property INTERFACE_INCLUDE_DIRECTORIES available since 2.8.11:
182182
# * http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:INTERFACE_INCLUDE_DIRECTORIES
183-
set_target_properties(
184-
opencv_core
185-
PROPERTIES
186-
INTERFACE_INCLUDE_DIRECTORIES "${OpenCV_INCLUDE_DIRS}"
187-
)
183+
foreach(__component ${OpenCV_LIB_COMPONENTS})
184+
if(TARGET ${__component})
185+
set_target_properties(
186+
${__component}
187+
PROPERTIES
188+
INTERFACE_INCLUDE_DIRECTORIES "${OpenCV_INCLUDE_DIRS}"
189+
)
190+
endif()
191+
endforeach()
188192
endif()
189193

190194
# ==============================================================

data/detect_blob.png

-33.3 KB
Binary file not shown.

doc/pattern_tools/gen_pattern.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""gen_pattern.py
44
Usage example:
55
python gen_pattern.py -o out.svg -r 11 -c 8 -T circles -s 20.0 -R 5.0 -u mm -w 216 -h 279
6-
76
-o, --output - output file (default out.svg)
87
-r, --rows - pattern rows (default 11)
98
-c, --columns - pattern columns (default 8)
@@ -13,6 +12,7 @@
1312
-u, --units - mm, inches, px, m (default mm)
1413
-w, --page_width - page width in units (default 216)
1514
-h, --page_height - page height in units (default 279)
15+
-a, --page_size - page size (default A4), supercedes -h -w arguments
1616
-H, --help - show help
1717
"""
1818

@@ -51,11 +51,13 @@ def makeACirclesPattern(self):
5151

5252
def makeCheckerboardPattern(self):
5353
spacing = self.square_size
54-
for x in range(1,self.cols+1):
55-
for y in range(1,self.rows+1):
54+
xspacing = (self.width - self.cols * self.square_size) / 2.0
55+
yspacing = (self.height - self.rows * self.square_size) / 2.0
56+
for x in range(0,self.cols):
57+
for y in range(0,self.rows):
5658
if x%2 == y%2:
57-
dot = SVG("rect", x=x * spacing, y=y * spacing, width=spacing, height=spacing, stroke_width="0", fill="black")
58-
self.g.append(dot)
59+
square = SVG("rect", x=x * spacing + xspacing, y=y * spacing + yspacing, width=spacing, height=spacing, fill="black")
60+
self.g.append(square)
5961

6062
def save(self):
6163
c = canvas(self.g,width="%d%s"%(self.width,self.units),height="%d%s"%(self.height,self.units),viewBox="0 0 %d %d"%(self.width,self.height))
@@ -65,9 +67,9 @@ def save(self):
6567
def main():
6668
# parse command line options, TODO use argparse for better doc
6769
try:
68-
opts, args = getopt.getopt(sys.argv[1:], "Ho:c:r:T:u:s:R:w:h:", ["help","output=","columns=","rows=",
70+
opts, args = getopt.getopt(sys.argv[1:], "Ho:c:r:T:u:s:R:w:h:a:", ["help","output=","columns=","rows=",
6971
"type=","units=","square_size=","radius_rate=",
70-
"page_width=","page_height="])
72+
"page_width=","page_height=", "page_size="])
7173
except getopt.error, msg:
7274
print msg
7375
print "for help use --help"
@@ -79,8 +81,11 @@ def main():
7981
units = "mm"
8082
square_size = 20.0
8183
radius_rate = 5.0
82-
page_width = 216 #8.5 inches
83-
page_height = 279 #11 inches
84+
page_size = "A4"
85+
# page size dict (ISO standard, mm) for easy lookup. format - size: [width, height]
86+
page_sizes = {"A0": [840, 1188], "A1": [594, 840], "A2": [420, 594], "A3": [297, 420], "A4": [210, 297], "A5": [148, 210]}
87+
page_width = page_sizes[page_size.upper()][0]
88+
page_height = page_sizes[page_size.upper()][1]
8489
# process options
8590
for o, a in opts:
8691
if o in ("-H", "--help"):
@@ -104,6 +109,11 @@ def main():
104109
page_width = float(a)
105110
elif o in ("-h", "--page_height"):
106111
page_height = float(a)
112+
elif o in ("-a", "--page_size"):
113+
units = "mm"
114+
page_size = a.upper()
115+
page_width = page_sizes[page_size][0]
116+
page_height = page_sizes[page_size][1]
107117
pm = PatternMaker(columns,rows,output,units,square_size,radius_rate,page_width,page_height)
108118
#dict for easy lookup of pattern type
109119
mp = {"circles":pm.makeCirclesPattern,"acircles":pm.makeACirclesPattern,"checkerboard":pm.makeCheckerboardPattern}

0 commit comments

Comments
 (0)