sightmachine/SimpleCV — pull request #453 by acrlakshman (2013-04-22 20:47:48+00:00)
Title: offsetContourPoints method added

Feature for ![#183](https://github.com/sightmachine/SimpleCV/issues/183)

Code: Blob.py
Function: offsetContourPoints()

Example:

img = Image("color.png")
blobs = img.findBlobs()
img.drawPoints(blobs[3].offsetContourPoints(offset=-10),color=Color.BLUE)

Documentation:

This function returns the contour points offset from original, as a list of x,y tuples. In this function original Bresenham's line algorithm is modified in a way such that points are populated by using slope of the line and initial starting location.

For original Bresenham's line algorithm see: ![http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm](http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm)

Examples:
In the following examples, points in blue are original contour points obtained using blob.contour(), points in green are obtained using positive value for offset in the function offsetContourPoints, where as pink points are computed using negative offset value.

![color_save](https://f.cloud.github.com/assets/2924807/411096/e2e9dc14-ab80-11e2-948e-d11625a94525.jpg)

![lines_save](https://f.cloud.github.com/assets/2924807/411098/ef78826e-ab80-11e2-8a5e-241cd7134553.jpg)

![040004_save](https://f.cloud.github.com/assets/2924807/411100/f57af32c-ab80-11e2-85ff-b3199813507a.jpg)