Image processing and computer vision in Rust.
It is a command line application that can:
- Binary morphology
- Dilate
- Erode
- Blur image
- Convert to gray
- Edge detection
- Invert color
- Load image and save it in different image format
- Macro commands / combined commands
- Rotate and flip image
- Skeleton
- Threshold with configurable limit
Setup Rust then:
git clone https://github.com/sami-badawi/shapelogic-rust.git
cd shapelogic-rust
cargo build
cargo test
./target/debug/shapelogic-rust --help
./target/debug/shapelogic-rust --file img/Lenna.jpg --out img/output -e png -t edge
open img/output.png
./target/debug/shapelogic-rust --file img/Lenna.jpg --out img/output -e bmp -t threshold -p 100
open img/output.bmp
./target/debug/shapelogic-rust --file img/shape.png --out img/output -e png -t skeleton -p false
Current list is:
blur, checkered, dilate, edge, erode, fliph, flipv, gray, invert, r270, r90, skeleton, sobel_h, sobel_v and threshold
To combine several commands use -m or --macro followed by semicolon separated commands.
./target/debug/shapelogic-rust --file img/Lenna.jpg --out img/output -e bmp --macro "edge;invert"
./target/debug/shapelogic-rust --file img/Lenna.jpg --out img/output -e bmp -m "edge;gray;invert;threshold 180"
./target/debug/shapelogic-rust --file img/Lenna.jpg --out img/output -e bmp -m "edge;gray;invert;threshold 180;erode"
- skeleton true
- threshold 180
Command skeleton takes true or false depending on dark or light background. Command threshold takes cutoff value.
The last macro command is what you would use to create a binary edge image that you could give to skeletonize algorithm.
Currently ShapeLogic Rust is a command line application. It has combined / macro commands. ShapeLogic Rust can do useful work. There are a few unit tests.
It has been remarkably easy to get started with Rust and image processing.
The Image library is simple, works great and is easy to extend.
- Resizing operations
- Port vectorize lines code from ShapeLogic Scala
- Figure out what deep learning library to use
- Figure out what to do about a GUI, possibly add web based GUI
This project is meant to investigate how easy it is do image processing and computer vision programming in Rust, in comparison to using Scala and TypeScript/WebGL.
All 3 are modern languages with very sophisticated type systems.
To begin with the GUI can be rudimentary.
- Single page web application, possibly based on work in ShapeLogic TypeScript
- Cursive / ncurses old but powerful GUI show image in browser
- Gtk or Gnome Rust bindings
- SDL2 game engine bindings
- Compile to WebAssembly and run in browser when compiler matures
These ideas are a little more involved.