Commit Graph

463 Commits

Author SHA1 Message Date
Alexander Alekhin
dd7f88bd68 python: support standalone Python bindings build
- requires OpenCV source directory
- requires OpenCV binary directory with built modules and 'python_bindings_generator' target
2018-06-07 15:16:39 +03:00
Alexander Alekhin
dcb9bc2544 python: eliminate pylint warnings
Tested with:
- pylint 1.9.1
2018-06-04 17:58:06 +03:00
Alexander Alekhin
c2d40b465d python: fix arg types of cv2_UMatWrapperObject functions 2018-05-30 18:07:03 +03:00
Alexander Alekhin
1207300e01 python: avoid direct cast PyCFunctionWithKeywords->PyCFunction 2018-05-30 17:24:43 +03:00
Dmitry Kurtaev
d5b9563263 Custom deep learning layers in Python 2018-04-26 09:25:18 +03:00
Alexander Alekhin
21026bf7cd python: fix support of UI callbacks 2018-04-19 18:42:01 +03:00
Alexander Alekhin
47e476c9cd Merge pull request #11217 from dan-masek:fix_issue_11206 2018-04-08 15:12:12 +00:00
Alexander Alekhin
d294e9d62a Merge pull request #11216 from dan-masek:fix_issue_11205 2018-04-04 15:37:57 +00:00
Dan Mašek
8c1d8eccdd Merge pull request #11207 from dan-masek:add_redirect_error
* Add Python support for error message handlers.

* Move the static variable to the only function that uses it.

* Remove the optional param (user data), since this can already be handled by closures.

* Correct the help string.

* python: added redirectError test
2018-04-03 21:16:34 +03:00
Dan Mašek
f6e299b58b Fix #11206 2018-04-03 03:24:49 +02:00
Dan Mašek
eae3ed0c08 Fix a leak described in issue #11205 2018-04-03 03:02:21 +02:00
Alexander Alekhin
25be4186bc python: apply CV_OVERRIDE/CV_FINAL 2018-03-28 18:43:28 +03:00
Alexander Alekhin
08941b7890 cmake: avoid amending of CMAKE_COMPILER_IS_[GNUCXX|CLANGCXX|CCACHE] vars
- Recommended compiler checks:
  - GCC: CV_GCC
  - Clang: CV_CLANG
- fixed problem with CMAKE_CXX_COMPILER_ID=Clang/AppleClang mess on MacOSX
  Details: cmake --help-policy CMP0025
- do not declare Clang as GCC compiler
2018-03-27 16:16:59 +03:00
Andrei Costinescu
38d73123c1
#include <math.h> in cv2.cpp
My build fails with the error:
"C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/cmath:1136:11: error: '::hypot' has not been declared".
I have tried to fix it by adding "#include <cmath>" before the line "#include <Python.h>" but then the build has failed with the error:
"C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/math.h:91:12:: error: 'std::_hypot' has not been declared".
Adding "#include <math.h>" allowed me to build opencv.
2018-03-25 20:39:29 +02:00
luz.paz
d05714995c Misc. modules/ cont. pt2
Found via `codespell`
2018-02-13 11:28:11 -05:00
Alexander Alekhin
e2a99d24ec Merge pull request #10813 from alalek:cmake_cxx_flags 2018-02-10 12:27:00 +00:00
Alexander Alekhin
84887d3011 cmake: use -isystem for Python/numpy include directories 2018-02-09 17:10:02 +03:00
Alexander Alekhin
9e298ea1bb build: eliminate c++17 Python build warning 2018-02-09 17:09:36 +03:00
Alexander Alekhin
01f4a173ab opencv_version: dump OpenCL information via opencv_version
fix missing "opencv2/core/opencl" headers from core module (updated install list)
2018-01-27 17:08:28 +00:00
Pavel Rojtberg
2d674fc151 persistence: replace arbitrary limit of cn to 4 by CV_CN_MAX (#10636)
* persistence: replace arbitrary limit of cn to 4 by CV_CN_MAX

* python: added persistence test, remove temp files

* fixup! python: added persistence test, remove temp files

* fixup! python: added persistence test, remove temp files
2018-01-23 13:36:30 +03:00
Alexander Alekhin
59c6661db0 cmake: eliminate ninja generator warning (CMake 3.10), refactor code 2018-01-05 04:42:24 +00:00
Alexander Alekhin
ea5a3e557f python: filter modules headers (from <module>/include directory) 2018-01-01 15:56:14 +00:00
Alexander Alekhin
361bb1197f cmake: fix opencv_world build with contrib 2017-12-15 21:36:22 +00:00
Vitaly Tuzov
51cb56ef2c Implementation of bit-exact resize. Internal calls to linear resize updated to use bit-exact version. (#9468) 2017-12-13 15:00:38 +03:00
Alexander Alekhin
5404930112 Merge pull request #9260 from Cartucho:add_python_signatures 2017-12-12 08:58:14 +00:00
Alexander Alekhin
5560db73bf python: 'cv2.' -> 'cv.' via 'import cv2 as cv' 2017-12-11 13:46:55 +03:00
Alexander Alekhin
768f4cb7bc python: 'sub-module' for binding sources and documentation meta information 2017-12-09 21:01:46 +00:00
Pavel Rojtberg
6fb9d42c3f Hid symbols in static builds, added LTO flags, removed exports from ts 2017-12-07 10:26:48 +03:00
Vadim Pisarevsky
b900496c40 Merge pull request #10152 from alalek:py_fix_isalgorithm 2017-11-28 10:46:41 +00:00
Pavel Rojtberg
3c795a0dab add test_algorithm_rw using AKAZE 2017-11-27 17:04:56 +01:00
Alexander Alekhin
cbf2b51e40 bindings(py): fix handling of 'isalgorithm' 2017-11-24 09:54:44 +03:00
Alexander Alekhin
019de554a0 python(test): don't write bytecode
Tests are usually lauched from source directory, so additional unnecessary
files should be eliminated.

Alternative ways (command line):
- python -B ...
- PYTHONDONTWRITEBYTECODE=1 python ...
2017-11-23 13:13:11 +03:00
Alexander Alekhin
3ee8079f35 python(test): add tests filter
Usage example (bash):
$ OPENCV_PYTEST_FILTER=test_digits python test.py -v
2017-11-23 12:16:59 +03:00
Alexander Alekhin
aa70199ce1 build: avoid exporting of unnecessary symbols from Python bindings 2017-11-15 13:21:35 +03:00
Cartucho
7267e94be7 Merge pull request #9736 from Cartucho/const_and_class_to_json
* Adding constants to json file

* adding sub-module to constants name

* adding namespace to functions

* adding namespace to classes

* remove namespace from methods

* static methods

* python signatures generation

* python: more fixes for signatures generation

Python names existence can be checked via command:

    python -c "import cv2 as cv; print(repr(<py_name>))"
2017-11-04 06:38:18 +03:00
Vadim Pisarevsky
58a83e99c0 Merge pull request #9839 from terfendail:features/python_wrapper/surface_matching_cleanup 2017-10-27 11:22:10 +00:00
Vitaly Tuzov
868ad16041 Python wrappers for Vec and Matx 2017-10-23 18:50:49 +03:00
Igor Wodiany
e2499e5b2f
Move vector_size_t and vector_vector_Mat
These two typdefs are not compiled when BUILD_opencv_dnn is set to
false, however there are other modules that uses these typedef so
it may cause build errors. Moving typedef to the python module
ensures they are always defined.
2017-10-14 19:06:15 +01:00
Deric Crago
a0d7cf89f2 Fixed 'boundary' spelling 2017-09-26 23:42:48 -04:00
Congxiang Pan
89b6e68e1e Merge pull request #9466 from huningxin:js
GSoC 2017: Improve and Extend the JavaScript Bindings for OpenCV (#9466)

* Initial support for build with emscripten

mkdir build_js
cd build_js
cmake -D CMAKE_TOOLCHAIN_FILE=/path/to/emsdk/emsdk-portable/emscripten/master/cmake/Modules/Platform/Emscripten.cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

* Add js module

The output is build/bin/opencv_js.js

* Fix opencv2/calib3d.hpp not found issue

* Add module name

Usage:
var cv = cv();

* Add total memory as 128MB and allow growth

* Add compilation flags for emscripten

* Use EMSCRIPTEN build target

* Disable js module for non emscripten build

* Bind the preload file path to root

Usage:
face_cascade.load('haarcascade_frontalface_default.xml');

* add test folder

* fix test files

* Copy js module test to bin

* Support to run tests on Node.js

Fix tests to import cv Module when runtime is node.
Add tests.js to use qunit to auto run tests.
Modify umd wrapper to support Module is not defined.

Usage:
node tests.js

* Support UMD and file system

Wrap the opencv_js.js to opencv.js by UMD wrapper

Use emscripten file system API to load files instead of generating data file or
embedding them. It supports both browser and node.js usages.

* Fix incorrect module name in tests

* Add package.json to add dependence of qunit

* Add js_tutorials folder and a intro page of opencv.js

Enable BUILD_DOCS in CMakeLists.txt.
Add new folder of js_tutorials in folder opencv/doc.
Imitate the tutorials of OpenCV-Python to create a intro page of opencv.js and a setup guide

* Import and use binding gen from opencvjs project

* Modify the embindgen.py to pass the build and test

* Add classes and functions white list

* Consolidate hdr_parser.py (#31)

Use hdr_parser.py of python module

Add js flag to support js binding generator.

* Use emscripten::vecFromJSArray for input vector param

Fix part of #23

* Fix test cases after #34

Fix #39

* Expose groupRectangles and CascadeClassifier.empty

* Add js highgui tutorials

add tutorials of imread&imshow and createTrackbar in doc/js_tutorials/js_gui folder
add interactive tutorial webpage for imread&imshow and createTrackbar in doc/js_tutorials/js_interactive_tutorials folder, and some images needed.
change doc/CMakeLists.txt to copy the interactive tutorial webpage and opencv.js to the tutorials' destination folder

* rm useless annotation in doc/CMakeLists.txt

* fix some nonstandard indentation and space

* add check if canvas is valid

* Expose BackgroundSubtractorMOG2

Fix #43

* Fix build of js doc

Limit copy_js_interactive_tutorials for doxygen build
Add dep to opencv.js

Fix #53

* Implement cv.imread & cv.imshow and insert interactive pages in tutorials (#55)

* add helper.js

* delete ALL in add target copy_js_interactive_tutorials to avoid dependence error

* Insert interactive pages in tutorials

insert the old interactive pages in markdown by using \htmlonly and \endhtmlonly command.
delete the useless interactive page
rename js_interactive_tutorials to js_assets to put some images needed in

* fix the depends of the target doxygen

add opencv.js to depends and delete the useless target of copy_js_assets

* change filename helper.js to helpers.js

* disable button or trankbar before opencv.js is ready

* Expose CV_64F

Fix #65

* improve cv.imshow to display different types as native imshow

* add utils.js to reuse functions and update tutorials

* Make doxygen depend on bin/opencv.js

* Fix memory issue of matFromArray

Fix #37

* Merge pull request from ganwenyao/tutorial_18

* Add notes for ganwenyao/tutorial_18

* Modifying for ganwenyao/tutorial_18

* Change Mat constructor with data to 5 parameters

* Mat supports constructor with Scalar

Fix #60

* update cv.imread cause the memory issue of matFromArray has been fixed

* fix canvas name and default input image

* Expose cv::Moments

Fix #85

* Add -Wno-missing-prototypes for emscripten build

* fix canvas name

* add tutorial of video input and output

* Expose enums as emscripten consts

Fix #72

* update the tutorial to use Mat constructor with Scalar and change lena.jpg

* Exclude cv::Mat for vecFromJSArray

Fix #82

* Add unit tests for cv.moments

* Fix the unit tests.

* add checkbox and stop button

* add adapter.js to make sure compatibility fo video tutorials

* Support default parameters with function overloading

* modify enums to constants

* Use https URL for MathJax.js

Fix #109

* Comment out the debug print in embindgen.py

* Expose RotatedRect

Fix #96

* replace enum with constants and improve onload function

* delete some useless paras cause #105 fixed this

* Modify const name

* Modify Contour Properties

* tutorials for imgprc2 and objdec

* Expose more functions for img proc tutorials

Fix #76

* Expose polylines for video analysis tutorial

Fix #121

* Expose constants for default parameters of img proc tutorials

Fix #122

* Fix wrong parameter types of Mat.copyTo

Fix #87

* Support default parameters of mat.convertTo

Fix #123

* Support default parameters for external constructors

Fix #131

* Revert "Expose polylines for video analysis tutorial"

This reverts commit 3ce7615652e510d30e3c0014706ac38c98883189.

Fix #121

* Support cv.minMaxLoc

Fix #127

* Expose cv.minEnclosingCircle

Fix #126

* Add video analysis tutorials

add three video tutorials, Meanshift and Camshift, Optical Flow Background Subtraction
add cup.mp4 and box.mp4 for demo in tutorials

* improve image processing tutorials

* repalce console.warn with throw to throw exception

* add try-catch to throw exception in code demo

* Change mat.size() return value to JS Array object

Fix #140

* add a note about different channels order between canvas and native opencv

* add a note about how to capture video from video files

* Binding cv.Scalar to JS array

Fix #147

* Add JS cv.Scalar object into helpers.js

* Update Install OpenCV-JavaScript tutorial page

Fix #44

* Update the OpenCV-JavaScript introduction page

Fix #44

* add cv.VideoCapture and read() function

* set the size of the hidden canvas same as the video

* Add Using OpenCV-JavaScript tutorial page

Fix #44

* fix some bad code style

* Update tutorials after 8/2 sync meeting

Changes include:
- Use OpenCV.js name instead of OpenCV-JavaScript
- Put using OpenCV.js ahead of build OpenCV.js
- Refine usage and introduction page
- Muted the video in tutorials

* Fix a typo in introduction page

* use cv.VideoCapture and its read() function to read video

* replace OpenCV-JavaScript with OpenCV.js

* Use onload of async script in js_usage tutorial

* add more info about mat.data

* Change Size to value_object

* Integrate Moh and Sajjad's editing into introduction page

* Change Point to value_object

* Change Rect to value_object with helper object

* Add helper objects for Point and Size

* Change RotatedRect to value_object with helpers

* Change MinMaxLoc and Circle to value_object

* Change TermCriteria to value_object

* Fix core_bindings.cpp for MinMaxLoc and Circle

* Remove unused types

* Change meanShift and CamShift to return Rect

* Change methods of RotatedRect to static

* Change mat.data from methods to property

Fix #75 and #77

* support img id and element in cv.imread

* Change mat.size to property and add mat.step

Fix #163

* Add matFromArray and matFromImageData as JS helpers

Fix #79, #78

* Lower camel case for Mat element getters

Fix #81

* Mat.getRoiRect and tests

Fix #86

* Support type for Mat.ptr

Fix #83

* Name changing of Mat element getters

'getUcharAt` -> 'ucharAt'

* fix code style and args names

* Fix helpers.js due to cv.Mat API update

* Fix opencv.js usage tutorial

* Fix a typo of js_setup

* Change Moments to value_object

* Add Range as value_object

Fix #171

* Support Mat.diag and Mat.isContinous

Fix #84 and #89

* Support Mat.setTo

Fix #88

* Apply edits to js_intro

* Apply edits to js_usage

* Apply edits to js_setup

* update tutorials to apply data type change

* Modify tutorials

* add core tutorials

* delete MatVector elements and delete useless set operation

* add tutorials_objdec_camera

* Add instructions for WebAssembly

* apply tech writer's feedbacks into tutorials

* Organize white list by modules

* Change size to method and bind to MatExpr.size()

Fix #177

* improve tutorials

* Modify core tutorials

* add params list and explanations for OpenCV.js functions

* remove face_profile from Face Detection in Video Capture

* Add demos link

* Change Gui to GUI

* Update js_intro based on Moh and Sajjad's edits

* Fixup for 3.3.0 rebase

* Update js_intro per Moh's suggestion

* Update contributors list per Moh's idea

* add adapter.js in video_display tutorial

* Change Mat.getRoiRect to Mat.roi

Fix #194

* Remove unnecessary files for test

Fix #192

* Licenses updated to UC BSD 3-Clause

* Apply OpenCV coding style for C++ files

* Add OpenCV license for python and js files

* Fix coding style issue in helpers.js

* Remove unused test_commons.js

* Fix coding style of test_imgproc.js

* Fix coding style of test_mat.js

* Fix space before semicolon

* Fix coding style of test_objdetect.js

* Fix coding style of tests.js

* Fix coding style of test_utils.js

* Fix coding style of test_video.js

* Fix failures of node.js tests

* Add eslint rule config and fix eslint errors

* Add eslint config for js/src and fix eslint errors

* Clean up the opencv.js dependencies

Fix #186

* Fix build issue for python generator

* Fix doxygen buildbot failure

* delete trailing whitespace, blank line at EOF and replace tab with space

* Fix tutorial_js_root reference issue for non opencv.js build

* replace the file with small size

* Initial commit of build_js.py

* Move the js build configurations to build script

* Add wasm build support

* Update OpenCV.js build tutorial by using script

* Fix global var issue in tests

* Add a README.md for build_js.py

* Copy the haar cascade files from data dir for tutorials

* Not use memory init file

* Disable debug print for modules/js/CMakeLists.txt

* Check files when build done

* Fix image name in js_gradients tutorial

* Fix image load issue in js_trackbar tutorial

* Find the opencv source directory via relative path by default

* Make the cmake args based on build_doc option

* Fix a typo in js_setup.markdown

* Fix make failure issue on config generated by build_js.py

* Eliminate js branch of hdr_parser.py

* Extract examples from js_basic_ops tutorial

* Fix coding style of utils.js

* Improve examples error handling

Handle:
1. opencv.js loading errors
2. script errors (Error)
3. cv::Exception

Fix #217

* Add enable_exception option into build_js.py

* Support print exception for exception catching disabled build

* Extract example from js_usage tutorial

* Avoid copying .eslintrc.json when building doc

Fix #223

* Revert to use onload as opencv.js ready event

* Use 4 spaces indention for js examples

* embed html in tutorials with iframe tag

* Revert to use onload as opencv.js ready event

* Extract examples from js_video_display tutorial

* Implement Utils object

* modify core imgprc and face_detection tutorials

* Fix examples of js_gui tutorials

* Fix coding style of utils.js

* Modify tutorials

* Extract example from js_face_detection_camera tutorial

* Disable new-cap check in eslint

* Extract examples from js_meanshift tutorial

* Extract examples from video tutorials

* Remove new-cap declaration and update grammer in comments

* Change textarea width to 100 to align with eslint config

* Fix printError issue when opencv.js loading fails

* Remove BUILD_opencv_js dependency for doc build

Fix #213

* Expose cv::getBuildInformation

* Dump opencv build info when opencv.js loaded for live examples

* Make the button to stand out in js live examples

Fix #235

* Style for disabled button

* Add js_imgproc_camera.html example

* Fix coding style of imgproc_camera example

* Add js_imgproc_camera tutorial

* Remove link to opencv.js demos

* doc: copy opencv.js on build, use absolute paths for assets

* doc: reuse existed file box.mp4
2017-09-25 16:52:07 +03:00
Dmitry Kurtaev
bd8e6b7e14 Make external cv::dnn::Importer usage is deprecated 2017-09-18 08:52:36 +03:00
Vadim Pisarevsky
b8b5d83ad0 Merge pull request #9566 from alalek:python_signatures 2017-09-13 13:32:05 +00:00
Maksim Shabunin
2ac57a2b1f Merge pull request #9457 from alalek:type_traits_issue_7599 2017-09-06 13:34:29 +00:00
Alexander Alekhin
572a7bf6ce python: add special targets gen_opencv_python2(3) 2017-09-06 08:23:04 +03:00
Alexander Alekhin
200c8a0d3a python: generate pyopencv_signatures.json file 2017-09-06 08:23:04 +03:00
Lewis B
1caca2112b Merge pull request #8934 from lewisjb:python-classes
* Refactor Python Classes
2017-09-05 05:38:17 +00:00
Alexander Alekhin
7791839f22 python(test): tests filtering 2017-09-03 18:26:24 +00:00
Alexander Alekhin
2f94637899 python(test): refactor test.py, move test code outside from test.py 2017-09-03 18:26:09 +00:00
Alexander Alekhin
936234d5b1 python(test): enable pylint checks for tests 2017-09-03 18:19:17 +00:00
Alexander Alekhin
72f789bf34 core: fix type traits 2017-08-31 15:05:46 +03:00