Active contours is an iterative algorithm used for finding object boundaries.
The program is written in C++ as a command-line utility that uses OpenCV for image processing tasks and displaying results.
It supports both images and videos.
- C++
- OpenCV
- Cmake, Make
mkdir build & cd build
cmake ../
make
./build/src/snakes_run --image data/coin.jpeg --windowSize 10 --offsetROI 60 --numPoints 40 --weightSmoothness 0.1 --weightElasticity 0.1
./build/src/snakes_run --video data/red_car.mkv --colorOfInterestRGB 240,10,70 --morphDilate true --morphErode true --numPoints 30
High smoothness, low elasticity:
./build/src/snakes_run --image data/four_circles.png --windowSize 10 --offsetROI 60 --numPoints 40 --weightSmoothness 0.1 --weightElasticity 0.0001
./build/src/snakes_run --image data/four_circles.png --windowSize 10 --offsetROI 60 --numPoints 40 --weightSmoothness 0.0001 --weightElasticity 0.1
The following arguments are supported:
- --video string Path to the target video
- --image string Path to the target image
- --offsetROI int The initialization position of the contour as the distance from the images' border (default 150)
- --numPoints int The number of control points of a contour (default 30)
-
--windowSize int The size of window
$W$ around control point$v_i$ in pixels (default 28) - --weightElasticity double The weight controlling the importance of elasticity in the total sum of energies (default 0.000001)
- --weightSmoothness double The weight controlling the importance of smoothness in the total sum of energies (default 0.01)
- --colorOfInterestRGB int,int,int If set, all colors except this one are replaced with black (no default)
- --morphDilate bool Whether to dilate the image (default false)
- --morphSizeDilate int The size of morphing element (default 24)
- --morphErode bool Whether to erode the image (default false)
- --morphSizeErode int The size of morphing element (default 12)
- --sleep int The wait interval between frames (default 1)