CImCombine:SetRelRect


The SetRelRect method defines a fractional dimension rectangle for sampling the image to compute the image normalization statistic.

Syntax

CImCombine:SetRelRect( CRect )

bullet.gif    CRect is the rectangle object containing percent values coordinates.

Remarks

The normalization region may be specified in absolute pixel coordinates (i.e., in terms of column number and row number) or in relative coordinates as a percentage of the image dimensions. The present method defines the rectangle in the percentage way. The advantage of this method is that the rectangle will always lie in the same relative position on any image. If you need to specify exact column and row positions, use the SetRect method instead.

The percentage rectangle is expressed in terms of width and position of the rectangle, ranging between 0 and 100% of the image size. These are encoded in the rectangle as CRect( width, x, height, y ). To specify a rectangle width of 10% of the image width, set width=10. To position the rectangle at the center of the image (i.e., at 50% of the width), set position=50. To set a rectangle of 20% of the width and 30% of the height, centered at 25% of the width and 75% of the height, use CRect( 20, 25, 30, 75 ).

Example

Suppose a CImageSet named S exists. The following script uses a CRect object to define the normalization region and then combines the images using the Mean method:

C = new_imcombine()

-- create a CImCombine object

R = new_rect(10,50,10,50)

-- central 10% of image

C:SetRelRect( R )

-- specify CImage and CRect to measure

C:SetNormStat("median")

-- use the median as the statistic

C:SetNormMethod("scale")

-- scale to normalize the image set

I = C:Mean( S )

-- combine image set and return new image

I:Display()

-- show the new image

C:delete()

-- when done with S, remove it from memory

Related Topics

CImCombine class, SetRect, CRect class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.