Description

Averages 2 images, an image and a number, or a list of images.

Return Type

A McImage object.  

The destination, averaged, McImage. This will be a new image if vOperand2 is given as an array of McImage or McRegionAccess instances, otherwise it will be the parent image or vOperand1 if there is no parent.

Syntax

object.Avg (vOperand2, [Flags], [vOperand1])

The Avg Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McOperations.
vOperand2Required. A Variant value.

Second operand of the operation: IMcImage, number (array of numbers for color images), or an array of IMcImage or IMcRegionAccess instances.

FlagsOptional. A mcImageCreateFlags enumeration, as described in settings.

Optional image creation flags for the new image if vOperand2 is given as an array of McImage or McRegionAccess instances. By default the value is zero, which creates a visible image that is part of the Images collection. See mcImageCreateFlags for the list of supported flags.

vOperand1Optional. A Variant value.

Optional first image operand (operator applies to parent image when parameter is omitted), or a number (an array of numbers for color images). This image must be given if there is no parent image, unless vOperand2 is given as an array of IMcImage or IMcRegionAccess instances. If given, this image determines the type of the resulting average; other images are cast to this type, honoring the Conversion property. If not given, then the destination type is that of the parent image or the first image in the vOperand2 array if there is no parent.

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

A conversion is performed on vOperand2 so that it has the same type as the destination image (vOperand1 if it is given, the parent image otherwise). The conversion rules are defined by the value of the Conversion property.

For 2 images or 1 image and a number, the result is:

( Parent image [or vOperand1] + vOperand2 ) / 2

which is stored in the parent image or vOperand1 if there is no parent.

When vOperand2 is an array of images, the result is:

( Parent image [or vOperand1] + vOperand2[0] + vOperand2[1] + ...) / ( Size (vOperand2) + 1 )

and a new image is returned.

If an array of images (or McRegionAccess instances) is supplied, then the returned image will have as many frames as the shortest ActiveFrameRange in any of the images, and its size will be the smallest size of the sizes of the Aoi of any of the sources.