Description

Extracts the background from an image.

Return Type

A McImage object.  

A new IMcImage.

Syntax

object.ExtractBackground (ObjectSize, [BrightOnDark], [Flags], [vSourceImg])

The ExtractBackground Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McMorpho.
ObjectSizeRequired. A Long value.

Approximate width (minimum diameter) of the object, in pixels.

BrightOnDarkOptional. A Boolean value.

If True, the image instance has bright objects on a dark background. If False, the image instance has dark objects on a bright background.

FlagsOptional. A mcImageCreateFlags enumeration, as described in settings.

A combination of mcImageCreateFlags used in creation of the output image

vSourceImgOptional. A Variant value.

Optional input IMcImage or IMcRegionAccess.

Settings

The settings for Flags are:

ConstantValueDescription
 mcicfDefault0
 mcicfContiguous1

If set, frames are allocated contiguously, and you cannot add to the FrameCount at a later time.

 mcicfNoInit2

Default is to initialize to 0 (black), this flag suppresses initialization.

 mcicfNoAddToCollection4

If set, the image is created, but not added to the collection (see Notes).

 mcicfNotVisible8

If set, the image is created, possibly added to collection (see above), but not made visible.

 mcipfNoImportProperties8388608

Suppress ImportProperties for functions creating an image from another.

Remarks

This filter always creates a new image to store its results. ObjectSize should be large enough to represent the largest object. If the source image has multiple frames and has UseActiveFrameRange set, the result will also have multiple frames. This may be useful to check the result for the frame with the least structure. Alternatively, the “best” frame from which to extract the background can be predetermined, a region access opened on that single frame, and that region access passed in as vSourceImg.

Exceptions

The exception mceINVALIDARG (E_INVALIDARG) will be thrown if one of the parameters is invalid.