Open Source Computer Vision Library
Go to file
Vadim Levin 31289d2f32 Merge pull request #15915 from VadimLevin:dev/norm_fix
Fix implicit conversion from array to scalar in python bindings

* Fix wrong conversion behavior for primitive types

  - Introduce ArgTypeInfo namedtuple instead of plain tuple.
    If strict conversion parameter for type is set to true, it is
    handled like object argument in PyArg_ParseTupleAndKeywords and
    converted to concrete type with the appropriate pyopencv_to function
    call.
  - Remove deadcode and unused variables.
  - Fix implicit conversion from numpy array with 1 element to scalar
  - Fix narrowing conversion to size_t type.

* Fix wrong conversion behavior for primitive types

  - Introduce ArgTypeInfo namedtuple instead of plain tuple.
    If strict conversion parameter for type is set to true, it is
    handled like object argument in PyArg_ParseTupleAndKeywords and
    converted to concrete type with the appropriate pyopencv_to function
    call.
  - Remove deadcode and unused variables.
  - Fix implicit conversion from numpy array with 1 element to scalar
  - Fix narrowing conversion to size_t type.·
  - Enable tests with wrong conversion behavior
  - Restrict passing None as value
  - Restrict bool to integer/floating types conversion

* Add PyIntType support for Python 2

* Remove possible narrowing conversion of size_t

* Bindings conversion update

  - Remove unused macro
  - Add better conversion for types to numpy types descriptors
  - Add argument name to fail messages
  - NoneType treated as a valid argument. Better handling will be added
    as a standalone patch

* Add descriptor specialization for size_t

* Add check for signed to unsigned integer conversion safety

  - If signed integer is positive it can be safely converted
    to unsigned
  - Add check for plain python 2 objects
  - Add check for numpy scalars
  - Add simple type_traits implementation for better code style

* Resolve type "overflow" false negative in safe casting check

 - Move type_traits to separate header

* Add copyright message to type_traits.hpp

* Limit conversion scope for integral numpy types

  - Made canBeSafelyCasted specialized only for size_t, so
    type_traits header became unused and was removed.
  - Added clarification about descriptor pointer
2020-01-13 18:11:34 +03:00
.github migration: github.com/opencv/opencv 2016-07-12 12:51:12 +03:00
3rdparty 3rdparty: TBB version 2019u8 => 2020.0 2019-12-18 23:14:38 +00:00
apps Fix spelling typos 2019-12-27 12:46:53 +00:00
cmake build: eliminate build warnings 2019-12-25 23:28:24 +00:00
data Some mist. typo fixes 2018-02-07 06:59:15 -05:00
doc Merge pull request #16276 from themechanicalcoder:video-tutorial 2020-01-12 11:34:59 +03:00
include add missing DNN header to opencv2/opencv.hpp 2018-02-15 15:59:14 +01:00
modules Merge pull request #15915 from VadimLevin:dev/norm_fix 2020-01-13 18:11:34 +03:00
platforms Fix spelling typos 2019-12-27 12:46:53 +00:00
samples Merge pull request #16335 from berak:fix_ml_python_digits_samples_3.4 2020-01-13 12:16:40 +00:00
.editorconfig add .editorconfig 2018-10-11 17:57:51 +00:00
.gitattributes cmake: generate and install ffmpeg-download.ps1 2018-06-09 13:19:48 +03:00
.gitignore Merge pull request #15503 from cancerberoSgx:js-test-puppeteer 2019-11-17 00:29:38 +03:00
CMakeLists.txt Enable cmake CMP0077 policy 2020-01-08 14:10:45 -03:00
CONTRIBUTING.md migration: github.com/opencv/opencv 2016-07-12 12:51:12 +03:00
LICENSE copyright: 2020 2020-01-02 11:58:20 +00:00
README.md Improve README (#9243) 2017-09-13 17:58:34 +03:00

OpenCV: Open Source Computer Vision Library

Resources

Contributing

Please read the contribution guidelines before starting work on a pull request.

Summary of the guidelines:

  • One pull request per issue;
  • Choose the right base branch;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.