README.md

# cimg_ex
Light-weight image processing module in Elixir with CImg. This module aims to
create auxiliary routines for Deep Learning.

Note: It still has a few image processing functions currentrly.

### Design detail
The entity of the image handled by CImg is on the NIF side. On Elixir, the
reference to the image generated by NIF is stored in the %CImg{} structure. You
cannot read out the pixels of the image and process it directly, instead you
can use the image processing functions provided in CImg module.

The image will be assigned to Erlang Resource by NIF, so the image will
automatically be subject to garbage collection when it is no longer in use.

This is a very important point. Some of the functions in CImg module
immutably rewrite the original image. I recommend you to make a duplicate of
the image before performing the image processing. 

## Platform
It has been confirmed to work in the following OS environment.

- Windows MSYS2/MinGW64
- WSL2/Ubuntu 20.04

## Requirements
The following libraries are required to display images on the PC screen.

- GDI32 on Windows
- X11 on Linux

## Installation
Add following dependency to your `mix.exs`.

```elixir
def deps do
  [
    {:cimg, "~> 0.1.3"}
  ]
end
```

and install dependencies:

```shell
$ mix deps.get
$ mix deps.compile
```

## Demo
There is a simple program in demo directory. You can do it by following the steps below.

```shell
$ cd demo
$ mix deps.get
$ mix run -e "CImgDemo.demo1"
```

Close the appaired window, and stop the demo program.

Another demo:

```shell
$ mix run -e "CImgDemo.demo2"
```

```shell
$ mix run -e "CImgDemo.demo3"
```

## License
cimg_ex is licensed under the Apache License Version 2.0.

#### -- license overview of included 3rd party libraries --
- The "CImg" Library is licensed under the CeCILL-C/CeCILL.
- The "stb" - single-file public domain libraries for C/C++ - is public domain or MIT licensed.