Skip to content

LadaOndris/active-contours

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Active contours

Description

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.

Prerequisites

  • C++
  • OpenCV
  • Cmake, Make

Compilation

mkdir build & cd build  
cmake ../
make

Examples

Detecting a coin in an image

./build/src/snakes_run --image data/coin.jpeg --windowSize 10 --offsetROI 60 --numPoints 40 --weightSmoothness 0.1 --weightElasticity 0.1

coin

Tracking a red car in a video

./build/src/snakes_run --video data/red_car.mkv --colorOfInterestRGB 240,10,70 --morphDilate true --morphErode true --numPoints 30

red_car

Experimenting with different weights

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

four_circles

Low smoothness, high elasticity:
./build/src/snakes_run --image data/four_circles.png --windowSize 10 --offsetROI 60 --numPoints 40 --weightSmoothness 0.0001 --weightElasticity 0.1

four_circles

Program arguments

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)

Releases

No releases published

Packages

No packages published