-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Description
System Information
For C++ user of OpenCV 4.x, Platform: Windows 10
Detailed description
Hello Dear OpenCV developers!
Could I please ask your advise/knowledge on how to fix the following situation.
After given commit: ae25c31, opencv_video module begun to use opencv_dnn API under #ifdef clause.
However, it seems that Python bindings generator doesn't handle #ifdef clause and tries to generate bindings for newly introduced create(const dnn::Net&...) methods even if we build with -DBUILD_opencv_dnn=OFF
This ends up with following generator warning:
Traceback (most recent call last):
File "C:\apronina\opencv\modules\python\src2\typing_stubs_generator.py", line 49, in wrapped_func
ret_type = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\apronina\opencv\modules\python\src2\typing_stubs_generator.py", line 148, in _generate
generate_typing_stubs(self.cv_root, output_path)
File "C:\apronina\opencv\modules\python\src2\typing_stubs_generation\generation.py", line 90, in generate_typing_stubs
root.resolve_type_nodes()
File "C:\apronina\opencv\modules\python\src2\typing_stubs_generation\nodes\namespace_node.py", line 106, in resolve_type_nodes
raise TypeResolutionError(
typing_stubs_generation.nodes.type_node.TypeResolutionError: Failed to resolve "cv2" namespace against "None". Errors:
['Failed to resolve "cv2.TrackerGOTURN" class against "cv2". Errors: [\'Failed to resolve "cv2.TrackerGOTURN.create" function against "cv2".
Errors: [0]: Failed to resolve "model" argument: Failed to resolve "dnn_Net" exposed as "dnn_Net"\']',
'Failed to resolve "cv2.TrackerDaSiamRPN" class against "cv2". Errors:[\'Failed to resolve "cv2.TrackerDaSiamRPN.create" function against "cv2".
Errors: [0]: Failed to resolve "siam_rpn" argument: Failed to resolve "dnn_Net" exposed as "dnn_Net", [1]: Failed to resolve "kernel_cls1" argument:
Failed to resolve "dnn_Net" exposed as "dnn_Net", [2]: Failed to resolve "kernel_r1" argument: Failed to resolve "dnn_Net" exposed as "dnn_Net"\']',
'Failed to resolve "cv2.TrackerNano" class against "cv2". Errors: [\'Failed to resolve "cv2.TrackerNano.create" function against "cv2".
Errors: [0]: Failed to resolve "backbone" argument: Failed to resolve "dnn_Net" exposed as "dnn_Net", [1]: Failed to resolve "neckhead" argument:
Failed to resolve "dnn_Net" exposed as "dnn_Net"\']', 'Failed to resolve "cv2.TrackerVit" class against "cv2". Errors: [\'Failed to resolve
"cv2.TrackerVit.create" function against "cv2". Errors: [0]: Failed to resolve "model" argument: Failed to resolve "dnn_Net" exposed as "dnn_Net"\']']
Warning log shows that all resolutions failed starting from right these create(const dnn::Net&...) methods, that are tried to be resolved against dnn_Net (instead of dnn::Net, that should be generated with DNN module turned ON, as I understood).
Here is also log of the build error:
C:\apronina\opencv\build\modules\python_bindings_generator\pyopencv_generated_types_content.h(24899,5):
error C2065: 'dnn_Net': undeclared identifier [C:\apronina\opencv\build\modules\python3\opencv_python3.vcxproj]
C:\apronina\opencv\build\modules\python_bindings_generator\pyopencv_generated_types_content.h(24899,13):
error C2146: syntax error: missing ';' before identifier 'siam_rpn' [C:\apronina\opencv\build\modules\python3\opencv_python3.vcxproj]
C:\apronina\opencv\build\modules\python_bindings_generator\pyopencv_generated_types_content.h(24899,13):
error C2065: 'siam_rpn': undeclared identifier [C:\apronina\opencv\build\modules\python3\opencv_python3.vcxproj]
C:\apronina\opencv\build\modules\python_bindings_generator\pyopencv_generated_types_content.h(24901,5):
error C2065: 'dnn_Net': undeclared identifier [C:\apronina\opencv\build\modules\python3\opencv_python3.vcxproj]
Steps to reproduce
cmake -DBUILD_opencv_dnn=OFF <path-to-opencv>
cmake --build . --target instal --config Release
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)