CImCombine:Range CImCombine:Sdev

CImCombine:RgbMerge


The RgbMerge method creates a new RGB color image by merging R, G, and B channel images from the first 3 members of a CImageSet.

Syntax

CImage = CImageSet:RgbMerge( CImageSet )

    CImageSet contains the R, G, and B channel images (the order R, G, B is important).

    On success, this method returns the merged color image as a new CImage.

    On failure, this method returns nil.

Example

Suppose that 3 CImage objects exist with names R,G, and B and have the same dimensions (the DimEq method can be used to test this before merging). The following script fragment merges these images into an RGB image:

 

S = CImageSet:new()

-- create an image set to hold the images

S:Append(R)

-- add channel images to the image set

S:Append(G)

 

S:Append(B)

 

C = CImCombine:new()

-- create a CImCombine object

I = C:RgbMerge( S )

-- merge the channels and return a new CImage

S:delete()

-- delete S if no longer needed

C:delete()

-- delete C if no longer needed

Related Topics

CImCombine, RgbExtract