mirror of
https://github.com/opencv/opencv.git
synced 2024-11-26 12:10:49 +08:00
16b9514543
`PyObject*` to `std::vector<T>` conversion logic: - If user passed Numpy Array - If array is planar and T is a primitive type (doesn't require constructor call) that matches with the element type of array, then copy element one by one with the respect of the step between array elements. If compiler is lucky (or brave enough) copy loop can be vectorized. For classes that require constructor calls this path is not possible, because we can't begin an object lifetime without hacks. - Otherwise fall-back to general case - Otherwise - execute the general case: If PyObject* corresponds to Sequence protocol - iterate over the sequence elements and invoke the appropriate `pyopencv_to` function. `std::vector<T>` to `PyObject*` conversion logic: - If `std::vector<T>` is empty - return empty tuple. - If `T` has a corresponding `Mat` `DataType` than return Numpy array instance of the matching `dtype` e.g. `std::vector<cv::Rect>` is returned as `np.ndarray` of shape `Nx4` and `dtype=int`. This branch helps to optimize further evaluations in user code. - Otherwise - execute the general case: Construct a tuple of length N = `std::vector::size` and insert elements one by one. Unnecessary functions were removed and code was rearranged to allow compiler select the appropriate conversion function specialization. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
test_algorithm_rw.py | ||
test_async.py | ||
test_camshift.py | ||
test_dft.py | ||
test_filestorage_io.py | ||
test_fitline.py | ||
test_gaussian_mix.py | ||
test_grabcut.py | ||
test_houghcircles.py | ||
test_houghlines.py | ||
test_kmeans.py | ||
test_legacy.py | ||
test_misc.py | ||
test_morphology.py | ||
test_mser.py | ||
test_norm.py | ||
test_persistence.py | ||
test_squares.py | ||
test_texture_flow.py | ||
test_umat.py | ||
test_watershed.py | ||
test.py | ||
tests_common.py | ||
tst_scene_render.py |