https://github.com/britzl/defold-imp
Defold native extension to apply filters to an image buffer
https://github.com/britzl/defold-imp
defold defold-library image-processing
Last synced: about 2 months ago
JSON representation
Defold native extension to apply filters to an image buffer
- Host: GitHub
- URL: https://github.com/britzl/defold-imp
- Owner: britzl
- License: mit
- Created: 2017-10-18T13:25:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-08T22:53:25.000Z (almost 8 years ago)
- Last Synced: 2025-06-19T15:09:13.303Z (about 1 year ago)
- Topics: defold, defold-library, image-processing
- Language: C++
- Size: 12.7 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-defold - Imp
README
# Imp
Defold native extension to perform image processing on an image [by doing a convolution between a kernel and the image](https://www.wikiwand.com/en/Kernel_%28image_processing%29).
## Installation
You can use Imp in your own project by adding this project as a [Defold library dependency](https://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:
https://github.com/britzl/defold-imp/archive/master.zip
Or point to the ZIP file of a [specific release](https://github.com/britzl/defold-imp/releases).
## Usage
#### imp.convolution(source, destination, width, height, kernel)
Perform a convolution between the kernel and the pixels of the source buffer and write the resulting values to the destination buffer. Edge handling is done by extending border pixels.
**PARAMETERS**
* ```source``` (buffer) - Source buffer to read pixels from (must contain a stream named "rgb" of type uint8)
* ```destination``` (buffer) - Destination buffer to write pixels to (must contain a stream named "rgb" of type uint8)
* ```width``` (number) - Width of source and destination buffers
* ```height``` (number) - Height of source and destination buffers
* ```kernel``` (table) - Table with 9 numbers describing the kernel. First value is top left, last value is bottom right.
## Example
There's an example in the examples folder. The example will use the camera if running on iOS or OSX and on other systems it will grab an image from Imgur.
[Try the HTML5 version (with Imgur image)](https://britzl.github.io/Imp/).