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 )

where

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

    CImage is a new CImage that contains a color image. On failure, nil is returned.

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 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

ExtractChan

CImCombine class