Combining Images using Criteria
The CImCombine class combines images referenced by a CImageSet object. Often, images being combined must be chosen from a larger set using some selection criteria before being combined. For example, it is required that images being combined have the same dimensions. Suppose the image set contains a mixture of images having different dimensions. To combine them requires creating an auxiliary image set that contains only those images that meet the criterion of having equal dimensions. Examples of other selection criteria include having equal exposure time, similar mean value, or using the same optical filter.
Suppose that a CImageSet named ImSet exists and contains many CImage objects. However, you want to combine only the particular images that meet specific criteria. In general, the following strategy is used to perform this task:
Create an auxiliary image set using the CImageSet class. Into this set will be inserted a reference to each image that matches the selection criteria. This does not mean that the images are duplicated, just that a "pointer" to each selected image is stored in the auxiliary set.
Create a CImCombine object for combining the selected images.
Using the original image set, test each image for matching the selection criteria. For each image that passes the test, save a reference to it (i.e., a "pointer") into the auxiliary image set. Use the CImCombine:Append method to save each image pointer into the auxiliary image set.
Use CImCombine methods to combine the images in the auxiliary image set.
Delete the auxiliary image set when it is no longer needed.
The procedure outlined above is implemented in the example, below.
The following script creates an auxiliary image set containing images chosen from the original image set. In this example, images are combined if their dimensions match those of the first image. To keep the script simple, only a simple mean value combining is used.
|
-- choose the reference image |
|
-- be sure it exists, exit if not |
|
-- create an auxiliary image set |
|
-- add the first image to the image set |
|
-- test each of the images 2 through n |
|
|
|
-- check the pointer and if dimensions match |
|
-- Add to the auxiliary image set |
|
|
|
|
|
-- create an image combining object |
|
-- (the default case uses no normalization) |
|
-- combine S and return a new CImage Icomb |
|
--delete the combining object if no longer needed |
|
-- delete the new image set, if not needed |
CImCombine class, CImageSet class, CImage class
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.