{"id":16311290,"url":"https://github.com/yati-sagade/opencv-ndarray-conversion","last_synced_at":"2025-03-16T14:30:43.289Z","repository":{"id":8398779,"uuid":"9978717","full_name":"yati-sagade/opencv-ndarray-conversion","owner":"yati-sagade","description":"NumPy ndarray ⇋ OpenCV Mat conversion, that just works.","archived":false,"fork":false,"pushed_at":"2021-05-17T16:12:29.000Z","size":238,"stargazers_count":117,"open_issues_count":14,"forks_count":40,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-27T10:08:40.427Z","etag":null,"topics":["numpy","opencv","opencv-ndarray-conversion"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yati-sagade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-10T09:45:27.000Z","updated_at":"2025-02-06T19:30:00.000Z","dependencies_parsed_at":"2022-08-07T04:16:31.746Z","dependency_job_id":null,"html_url":"https://github.com/yati-sagade/opencv-ndarray-conversion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yati-sagade%2Fopencv-ndarray-conversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yati-sagade%2Fopencv-ndarray-conversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yati-sagade%2Fopencv-ndarray-conversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yati-sagade%2Fopencv-ndarray-conversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yati-sagade","download_url":"https://codeload.github.com/yati-sagade/opencv-ndarray-conversion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818172,"owners_count":20352629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numpy","opencv","opencv-ndarray-conversion"],"created_at":"2024-10-10T21:44:00.586Z","updated_at":"2025-03-16T14:30:42.961Z","avatar_url":"https://github.com/yati-sagade.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"NumPy ndarray ⇋ OpenCV Mat conversion, that just works.\n===========================================================\n\nAPI\n-----\n\n- `class NDArrayConverter`: The converter class\n        \n- `NDArrayConverter::NDArrayConverter()`: Constructor\n\n- `cv::Mat NDArrayConverter::toMat(const PyObject* o)`: Convert a NumPy ndarray \n  to a `cv::Mat`. \n\n    - o is the object representing the Python representation of the ndarray.\n\n    - **Returns** a `cv::Mat` which is the OpenCV representation of o.\n\n- `PyObject* NDArrayConverter::toNDArray(const cv::Mat\u0026 mat)`: Convert a `cv::Mat` to a NumPy ndarray.\n    \n    - mat is the cv::Mat to convert.\n\n    - **Returns** a `PyObject*` that is the Python representation of an ndarray.\n\n\nExamples\n--------\n\n`examples.cpp` contains\n\n- An implementation of matrix multiplication `mul()` that takes two\n  `ndarray` objects, converts them to `cv::Mat`, multiplies them and returns\n  the result as an `ndarray`.\n\n- An image binarization function `binarize()` that takes an `ndarray`\n  containing a grayscale image and a threshold value, converts the image to\n  a `cv::Mat` and thresholds(binarizes) it. It then returns the result as\n  a `ndarray`.\n\n- An image display function `display(ndarray)` that just takes any image\n  as an `ndarray` object and displays it.\n\nAll of these functions are callable from Python.\n\nThe plumbing(passing of values to and from Python) is handled by\nBoost::Python.\n\n`test.py` contains some testcases that call the aforementioned C++ functions\nfrom Python.\n\n\nBuilding and testing\n---------------------\n\nAfter installing [Boost::Python][1] and [NumPy][2](maybe the devel package),\n    \n    $ make\n    $ make test\n\n\nThis builds and tests the project. Specifically, it builds the core converter\nin `conversion.o` and a set of examples in `examples.so`, which is a Python\nmodule containing a few examples of using the converter. `test.py` contains\na test-suite to test (and demonstrate) the converter.\n\n[1]: http://www.boost.org/doc/libs/1_53_0/libs/python/doc/index.html\n[2]: http://www.numpy.org/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyati-sagade%2Fopencv-ndarray-conversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyati-sagade%2Fopencv-ndarray-conversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyati-sagade%2Fopencv-ndarray-conversion/lists"}