{"id":13491168,"url":"https://github.com/cocoa-xu/evision","last_synced_at":"2026-05-27T03:08:54.482Z","repository":{"id":37074982,"uuid":"428101112","full_name":"cocoa-xu/evision","owner":"cocoa-xu","description":"Evision: An OpenCV-Erlang/Elixir binding","archived":false,"fork":false,"pushed_at":"2026-05-21T11:42:26.000Z","size":5971,"stargazers_count":385,"open_issues_count":10,"forks_count":26,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-05-21T14:47:10.109Z","etag":null,"topics":["elixir","elixir-library","erlang","opencv"],"latest_commit_sha":null,"homepage":"https://evision.app","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cocoa-xu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-11-15T02:44:59.000Z","updated_at":"2026-05-21T11:11:47.000Z","dependencies_parsed_at":"2023-02-12T20:15:33.290Z","dependency_job_id":"6e430cb0-4ff4-421a-ad42-d54e80e09fb6","html_url":"https://github.com/cocoa-xu/evision","commit_stats":{"total_commits":1425,"total_committers":17,"mean_commits":83.82352941176471,"dds":0.36,"last_synced_commit":"0c2550c349875872235841e1b87f3e802c52f1ac"},"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"purl":"pkg:github/cocoa-xu/evision","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoa-xu%2Fevision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoa-xu%2Fevision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoa-xu%2Fevision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoa-xu%2Fevision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cocoa-xu","download_url":"https://codeload.github.com/cocoa-xu/evision/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoa-xu%2Fevision/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33548397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["elixir","elixir-library","erlang","opencv"],"created_at":"2024-07-31T19:00:54.219Z","updated_at":"2026-05-27T03:08:54.468Z","avatar_url":"https://github.com/cocoa-xu.png","language":"Elixir","funding_links":[],"categories":["Elixir","Vision \u0026 Image Processing","SmartCells","Machine Learning"],"sub_categories":["How to Join","Computer Vision"],"readme":"\u003cimg src=\"https://github.com/cocoa-xu/evision/raw/main/assets/repository-open-graph.png\" alt=\"Logo\"/\u003e\n\n[![Hex.pm](https://img.shields.io/hexpm/v/evision.svg?style=flat\u0026color=blue)](https://hex.pm/packages/evision)\n\n| OS               | Arch           | ABI  | Build Status | Has Precompiled Library |\n|------------------|----------------|------|--------------|-------------------------|\n| Linux            | x86_64         | gnu  |[![CI](https://github.com/cocoa-xu/evision/actions/workflows/linux-x86_64.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-x86_64.yml) | Yes |\n| Linux            | x86_64         | musl |[![CI](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-musl.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-musl.yml) | Yes |\n| Linux            | aarch64        | gnu  |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml) | Yes |\n| Linux            | aarch64        | musl |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-musl.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-musl.yml) | Yes |\n| Linux            | armv6 (armhf)  | gnueabihf |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml) | Yes |\n| Linux            | armv7l (armhf) | gnueabihf |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml) | Yes |\n| Linux            | ppc64le        | gnu  |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml) | Yes |\n| Linux            | s390x          | gnu  |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml) | Yes |\n| Linux            | riscv64        | gnu  |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-gnu.yml) | Yes |\n| Linux            | riscv64        | musl |[![linux-precompile](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-musl.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/linux-precompile-musl.yml) | Yes |\n| FreeBSD          | x86_64         | freebsd |[![freebsd-precompile](https://github.com/cocoa-xu/evision/actions/workflows/freebsd-precompile-x86_64.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/freebsd-precompile-x86_64.yml) | Yes |\n| macOS 13 Ventura | x86_64        | darwin |[![CI](https://github.com/cocoa-xu/evision/actions/workflows/macos-x86_64.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/macos-x86_64.yml) | Yes |\n| macOS 14 Sonoma  | aarch64       | darwin |[![macos-precompile](https://github.com/cocoa-xu/evision/actions/workflows/macos-precompile.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/macos-precompile.yml) | Yes |\n| Windows 2022     | x86_64         | msvc |[![CI](https://github.com/cocoa-xu/evision/actions/workflows/windows-x86_64.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/windows-x86_64.yml) | Yes |\n| Windows 2022     | aarch64        | msvc |[![CI](https://github.com/cocoa-xu/evision/actions/workflows/windows-x86_64.yml/badge.svg)](https://github.com/cocoa-xu/evision/actions/workflows/windows-precompile.yml) | Yes |\n\n## Installation\n\nIn order to use `evision`, you will need Elixir installed. Then create an Elixir project via the `mix` build tool:\n\n```sh\n$ mix new my_app\n```\n\nThen you can add `evision` as a dependency in your `mix.exs`.\n\n```elixir\ndef deps do\n  [\n    {:evision, \"~\u003e 0.2\"}\n  ]\nend\n```\n\n### Use Precompiled Library (Default)\nThe following environment variables can be set based on your needs.\n\n(Note that precompiled binaries do not use FFmpeg. If you'd like to use FFmpeg, please compile from source (please see instructions in the next section) and set corresponding environment variables. We're considering this option at the moment.)\n\n#### macOS: install Tesseract\n\nThe precompiled macOS binaries link against [Tesseract](https://github.com/tesseract-ocr/tesseract) (and its dependency Leptonica) for OpenCV's `text`/OCR module. Tesseract is **not bundled** with the precompiled tarball, so it must be present on your system or `evision.so` will fail to load with a `Library not loaded: ...libtesseract.5.dylib` error — even if you never call any OCR functions, because dyld resolves the dependency graph eagerly at load time.\n\nInstall with Homebrew:\n\n```sh\nbrew install tesseract\n```\n\nevision searches `/opt/homebrew/lib`, `/usr/local/lib`, and `/opt/local/lib` for the Tesseract dylib at load time, so Homebrew (both Apple Silicon and Intel) and MacPorts work out of the box. For Nix or other custom prefixes, set `DYLD_LIBRARY_PATH` to the directory containing `libtesseract.5.dylib` before starting your application. See [#287](https://github.com/cocoa-xu/evision/issues/287) for details.\n\n#### FreeBSD: install OpenBLAS\n\nThe precompiled FreeBSD binaries link against OpenBLAS (a transitive dependency of OpenCV's `calib3d` module) and it is **not bundled** with the tarball. Without it, `evision.so` fails to load at on_load with `Shared object \"libopenblas.so.0\" not found, required by \"libopencv_calib3d.so\"`.\n\n```sh\npkg install openblas\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAdvanced Options\u003c/summary\u003e\n\n#### TARGET_ABI\n**Required if and only if the target is using musl libc.**\n\n```shell\n# (for nerves project, this environment variable is set by nerves)\nexport TARGET_ABI=musl\n## (for armv7l which uses hard-float ABI (armhf))\nexport TARGET_ABI=musleabihf\n```\n\nThis variable will only be checked when identifying the musl libc ABI so that the correct precompiled binaries can be downloaded. Therefore, \n\n1. You don't need to keep it in the runtime environment.\n2. If you want to change it later, the directory `_build/${MIX_ENV}/lib/evision` needs to be deleted first.\n\nThe default value for the `TARGET_ABI` env var is obtained using the following elixir code\n\n```elixir\ntarget_abi = List.last(String.split(to_string(:erlang.system_info(:system_architecture)), \"-\"))\ntarget_abi =\n  case target_abi do\n    \"darwin\" \u003c\u003e _ -\u003e \"darwin\"\n    \"freebsd\" \u003c\u003e _ -\u003e \"freebsd\"\n    \"win32\" -\u003e\n      {compiler_id, _} = :erlang.system_info(:c_compiler_used)\n      case compiler_id do\n        :msc -\u003e \"msvc\"\n        _ -\u003e to_string(compiler_id)\n      end\n    _ -\u003e target_abi\n  end\n```\n\n#### EVISION_PREFER_PRECOMPILED\n```shell\n# optional. \n# set this to \"false\" if you prefer :evision to be compiled from source\n# \n# default value is \"true\", and :evision will prefer to use precompiled binaries (if available)\nexport EVISION_PREFER_PRECOMPILED=false\n```\n\nThis variable will only be checked whenever the `mix compile` task is invoked directly (`mix compile`) or indirectly (`mix test`). And in the Makefile we would skip everything if `_build/${MIX_ENV}/lib/evision/priv/evision.so` is presented. Therefore,\n\n1. You don't need to keep it in the runtime environment.\n2. If you want to change it later, the directory `_build/${MIX_ENV}/lib/evision` needs to be deleted first.\n\n**If you found the precompiled binaries do not suit your needs (e.g., perhaps you need OpenCV to be compiled with FFmpeg to handle more video formats.), it's possible to override the behaviour by setting the environment variable `EVISION_PREFER_PRECOMPILED` to `false`, and then please delete `_build/${MIX_ENV}/lib/evision` and recompile evision**\n\n**Also, for Linux users only, the precompiled binary is not compiled with GTK support, therefore functions like `Evision.HighGui.imshow/2` will not work. However, you can either use `Evision.Wx.imshow/2` (if Erlang on your system is compiled with `wxWidgets`), or set the environment variable `EVISION_PREFER_PRECOMPILED` to `false` so that OpenCV can detect available HighGui backend when compiling from source.**\n\n```shell\nexport EVISION_PREFER_PRECOMPILED=false\n```\n\nFor livebook users, \n```elixir\nMix.install([\n  {:evision, \"~\u003e 0.2\"}\n], system_env: [\n  {\"EVISION_PREFER_PRECOMPILED\", \"false\"}\n])\n```\n\n#### EVISION_ENABLE_CONTRIB\nSet environment variable `EVISION_ENABLE_CONTRIB` to `true` to enable modules from [opencv_contrib](https://github.com/opencv/opencv_contrib).\n\n```bash\n# enable opencv_contrib modules (default)\nexport EVISION_ENABLE_CONTRIB=true\n\n# disable opencv_contrib modules\nexport EVISION_ENABLE_CONTRIB=false\n```\n\nThis variable will only be checked whenever the `mix compile` task is invoked directly (`mix compile`) or indirectly (`mix test`). And in the Makefile we would skip everything if `_build/${MIX_ENV}/lib/evision/priv/evision.so` is presented. Therefore,\n\n1. You don't need to keep it in the runtime environment.\n2. If you want to change it later from `false` to `true`, you can delete the file `_build/${MIX_ENV}/lib/evision/priv/evision.so`, set `EVISION_ENABLE_CONTRIB` to `true`, and then execute `mix compile`.\n\nDefaults to `true` because for precompiled binaries, including these \"extra\" modules only increases less than 20 MBs (tested on `aarch64-apple-darwin`) in size.\n\nHowever, 20 MBs for Nerves users can be a huge deal (still depending on your device, for example, +20 MBs is often much more acceptable for RPIs as they are usually equipped with \u003e= 8 GB microSD cards while being absolutely a luxury thing for some other embedded devices).\n\n#### EVISION_ENABLE_CUDA\nSet environment variable `EVISION_ENABLE_CONTRIB` to `true` to enable CUDA support from [opencv_contrib](https://github.com/opencv/opencv_contrib). Defaults to `false`.\n\nNote that `EVISION_ENABLE_CONTRIB` will need to be `true` as well.\n\n```bash\n# enable CUDA support\nexport EVISION_ENABLE_CUDA=true\n## set a CUDA version that matches your local CUDA driver\n## (this environment variable is only required for users who'd like to use precompiled binaries)\n## available ones are \n## 11, for CUDA 11.x, built with CUDA 11.8.0 (Linux only)\n## 12, for CUDA 12.x, built with CUDA 12.9.1\nexport EVISION_CUDA_VERSION=12\n\n## set a CUDNN version that matches your local CUDNN shared library\n## (this environment variable is only required for users who'd like to use precompiled binaries)\n## available ones are \n## 8, for CUDA 11.x or 12.x, built with CUDNN 8.9.7\n## 9, for CUDA 11.x or 12.x, built with CUDNN 9.x\nexport EVISION_CUDNN_VERSION=9\n\n## opencv_contrib modules is enabled by default\nexport EVISION_ENABLE_CONTRIB=true\n\n# disable CUDA support (default) \nexport EVISION_ENABLE_CUDA=false\n```\n\n##### IMPORTANT NOTE FOR WINDOWS USERS\nCUDA 11 precompiled binaries are not available on Windows due to MSVC compiler incompatibility with CUDA 11.x. Windows users should use CUDA 12.4 or newer.\n\nIf `EVISION_ENABLE_CUDA` is `true`, please also set CUDA runtime dir otherwise `Evision` will fail to load.\n\n###### cmd\n```cmd\nset EVISION_CUDA_RUNTIME_DIR=C:/PATH/TO/YOUR/CUDA/RUNTIME/BIN\n```\n\nAlso, please don't quote even if there are spaces in the path\n\n```cmd\nset EVISION_CUDA_RUNTIME_DIR=C:/PATH WITH SPACE/TO/YOUR/CUDA/RUNTIME/BIN\n```\n\n###### Powershell\n```pwsh\n$Env:EVISION_CUDA_RUNTIME_DIR=\"C:/PATH/TO/YOUR/CUDA/RUNTIME/BIN\"\n$Env:EVISION_CUDA_RUNTIME_DIR=\"C:/PATH WITH SPACE/TO/YOUR/CUDA/RUNTIME/BIN\"\n```\n\n#### EVISION_PRECOMPILED_CACHE_DIR\n```shell\n# optional.\n## set the cache directory for the precompiled archive file\nexport EVISION_PRECOMPILED_CACHE_DIR=\"$(pwd)/.cache\"\n```\n\n\u003c/details\u003e\n\n\n## Examples\n\nSome [examples](https://github.com/cocoa-xu/evision/tree/main/examples) are available in the `examples` directory.\n\n## Description\n\n`evision` will pull OpenCV source code from GitHub, then parse and automatically generate corresponding OpenCV-Elixir bindings.\n\nThis project uses and modifies `gen2.py` and `hdr_parser.py` from the `python` module in the [OpenCV repo](https://github.com/opencv/opencv) so that they output header files that can be used in Elixir bindings. \n\n## Docs\nOnline docs for the latest released version is available on Hex.pm, [https://hexdocs.pm/evision/](https://hexdocs.pm/evision/).\n\n## Useful links\n- [Installation](https://github.com/cocoa-xu/evision?tab=readme-ov-file#installation)\n- [Use Precompiled Library (Default)](https://github.com/cocoa-xu/evision?tab=readme-ov-file#use-precompiled-library-default)\n- [Compile evision from source](https://github.com/cocoa-xu/evision/wiki/Compile-evision-from-source)\n- [Nerves Support](https://github.com/cocoa-xu/evision/wiki/Nerves-Support)\n- [Register Builtin Smart Cells](https://github.com/cocoa-xu/evision/wiki/Register-Builtin-Smart-Cells)\n- [Integration with Nx](https://github.com/cocoa-xu/evision/wiki/Integration-with-Nx)\n- [Access behaviour (Getting a sub-area of an image)](https://github.com/cocoa-xu/evision/wiki/Access-behaviour-(Getting-a-sub%E2%80%90area-of-an-image))\n\n### Acknowledgements\n- `gen2.py`, `hdr_parser.py`, and `c_src/erlcompat.hpp` were directly copied from the `python` module in the [OpenCV repo](https://github.com/opencv/opencv). Changes applied.\n- `Makefile`, `CMakeLists.txt`, and `c_src/nif_utils.hpp` were also copied from the `torchx` module in the [elixir-nx repo](https://github.com/elixir-nx/nx). Minor changes applied.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocoa-xu%2Fevision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcocoa-xu%2Fevision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocoa-xu%2Fevision/lists"}