[](https://www.mathworks.com/matlabcentral/fileexchange/38358-active-geometric-shape-models)
6. [Copyright and Citation](#copyright-and-citation)
7. [Version History](#version-history)
---
## Overview
This software implements **Active Geometric Shape Models (AGSM)** for robust feature extraction and shape fitting. It supports:
- Line fitting
- Circle fitting
- Ellipse fitting
- Cubic spline fitting
AGSM leverages Gradient Vector Flow (GVF) and iterative force-based optimization to fit geometric primitives and flexible contours to image data.

## Installation
### Prerequisites
- MATLAB or GNU Octave
- C++ Compiler (for MEX file compilation)
### Compilation
Before using the library, you must compile the C++ MEX files. Run the `compile.m` script located in the `code` directory:
```matlab
cd code
compile
```
## Usage
The library includes several demo scripts to illustrate how to use the different fitting modules. You can find them in their respective directories under `code/`:
Signal Analysis and Machine Perception Laboratory,
Department of Electrical, Computer, and Systems Engineering,
Rensselaer Polytechnic Institute, Troy, NY 12180, USA
```
If you use this software for academic purposes, please cite our papers:
**Plain Text:**
> Quan Wang, Kim L. Boyer.
The active geometric shape model: A new robust deformable shape model and its applications.
Computer vision and image understanding 116, no. 12 (2012): 1178-1194.
> Quan Wang.
Exploiting Geometric and Spatial Constraints for Vision and Lighting Applications.
Ph.D. dissertation, Rensselaer Polytechnic Institute, 2014.
**BibTeX:**
```
@article{wang2012active,
title={The active geometric shape model: A new robust deformable shape model and its applications},
author={Wang, Quan and Boyer, Kim L},
journal={Computer vision and image understanding},
volume={116},
number={12},
pages={1178--1194},
year={2012},
publisher={Elsevier}
}
@phdthesis{wang2014exploiting,
title={Exploiting Geometric and Spatial Constraints for Vision and Lighting Applications},
author={Quan Wang},
year={2014},
school={Rensselaer Polytechnic Institute},
}
```
For commercial use, please contact the authors.
---
## Version History
### Version 2.4
1. Added comprehensive unit tests and continuous integration with Octave.
2. Better documentation and code format.
### Version 2.3
1. Robustness of closed contour fitting is dramatically improved by smart initialization (see InitialCircle.cpp).
2. Line fitting is compared to Hough transform and RANSAC least squares.
3. Circle fitting is compared to circle Hough transform.
### Version 2.2
1. We made the AGSM Canvas app more robust by smart initialization and image padding.
2. Only one app for both 64-bit Windows and 64-bit Mac.
### Version 2.1
1. We added the AGSM Canvas app, which is an interactive software.
### Version 2.0
1. We added the line fitting and circle fitting packages.
2. We re-implemented GVF in C++/MEX to make it much faster.
3. We implemented Bresenham algorithm in C++/MEX to generate points on a line.
4. All force/torque computations are re-implemented in C++/MEX, which significantly improves efficiency.
Cite As
Quan Wang (2026). Active geometric shape models (https://se.mathworks.com/matlabcentral/fileexchange/38358-active-geometric-shape-models), MATLAB Central File Exchange.
Retrieved .
Wang, Quan, and Kim L. Boyer. “The Active Geometric Shape Model: A New Robust Deformable Shape Model and Its Applications.” Computer Vision and Image Understanding, vol. 116, no. 12, Elsevier BV, Dec. 2012, pp. 1178–94, doi:10.1016/j.cviu.2012.08.004.
Wang, Quan, and Kim L. Boyer. “The Active Geometric Shape Model: A New Robust Deformable Shape Model and Its Applications.” Computer Vision and Image Understanding, vol. 116, no. 12, Elsevier BV, Dec. 2012, pp. 1178–94, doi:10.1016/j.cviu.2012.08.004.
APA
Wang, Q., & Boyer, K. L. (2012). The active geometric shape model: A new robust deformable shape model and its applications. Computer Vision and Image Understanding, 116(12), 1178–1194. Elsevier BV. Retrieved from https://doi.org/10.1016%2Fj.cviu.2012.08.004
BibTeX
@article{Wang_2012,
doi = {10.1016/j.cviu.2012.08.004},
url = {https://doi.org/10.1016%2Fj.cviu.2012.08.004},
year = 2012,
month = {dec},
publisher = {Elsevier {BV}},
volume = {116},
number = {12},
pages = {1178--1194},
author = {Quan Wang and Kim L. Boyer},
title = {The active geometric shape model: A new robust deformable shape model and its applications},
journal = {Computer Vision and Image Understanding}
}
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.