Segmentation Package

Segmentation Package

ColorSegmentation Module

class SimpleCV.Segmentation.ColorSegmentation.ColorSegmentation

Bases: SimpleCV.Segmentation.SegmentationBase.SegmentationBase

Perform color segmentation based on a color model or color provided. This class uses ColorModel.py to create a color model.

addImage(img)
Add a single image to the segmentation algorithm
addToModel(data)
getRawImage()
Return the segmented image with white representing the foreground and black the background.
getSegmentedBlobs()
return the segmented blobs from the fg/bg image
getSegmentedImage(whiteFG=True)
Return the segmented image with white representing the foreground and black the background.
isError()
Returns true if the segmentation system has detected an error. Eventually we’ll consruct a syntax of errors so this becomes more expressive
isReady()
Returns true if the camera has a segmented image ready.
reset()
Perform a reset of the segmentation systems underlying data.
resetError()
Clear the previous error.
subtractModel(data)

DiffSegmentation Module

class SimpleCV.Segmentation.DiffSegmentation.DiffSegmentation(grayOnly=False, threshold=(10, 10, 10))

Bases: SimpleCV.Segmentation.SegmentationBase.SegmentationBase

This method will do image segmentation by looking at the difference between two frames.

grayOnly - use only gray images. threshold - The value at which we consider the color difference to be significant enough to be foreground imagery.

The general usage is

>>> segmentor = DiffSegmentation()
>>> cam = Camera()
>>> while(1):
>>>    segmentor.addImage(cam.getImage())
>>>    if(segmentor.isReady()):
>>>        img = segmentor.getSegmentedImage()
addImage(img)
Add a single image to the segmentation algorithm
getRawImage()
Return the segmented image with white representing the foreground and black the background.
getSegmentedBlobs()
return the segmented blobs from the fg/bg image
getSegmentedImage(whiteFG=True)
Return the segmented image with white representing the foreground and black the background.
isError()
Returns true if the segmentation system has detected an error. Eventually we’ll consruct a syntax of errors so this becomes more expressive
isReady()
Returns true if the camera has a segmented image ready.
reset()
Perform a reset of the segmentation systems underlying data.
resetError()
Clear the previous error.

RunningSegmentation Module

class SimpleCV.Segmentation.RunningSegmentation.RunningSegmentation(alpha=0.69999999999999996, thresh=(20, 20, 20))

Bases: SimpleCV.Segmentation.SegmentationBase.SegmentationBase

RunningSegmentation performs segmentation using a running background model. This model uses an accumulator which performs a running average of previous frames where: accumulator = ((1-alpha)input_image)+((alpha)accumulator)

addImage(img)
Add a single image to the segmentation algorithm
getRawImage()
Return the segmented image with white representing the foreground and black the background.
getSegmentedBlobs()
return the segmented blobs from the fg/bg image
getSegmentedImage(whiteFG=True)
Return the segmented image with white representing the foreground and black the background.
isError()
Returns true if the segmentation system has detected an error. Eventually we’ll consruct a syntax of errors so this becomes more expressive
isReady()
Returns true if the camera has a segmented image ready.
reset()
Perform a reset of the segmentation systems underlying data.
resetError()
Clear the previous error.

SegmentationBase Module

class SimpleCV.Segmentation.SegmentationBase.SegmentationBase

Bases: object

Right now I am going to keep this class as brain dead and single threaded as possible just so I can get the hang of abc in python. The idea behind a segmentation object is that you pass it frames, it does some sort of operations and you get a foreground / background segemnted image. Eventually I would like these processes to by asynchronous and multithreaded so that they can raise specific image processing events.

addImage(img)
Add a single image to the segmentation algorithm
getRawImage()
Return the segmented image with white representing the foreground and black the background.
getSegmentedBlobs()
return the segmented blobs from the fg/bg image
getSegmentedImage(whiteFG=True)
Return the segmented image with white representing the foreground and black the background.
isError()
Returns true if the segmentation system has detected an error. Eventually we’ll consruct a syntax of errors so this becomes more expressive
isReady()
Returns true if the camera has a segmented image ready.
classmethod load(fname)
load segmentation settings to file.
reset()
Perform a reset of the segmentation systems underlying data.
resetError()
Clear the previous error.
save(fname)
Save segmentation settings to file.

Table Of Contents

Previous topic

MachineLearning Package

Next topic

Shell Package

This Page