mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
87d4970e8b
@ -1247,12 +1247,17 @@ status("")
|
||||
status(" GUI: " "${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
|
||||
|
||||
if(WITH_QT OR HAVE_QT)
|
||||
if(HAVE_QT5)
|
||||
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
|
||||
elseif(HAVE_QT)
|
||||
if(HAVE_QT)
|
||||
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
|
||||
if(HAVE_QT_OPENGL)
|
||||
if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
|
||||
else()
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
|
||||
endif()
|
||||
else()
|
||||
status(" QT OpenGL support:" "NO")
|
||||
endif()
|
||||
else()
|
||||
status(" QT:" "NO")
|
||||
endif()
|
||||
|
@ -44,32 +44,15 @@ if(VTK_VERSION VERSION_LESS "5.8.0")
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT5 AND VTK_VERSION VERSION_LESS "6.0.0")
|
||||
if(VTK_USE_QT)
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with
|
||||
if(HAVE_QT5 AND VTK_VERSION VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK)
|
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4")
|
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake")
|
||||
if((HAVE_QT AND VTK_USE_QT)
|
||||
AND NOT DEFINED FORCE_VTK # deprecated
|
||||
AND NOT DEFINED OPENCV_FORCE_VTK
|
||||
)
|
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt, and VTK ver.${VTK_VERSION} with Qt")
|
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DOPENCV_FORCE_VTK=TRUE' flag in CMake")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT AND VTK_VERSION VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "")
|
||||
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
try_compile(VTK_COMPILE_STATUS
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vtk_test.cpp"
|
||||
|
@ -4,23 +4,50 @@
|
||||
|
||||
# --- QT4/5 ---
|
||||
ocv_clear_vars(HAVE_QT HAVE_QT5)
|
||||
if(WITH_QT)
|
||||
if(NOT WITH_QT EQUAL 4)
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets Test Concurrent REQUIRED NO_MODULE)
|
||||
if(Qt5_FOUND)
|
||||
set(HAVE_QT5 ON)
|
||||
set(HAVE_QT ON)
|
||||
find_package(Qt5 COMPONENTS OpenGL QUIET)
|
||||
if(Qt5OpenGL_FOUND)
|
||||
set(QT_QTOPENGL_FOUND ON)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT)
|
||||
find_package(Qt4 REQUIRED QtCore QtGui QtTest)
|
||||
macro(ocv_find_package_Qt4)
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtTest ${ARGN})
|
||||
if(QT4_FOUND)
|
||||
set(HAVE_QT TRUE)
|
||||
set(QT_FOUND 1)
|
||||
ocv_assert(QT_VERSION_MAJOR EQUAL 4)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_find_package_Qt OCV_QT_VER)
|
||||
find_package(Qt${OCV_QT_VER} COMPONENTS Core Gui Widgets Test Concurrent ${ARGN} NO_MODULE)
|
||||
if(Qt${OCV_QT_VER}_FOUND)
|
||||
set(QT_FOUND 1)
|
||||
set(QT_VERSION "${Qt${OCV_QT_VER}_VERSION}")
|
||||
set(QT_VERSION_MAJOR "${Qt${OCV_QT_VER}_VERSION_MAJOR}")
|
||||
set(QT_VERSION_MINOR "${Qt${OCV_QT_VER}_VERSION_MINOR}")
|
||||
set(QT_VERSION_PATCH "${Qt${OCV_QT_VER}_VERSION_PATCH}")
|
||||
set(QT_VERSION_TWEAK "${Qt${OCV_QT_VER}_VERSION_TWEAK}")
|
||||
set(QT_VERSION_COUNT "${Qt${OCV_QT_VER}_VERSION_COUNT}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(WITH_QT)
|
||||
if(NOT WITH_QT GREATER 0)
|
||||
# BUG: Qt5Config.cmake script can't handle components properly: find_package(QT NAMES Qt6 Qt5 REQUIRED NO_MODULE COMPONENTS Core Gui Widgets Test Concurrent)
|
||||
ocv_find_package_Qt(6 QUIET)
|
||||
if(NOT QT_FOUND)
|
||||
ocv_find_package_Qt(5 QUIET)
|
||||
endif()
|
||||
if(NOT QT_FOUND)
|
||||
ocv_find_package_Qt4(QUIET)
|
||||
endif()
|
||||
elseif(WITH_QT EQUAL 4)
|
||||
ocv_find_package_Qt4(REQUIRED)
|
||||
else() # WITH_QT=<major version>
|
||||
ocv_find_package_Qt("${WITH_QT}" REQUIRED)
|
||||
endif()
|
||||
if(QT_FOUND)
|
||||
set(HAVE_QT ON)
|
||||
if(QT_VERSION_MAJOR GREATER 4)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL QUIET)
|
||||
if(Qt${QT_VERSION_MAJOR}OpenGL_FOUND)
|
||||
set(QT_QTOPENGL_FOUND ON) # HAVE_QT_OPENGL is defined below
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -580,6 +580,11 @@ void ThreadPool::run(const Range& range, const ParallelLoopBody& body, double ns
|
||||
{
|
||||
WorkerThread& thread = *(threads[i].get());
|
||||
if (
|
||||
#if defined(__clang__) && defined(__has_feature)
|
||||
#if __has_feature(thread_sanitizer)
|
||||
1 || // Robust workaround to avoid data race warning of `thread.job`
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(CV_USE_GLOBAL_WORKERS_COND_VAR)
|
||||
thread.isActive ||
|
||||
#endif
|
||||
|
@ -49,40 +49,43 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n
|
||||
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "")
|
||||
|
||||
if(HAVE_QT5)
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "QT5")
|
||||
add_definitions(-DHAVE_QT)
|
||||
|
||||
# "Automoc" doesn't work properly with opencv_world build, use QT5_WRAP_CPP() directly
|
||||
if(HAVE_QT)
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "QT${QT_VERSION_MAJOR}")
|
||||
if(QT_VERSION_MAJOR GREATER 4)
|
||||
# "Automoc" doesn't work properly with opencv_world build, use QT<ver>_WRAP_CPP() directly
|
||||
#set(CMAKE_AUTOMOC ON)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
QT6_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||
QT6_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
||||
elseif(QT_VERSION_MAJOR EQUAL 5)
|
||||
QT5_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||
QT5_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsuported QT version: ${QT_VERSION_MAJOR}")
|
||||
endif()
|
||||
|
||||
list(APPEND highgui_srcs
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h
|
||||
${_MOC_OUTFILES}
|
||||
${_RCC_OUTFILES})
|
||||
|
||||
foreach(dt5_dep Core Gui Widgets Test Concurrent)
|
||||
add_definitions(${Qt5${dt5_dep}_DEFINITIONS})
|
||||
include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS})
|
||||
list(APPEND HIGHGUI_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES})
|
||||
endforeach()
|
||||
|
||||
set(qt_deps Core Gui Widgets Test Concurrent)
|
||||
if(HAVE_QT_OPENGL)
|
||||
add_definitions(-DHAVE_QT_OPENGL)
|
||||
add_definitions(${Qt5OpenGL_DEFINITIONS})
|
||||
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
|
||||
list(APPEND HIGHGUI_LIBRARIES ${Qt5OpenGL_LIBRARIES})
|
||||
list(APPEND qt_deps OpenGL)
|
||||
endif()
|
||||
elseif(HAVE_QT)
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "QT4")
|
||||
add_definitions(-DHAVE_QT)
|
||||
|
||||
foreach(dt_dep ${qt_deps})
|
||||
add_definitions(${Qt${QT_VERSION_MAJOR}${dt_dep}_DEFINITIONS})
|
||||
include_directories(${Qt${QT_VERSION_MAJOR}${dt_dep}_INCLUDE_DIRS})
|
||||
list(APPEND HIGHGUI_LIBRARIES ${Qt${QT_VERSION_MAJOR}${dt_dep}_LIBRARIES})
|
||||
endforeach()
|
||||
else()
|
||||
ocv_assert(QT_VERSION_MAJOR EQUAL 4)
|
||||
if (HAVE_QT_OPENGL)
|
||||
add_definitions(-DHAVE_QT_OPENGL)
|
||||
set(QT_USE_QTOPENGL TRUE)
|
||||
endif()
|
||||
include(${QT_USE_FILE})
|
||||
@ -96,6 +99,7 @@ elseif(HAVE_QT)
|
||||
if(${_have_flag})
|
||||
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
|
||||
endif()
|
||||
endif()
|
||||
elseif(WINRT)
|
||||
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "WINRT")
|
||||
if(NOT WINRT_8_0)
|
||||
|
@ -65,6 +65,38 @@
|
||||
|
||||
using namespace cv;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#define Qt_MiddleButton Qt::MiddleButton
|
||||
inline Qt::Orientation wheelEventOrientation(QWheelEvent *we) {
|
||||
if (std::abs(we->angleDelta().x()) < std::abs(we->angleDelta().y()))
|
||||
return Qt::Vertical;
|
||||
else
|
||||
return Qt::Horizontal;
|
||||
}
|
||||
inline int wheelEventDelta(QWheelEvent *we) {
|
||||
if(wheelEventOrientation(we) == Qt::Vertical)
|
||||
return we->angleDelta().y();
|
||||
else
|
||||
return we->angleDelta().x();
|
||||
}
|
||||
inline QPoint wheelEventPos(QWheelEvent *we) {
|
||||
return we->position().toPoint();
|
||||
}
|
||||
#else
|
||||
#define Qt_MiddleButton Qt::MidButton
|
||||
inline Qt::Orientation wheelEventOrientation(QWheelEvent *we) {
|
||||
return we->orientation();
|
||||
}
|
||||
inline int wheelEventDelta(QWheelEvent *we) {
|
||||
return we->delta();
|
||||
}
|
||||
inline QPoint wheelEventPos(QWheelEvent *we) {
|
||||
return we->pos();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//Static and global first
|
||||
static GuiReceiver *guiMainThread = NULL;
|
||||
static int parameterSystemC = 1;
|
||||
@ -1580,7 +1612,9 @@ CvWinProperties::CvWinProperties(QString name_paraWindow, QObject* /*parent*/)
|
||||
myLayout->setObjectName(QString::fromUtf8("boxLayout"));
|
||||
myLayout->setContentsMargins(0, 0, 0, 0);
|
||||
myLayout->setSpacing(0);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
myLayout->setMargin(0);
|
||||
#endif
|
||||
myLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
setLayout(myLayout);
|
||||
|
||||
@ -1958,7 +1992,9 @@ void CvWindow::createBarLayout()
|
||||
myBarLayout->setObjectName(QString::fromUtf8("barLayout"));
|
||||
myBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||
myBarLayout->setSpacing(0);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
myBarLayout->setMargin(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1968,7 +2004,9 @@ void CvWindow::createGlobalLayout()
|
||||
myGlobalLayout->setObjectName(QString::fromUtf8("boxLayout"));
|
||||
myGlobalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
myGlobalLayout->setSpacing(0);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
myGlobalLayout->setMargin(0);
|
||||
#endif
|
||||
setMinimumSize(1, 1);
|
||||
|
||||
if (param_flags == CV_WINDOW_AUTOSIZE)
|
||||
@ -2206,7 +2244,7 @@ void CvWindow::icvLoadControlPanel()
|
||||
}
|
||||
if (t->type == type_CvButtonbar)
|
||||
{
|
||||
int subsize = settings.beginReadArray(QString("buttonbar")+i);
|
||||
int subsize = settings.beginReadArray(QString("buttonbar%1").arg(i));
|
||||
|
||||
if ( subsize == ((CvButtonbar*)t)->layout()->count() )
|
||||
icvLoadButtonbar((CvButtonbar*)t,&settings);
|
||||
@ -2237,7 +2275,7 @@ void CvWindow::icvSaveControlPanel()
|
||||
}
|
||||
if (t->type == type_CvButtonbar)
|
||||
{
|
||||
settings.beginWriteArray(QString("buttonbar")+i);
|
||||
settings.beginWriteArray(QString("buttonbar%1").arg(i));
|
||||
icvSaveButtonbar((CvButtonbar*)t,&settings);
|
||||
settings.endArray();
|
||||
}
|
||||
@ -2397,14 +2435,14 @@ void OCVViewPort::icvmouseHandler(QMouseEvent* evnt, type_mouse_event category,
|
||||
flags |= CV_EVENT_FLAG_LBUTTON;
|
||||
if(buttons & Qt::RightButton)
|
||||
flags |= CV_EVENT_FLAG_RBUTTON;
|
||||
if(buttons & Qt::MidButton)
|
||||
if(buttons & Qt_MiddleButton)
|
||||
flags |= CV_EVENT_FLAG_MBUTTON;
|
||||
|
||||
if (cv_event == -1) {
|
||||
if (category == mouse_wheel) {
|
||||
QWheelEvent *we = (QWheelEvent *) evnt;
|
||||
cv_event = ((we->orientation() == Qt::Vertical) ? CV_EVENT_MOUSEWHEEL : CV_EVENT_MOUSEHWHEEL);
|
||||
flags |= (we->delta() & 0xffff)<<16;
|
||||
cv_event = ((wheelEventOrientation(we) == Qt::Vertical) ? CV_EVENT_MOUSEWHEEL : CV_EVENT_MOUSEHWHEEL);
|
||||
flags |= (wheelEventDelta(we) & 0xffff)<<16;
|
||||
return;
|
||||
}
|
||||
switch(evnt->button())
|
||||
@ -2417,7 +2455,7 @@ void OCVViewPort::icvmouseHandler(QMouseEvent* evnt, type_mouse_event category,
|
||||
cv_event = tableMouseButtons[category][1];
|
||||
flags |= CV_EVENT_FLAG_RBUTTON;
|
||||
break;
|
||||
case Qt::MidButton:
|
||||
case Qt_MiddleButton:
|
||||
cv_event = tableMouseButtons[category][2];
|
||||
flags |= CV_EVENT_FLAG_MBUTTON;
|
||||
break;
|
||||
@ -2772,7 +2810,7 @@ void DefaultViewPort::wheelEvent(QWheelEvent* evnt)
|
||||
{
|
||||
icvmouseEvent((QMouseEvent *)evnt, mouse_wheel);
|
||||
|
||||
scaleView(evnt->delta() / 240.0, evnt->pos());
|
||||
scaleView(wheelEventDelta(evnt) / 240.0, wheelEventPos(evnt));
|
||||
viewport()->update();
|
||||
|
||||
QWidget::wheelEvent(evnt);
|
||||
|
@ -60,6 +60,7 @@ add_custom_command(
|
||||
${JS_SOURCE_DIR}/src/core_bindings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/embindgen.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/templates.py
|
||||
"${OPENCV_JS_WHITELIST_FILE}"
|
||||
${scripts_hdr_parser}
|
||||
#(not needed - generated by CMake) ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
|
||||
${opencv_hdrs}
|
||||
|
@ -104,6 +104,10 @@ def makeWhiteList(module_list):
|
||||
return wl
|
||||
|
||||
white_list = None
|
||||
namespace_prefix_override = {
|
||||
'dnn' : '',
|
||||
'aruco' : '',
|
||||
}
|
||||
|
||||
# Features to be exported
|
||||
export_enums = False
|
||||
@ -271,6 +275,8 @@ class FuncVariant(object):
|
||||
|
||||
class FuncInfo(object):
|
||||
def __init__(self, class_name, name, cname, namespace, isconstructor):
|
||||
self.name_id = '_'.join([namespace] + ([class_name] if class_name else []) + [name]) # unique id for dict key
|
||||
|
||||
self.class_name = class_name
|
||||
self.name = name
|
||||
self.cname = cname
|
||||
@ -295,9 +301,9 @@ class JSWrapperGenerator(object):
|
||||
self.bindings = []
|
||||
self.wrapper_funcs = []
|
||||
|
||||
self.classes = {}
|
||||
self.classes = {} # FIXIT 'classes' should belong to 'namespaces'
|
||||
self.namespaces = {}
|
||||
self.enums = {}
|
||||
self.enums = {} # FIXIT 'enums' should belong to 'namespaces'
|
||||
|
||||
self.parser = hdr_parser.CppHeaderParser()
|
||||
self.class_idx = 0
|
||||
@ -419,7 +425,8 @@ class JSWrapperGenerator(object):
|
||||
else:
|
||||
func_map = self.namespaces.setdefault(namespace, Namespace()).funcs
|
||||
|
||||
func = func_map.setdefault(name, FuncInfo(class_name, name, cpp_name, namespace, is_constructor))
|
||||
fi = FuncInfo(class_name, name, cpp_name, namespace, is_constructor)
|
||||
func = func_map.setdefault(fi.name_id, fi)
|
||||
|
||||
variant = FuncVariant(class_name, name, decl, is_constructor, is_class_method, is_const_method,
|
||||
is_virtual_method, is_pure_virtual_method, ref_return, const_return)
|
||||
@ -430,7 +437,7 @@ class JSWrapperGenerator(object):
|
||||
f.write(buf.getvalue())
|
||||
f.close()
|
||||
|
||||
def gen_function_binding_with_wrapper(self, func, class_info):
|
||||
def gen_function_binding_with_wrapper(self, func, ns_name, class_info):
|
||||
|
||||
binding_text = None
|
||||
wrapper_func_text = None
|
||||
@ -488,7 +495,22 @@ class JSWrapperGenerator(object):
|
||||
|
||||
|
||||
# Wrapper function
|
||||
wrap_func_name = (func.class_name+"_" if class_info != None else "") + func.name.split("::")[-1] + "_wrapper"
|
||||
if ns_name != None and ns_name != "cv":
|
||||
ns_parts = ns_name.split(".")
|
||||
if ns_parts[0] == "cv":
|
||||
ns_parts = ns_parts[1:]
|
||||
ns_part = "_".join(ns_parts) + "_"
|
||||
ns_id = '_'.join(ns_parts)
|
||||
ns_prefix = namespace_prefix_override.get(ns_id, ns_id)
|
||||
if ns_prefix:
|
||||
ns_prefix = ns_prefix + '_'
|
||||
else:
|
||||
ns_prefix = ''
|
||||
if class_info == None:
|
||||
js_func_name = ns_prefix + func.name
|
||||
wrap_func_name = js_func_name + "_wrapper"
|
||||
else:
|
||||
wrap_func_name = ns_prefix + func.class_name + "_" + func.name + "_wrapper"
|
||||
js_func_name = func.name
|
||||
|
||||
# TODO: Name functions based wrap directives or based on arguments list
|
||||
@ -740,12 +762,22 @@ class JSWrapperGenerator(object):
|
||||
# step 2: generate bindings
|
||||
# Global functions
|
||||
for ns_name, ns in sorted(self.namespaces.items()):
|
||||
if ns_name.split('.')[0] != 'cv':
|
||||
ns_parts = ns_name.split('.')
|
||||
if ns_parts[0] != 'cv':
|
||||
print('Ignore namespace: {}'.format(ns_name))
|
||||
continue
|
||||
for name, func in sorted(ns.funcs.items()):
|
||||
else:
|
||||
ns_parts = ns_parts[1:]
|
||||
ns_id = '_'.join(ns_parts)
|
||||
ns_prefix = namespace_prefix_override.get(ns_id, ns_id)
|
||||
for name_id, func in sorted(ns.funcs.items()):
|
||||
name = func.name
|
||||
if ns_prefix:
|
||||
name = ns_prefix + '_' + name
|
||||
if name in ignore_list:
|
||||
continue
|
||||
if not name in white_list['']:
|
||||
#print('Not in whitelist: "{}" from ns={}'.format(name, ns_name))
|
||||
continue
|
||||
|
||||
ext_cnst = False
|
||||
@ -769,7 +801,7 @@ class JSWrapperGenerator(object):
|
||||
continue
|
||||
|
||||
if with_wrapped_functions:
|
||||
binding, wrapper = self.gen_function_binding_with_wrapper(func, class_info=None)
|
||||
binding, wrapper = self.gen_function_binding_with_wrapper(func, ns_name, class_info=None)
|
||||
self.bindings += binding
|
||||
self.wrapper_funcs += wrapper
|
||||
else:
|
||||
@ -802,7 +834,7 @@ class JSWrapperGenerator(object):
|
||||
class_bindings.append(constructor_template.substitute(signature=', '.join(args)))
|
||||
else:
|
||||
if with_wrapped_functions and (len(method.variants) > 1 or len(method.variants[0].args)>0 or "String" in method.variants[0].rettype):
|
||||
binding, wrapper = self.gen_function_binding_with_wrapper(method, class_info=class_info)
|
||||
binding, wrapper = self.gen_function_binding_with_wrapper(method, None, class_info=class_info)
|
||||
self.wrapper_funcs = self.wrapper_funcs + wrapper
|
||||
class_bindings = class_bindings + binding
|
||||
else:
|
||||
|
@ -13,18 +13,86 @@ core = {
|
||||
'Algorithm': [],
|
||||
}
|
||||
|
||||
imgproc = {'': ['Canny', 'GaussianBlur', 'Laplacian', 'HoughLines', 'HoughLinesP', 'HoughCircles', 'Scharr','Sobel', \
|
||||
'adaptiveThreshold','approxPolyDP','arcLength','bilateralFilter','blur','boundingRect','boxFilter',\
|
||||
'calcBackProject','calcHist','circle','compareHist','connectedComponents','connectedComponentsWithStats', \
|
||||
'contourArea', 'convexHull', 'convexityDefects', 'cornerHarris','cornerMinEigenVal','createCLAHE', \
|
||||
'createLineSegmentDetector','cvtColor','demosaicing','dilate', 'distanceTransform','distanceTransformWithLabels', \
|
||||
'drawContours','ellipse','ellipse2Poly','equalizeHist','erode', 'filter2D', 'findContours','fitEllipse', \
|
||||
'fitLine', 'floodFill','getAffineTransform', 'getPerspectiveTransform', 'getRotationMatrix2D', 'getStructuringElement', \
|
||||
'goodFeaturesToTrack','grabCut','initUndistortRectifyMap', 'integral','integral2', 'isContourConvex', 'line', \
|
||||
'matchShapes', 'matchTemplate','medianBlur', 'minAreaRect', 'minEnclosingCircle', 'moments', 'morphologyEx', \
|
||||
'pointPolygonTest', 'putText','pyrDown','pyrUp','rectangle','remap', 'resize','sepFilter2D','threshold', \
|
||||
'undistort','warpAffine','warpPerspective','warpPolar','watershed', \
|
||||
'fillPoly', 'fillConvexPoly', 'polylines',
|
||||
imgproc = {
|
||||
'': [
|
||||
'Canny',
|
||||
'GaussianBlur',
|
||||
'Laplacian',
|
||||
'HoughLines',
|
||||
'HoughLinesP',
|
||||
'HoughCircles',
|
||||
'Scharr',
|
||||
'Sobel',
|
||||
'adaptiveThreshold',
|
||||
'approxPolyDP',
|
||||
'arcLength',
|
||||
'bilateralFilter',
|
||||
'blur',
|
||||
'boundingRect',
|
||||
'boxFilter',
|
||||
'calcBackProject',
|
||||
'calcHist',
|
||||
'circle',
|
||||
'compareHist',
|
||||
'connectedComponents',
|
||||
'connectedComponentsWithStats',
|
||||
'contourArea',
|
||||
'convexHull',
|
||||
'convexityDefects',
|
||||
'cornerHarris',
|
||||
'cornerMinEigenVal',
|
||||
'createCLAHE',
|
||||
'createLineSegmentDetector',
|
||||
'cvtColor',
|
||||
'demosaicing',
|
||||
'dilate',
|
||||
'distanceTransform',
|
||||
'distanceTransformWithLabels',
|
||||
'drawContours',
|
||||
'ellipse',
|
||||
'ellipse2Poly',
|
||||
'equalizeHist',
|
||||
'erode',
|
||||
'filter2D',
|
||||
'findContours',
|
||||
'fitEllipse',
|
||||
'fitLine',
|
||||
'floodFill',
|
||||
'getAffineTransform',
|
||||
'getPerspectiveTransform',
|
||||
'getRotationMatrix2D',
|
||||
'getStructuringElement',
|
||||
'goodFeaturesToTrack',
|
||||
'grabCut',
|
||||
#'initUndistortRectifyMap', # 4.x: moved to calib3d
|
||||
'integral',
|
||||
'integral2',
|
||||
'isContourConvex',
|
||||
'line',
|
||||
'matchShapes',
|
||||
'matchTemplate',
|
||||
'medianBlur',
|
||||
'minAreaRect',
|
||||
'minEnclosingCircle',
|
||||
'moments',
|
||||
'morphologyEx',
|
||||
'pointPolygonTest',
|
||||
'putText',
|
||||
'pyrDown',
|
||||
'pyrUp',
|
||||
'rectangle',
|
||||
'remap',
|
||||
'resize',
|
||||
'sepFilter2D',
|
||||
'threshold',
|
||||
#'undistort', # 4.x: moved to calib3d
|
||||
'warpAffine',
|
||||
'warpPerspective',
|
||||
'warpPolar',
|
||||
'watershed',
|
||||
'fillPoly',
|
||||
'fillConvexPoly',
|
||||
'polylines',
|
||||
],
|
||||
'CLAHE': ['apply', 'collectGarbage', 'getClipLimit', 'getTilesGridSize', 'setClipLimit', 'setTilesGridSize'],
|
||||
'segmentation_IntelligentScissorsMB': [
|
||||
@ -97,9 +165,28 @@ aruco = {'': ['detectMarkers', 'drawDetectedMarkers', 'drawAxis', 'estimatePoseS
|
||||
'aruco_DetectorParameters': ['create']
|
||||
}
|
||||
|
||||
calib3d = {'': ['findHomography', 'calibrateCameraExtended', 'drawFrameAxes', 'estimateAffine2D', \
|
||||
'getDefaultNewCameraMatrix', 'initUndistortRectifyMap', 'Rodrigues', \
|
||||
'solvePnP', 'solvePnPRansac', 'solvePnPRefineLM']}
|
||||
calib3d = {
|
||||
'': [
|
||||
'findHomography',
|
||||
'calibrateCameraExtended',
|
||||
'drawFrameAxes',
|
||||
'estimateAffine2D',
|
||||
'getDefaultNewCameraMatrix',
|
||||
'initUndistortRectifyMap',
|
||||
'Rodrigues',
|
||||
'solvePnP',
|
||||
'solvePnPRansac',
|
||||
'solvePnPRefineLM',
|
||||
'projectPoints',
|
||||
'undistort',
|
||||
|
||||
# cv::fisheye namespace
|
||||
'fisheye_initUndistortRectifyMap',
|
||||
'fisheye_projectPoints',
|
||||
],
|
||||
}
|
||||
|
||||
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, aruco, calib3d])
|
||||
|
||||
# namespace_prefix_override['dnn'] = '' # compatibility stuff (enabled by default)
|
||||
# namespace_prefix_override['aruco'] = '' # compatibility stuff (enabled by default)
|
||||
|
Loading…
Reference in New Issue
Block a user