CStats:SetRect
The SetRect method assigns a CRect object to the CStats object. Statistics will be measured inside this rectangular region.
CStats:SetRect( CRect ) |
|
Suppose a CImage I holds a valid image and that a CRect R exists. The following script fragment initializes CStats for computing statistics inside the rectangle R on the image I:
S = CStats:new() |
-- create a CStats object |
S:SetImage( I ) |
-- specify the CImage to be measured |
S:SetRect( R ) |
-- specify the CRect to be measured |
mean, sdev = S:MeanSdev() |
-- returns the mean and standard deviation |
S:delete() |
-- when done with S, remove it from memory |