• Vadim Levin's avatar
    Merge pull request #15915 from VadimLevin:dev/norm_fix · 31289d2f
    Vadim Levin authored
    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
    31289d2f
Name
Last commit
Last update
..
calib3d Loading commit data...
core Loading commit data...
cudaarithm Loading commit data...
cudabgsegm Loading commit data...
cudacodec Loading commit data...
cudafeatures2d Loading commit data...
cudafilters Loading commit data...
cudaimgproc Loading commit data...
cudalegacy Loading commit data...
cudaobjdetect Loading commit data...
cudaoptflow Loading commit data...
cudastereo Loading commit data...
cudawarping Loading commit data...
cudev Loading commit data...
dnn Loading commit data...
features2d Loading commit data...
flann Loading commit data...
highgui Loading commit data...
imgcodecs Loading commit data...
imgproc Loading commit data...
java Loading commit data...
js Loading commit data...
ml Loading commit data...
objdetect Loading commit data...
photo Loading commit data...
python Loading commit data...
shape Loading commit data...
stitching Loading commit data...
superres Loading commit data...
ts Loading commit data...
video Loading commit data...
videoio Loading commit data...
videostab Loading commit data...
viz Loading commit data...
world Loading commit data...
CMakeLists.txt Loading commit data...