All Projects → yati-sagade → Opencv Ndarray Conversion

yati-sagade / Opencv Ndarray Conversion

Licence: mit
NumPy ndarray ⇋ OpenCV Mat conversion, that just works.

Projects that are alternatives of or similar to Opencv Ndarray Conversion

Color Tracker
Color tracking with OpenCV
Stars: ✭ 128 (+19.63%)
Mutual labels:  opencv, numpy
Deeplearning cv notes
📓 deepleaning and cv notes.
Stars: ✭ 223 (+108.41%)
Mutual labels:  opencv, numpy
Python Tutorial
🏃 Some of the python tutorial - 《Python学习笔记》
Stars: ✭ 122 (+14.02%)
Mutual labels:  opencv, numpy
Studybook
Study E-Book(ComputerVision DeepLearning MachineLearning Math NLP Python ReinforcementLearning)
Stars: ✭ 1,457 (+1261.68%)
Mutual labels:  opencv, numpy
Skydetector
A Python implementation of Sky Region Detection in a Single Image for Autonomous Ground Robot Navigation (Shen and Wang, 2013)
Stars: ✭ 23 (-78.5%)
Mutual labels:  opencv, numpy
Finger Detection And Tracking
Finger Detection and Tracking using OpenCV and Python
Stars: ✭ 317 (+196.26%)
Mutual labels:  opencv, numpy
Stb Tester
Automated Testing for Set-Top Boxes and Smart TVs
Stars: ✭ 148 (+38.32%)
Mutual labels:  opencv, numpy
Eulerian Remote Heartrate Detection
Remote heart rate detection through Eulerian magnification of face videos
Stars: ✭ 48 (-55.14%)
Mutual labels:  opencv, numpy
Human Detection And Tracking
Human-detection-and-Tracking
Stars: ✭ 753 (+603.74%)
Mutual labels:  opencv, numpy
Face morpher
👼 Morph faces with Python, Numpy, Scipy
Stars: ✭ 732 (+584.11%)
Mutual labels:  opencv, numpy
Lambda Packs
Precompiled packages for AWS Lambda
Stars: ✭ 997 (+831.78%)
Mutual labels:  opencv, numpy
Pybind11 opencv numpy
Implementation of cv::Mat conversion to numpy.array for pybind11
Stars: ✭ 96 (-10.28%)
Mutual labels:  opencv, numpy
Opencv Java Tutorials
Source for the OpenCV with Java tutorials
Stars: ✭ 102 (-4.67%)
Mutual labels:  opencv
Awesome Face Detection
Compare with various detectors - s3fd, dlib, ocv, ocv-dnn, mtcnn-pytorch, face_recognition
Stars: ✭ 106 (-0.93%)
Mutual labels:  opencv
Opencv3 Intro Book Src
📘《OpenCV3编程入门》书本配套源码 |《Introduction to OpenCV3 Programming》Book Source Code
Stars: ✭ 1,369 (+1179.44%)
Mutual labels:  opencv
Pedestriancounter
Pedestrians detection and tracking using OpenCV on Python
Stars: ✭ 100 (-6.54%)
Mutual labels:  opencv
Opencv Electron
Example for using opencv4nodejs with electron.
Stars: ✭ 107 (+0%)
Mutual labels:  opencv
Numbagg
Fast N-dimensional aggregation functions with Numba
Stars: ✭ 104 (-2.8%)
Mutual labels:  numpy
Curved Lane Lines
detect curved lane lines using HSV filtering and sliding window search.
Stars: ✭ 100 (-6.54%)
Mutual labels:  opencv
Numba Scipy
numba_scipy extends Numba to make it aware of SciPy
Stars: ✭ 98 (-8.41%)
Mutual labels:  numpy

NumPy ndarray ⇋ OpenCV Mat conversion, that just works.

API

  • class NDArrayConverter: The converter class

  • NDArrayConverter::NDArrayConverter(): Constructor

  • cv::Mat NDArrayConverter::toMat(const PyObject* o): Convert a NumPy ndarray to a cv::Mat.

    • o is the object representing the Python representation of the ndarray.

    • Returns a cv::Mat which is the OpenCV representation of o.

  • PyObject* NDArrayConverter::toNDArray(const cv::Mat& mat): Convert a cv::Mat to a NumPy ndarray.

    • mat is the cv::Mat to convert.

    • Returns a PyObject* that is the Python representation of an ndarray.

Examples

examples.cpp contains

  • An implementation of matrix multiplication mul() that takes two ndarray objects, converts them to cv::Mat, multiplies them and returns the result as an ndarray.

  • An image binarization function binarize() that takes an ndarray containing a grayscale image and a threshold value, converts the image to a cv::Mat and thresholds(binarizes) it. It then returns the result as a ndarray.

  • An image display function display(ndarray) that just takes any image as an ndarray object and displays it.

All of these functions are callable from Python.

The plumbing(passing of values to and from Python) is handled by Boost::Python.

test.py contains some testcases that call the aforementioned C++ functions from Python.

Building and testing

After installing Boost::Python and NumPy(maybe the devel package),

$ make
$ make test

This builds and tests the project. Specifically, it builds the core converter in conversion.o and a set of examples in examples.so, which is a Python module containing a few examples of using the converter. test.py contains a test-suite to test (and demonstrate) the converter.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].