IMcOperationsAvg Method
|
|
Averages 2 images, an image and a number, or a list of images.
Namespace:
MediaCy.IQL.Operations
Assembly:
MediaCy.IQL.Operations (in MediaCy.IQL.Operations.dll) Version: 10.0.6912.0
SyntaxFunction Avg (
vOperand2 As Object,
Optional Flags As mcImageCreateFlags = mcImageCreateFlags.mcicfDefault,
<OptionalAttribute> vOperand1 As Object
) As McImage
Parameters
- vOperand2
- Type: SystemObject
Second operand of the operation: McImage, number
(array of numbers for color images), or an array of McImage or
McRegionAccess instances. - Flags (Optional)
- Type: MediaCy.IQL.EnginemcImageCreateFlags
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. - vOperand1 (Optional)
- Type: SystemObject
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 McImage or McRegionAccess
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.
Return Value
Type:
McImageThe 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.
RemarksA 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.
For floating point image types, the stored results may exceed the bounds
of the current destination McImage.RangeMin to McImage.RangeMax. These
range properties are not changed automatically.
Examples
ThisApplication.ActiveImage.Op.Avg Images(0)
ReDim varrImages(0 To Images.Count - 2) As Variant
Dim nIm As Long
For Each varImage In ThisApplication.Images
If Not varImage Is ThisApplication.ActiveImage Then
varrImages(nIm) = varImage.Name
nIm = nIm + 1
End If
Next varImage
ThisApplication.ActiveImage.Op.Avg varrImages
ReDim arrImages(0 To ThisApplication.Images.Count - 1) As McImage
Dim nI As Long
nI = 0
For Each varImage In Images
Set arrImages(nI) = varImage
nI = nI + 1
Next varImage
Dim globalOp As McOperations
Set globalOp = CreateOperator("McOperations")
globalOp.Avg arrImages
Set globalOp = Nothing
See Also