Skip to the content.
English 한국어 日本語 Tiếng Việt

Elixir example

https://github.com/bobhyun/TS-ANPR/tree/main/examples/Elixir/anpr

1. Copying the Engine Files

[Note] In this example, the engine file is extracted to the examples/bin/ directory to share it with other examples. However, for actual deployment, the engine file is typically copied to the directory where the application’s executable file is located.

2. Prerequisites

  1. Install Elixir (version 1.14 or later recommended)

    Windows:

    # Using Chocolatey
    choco install elixir
    
    # Or download from https://elixir-lang.org/install.html#windows
    

    Linux:

    # Ubuntu/Debian
    sudo apt-get install elixir
    
    # Oracle Linux / RHEL / CentOS
    sudo dnf install elixir || sudo yum install elixir
    # Tip: If elixir is not found, enable EPEL or use Erlang Solutions repo
    
  2. Install C compiler (required for building NIF)

    Windows:

    • Install Visual Studio with C++ development tools, or
    • Install MinGW-w64: choco install mingw

    Linux:

    # Ubuntu/Debian
    sudo apt-get install build-essential
    
    # Fedora/CentOS
    sudo yum groupinstall "Development Tools"
    
  3. Verify installation

    elixir --version
    mix --version
    gcc --version  # or cl.exe on Windows with Visual Studio
    

3. Build and Run

  1. Navigate to the Elixir example directory

    cd examples/Elixir/anpr
    
  2. Build the NIF (Native Implemented Function) library

Windows:

Open “x64 Native Tools Command Prompt for VS 2022” (or run vcvars64.bat) so cl/link are on PATH, then:

   build_nif.bat

This will:

Alternatively, if mix compile invokes nmake via elixir_make, it will use Makefile.win, which delegates to build_nif.bat to avoid quoting issues on Windows.

Linux:

   make priv/tsanpr_nif.so

This will:

  1. Install dependencies and compile the Elixir application

    mix deps.get
    mix compile
    

    This will:

    • Download dependencies (elixir_make)
    • Compile Elixir modules (anpr.ex, tsanpr.ex)
    • Copy the NIF library to _build/dev/lib/anpr/priv/
  2. Run the application

    # Using Mix
    mix run -e "ANPR.main()"
    
    # Or using iex (interactive)
    iex -S mix
    iex> ANPR.main()
    

4. Notes

Additional implementation notes:

5. Features

6. API Reference

TSANPR Module

The TSANPR module provides the following functions:

Initialization:

Core Functions:

Recognition Options

Output Formats

7. Troubleshooting

Library Loading Issues:

NIF Issues:

Platform-Specific Issues: