CStats:SetImage
The SetImage method assigns a CImage and an optional CRect object to the CStats object. Statistics methods will measure this image and optional rectangle you specify unless a different data collection is specified in the method call (see the examples, below).
NOTE: This is a deprecated method provided only for compatibility with scripts written for MX Script version 7 or earlier. In new scripts, use the new argument list options in the CStats methods.
CStats:SetImage( CImage ) CStats:SetImage( CImage, CRect ) where |
CImage is a CImage object to measure using CStats class methods.
CRect is a CRect object to measure using CStats class methods. If not specified, the entire image is measured.
his example uses SetImage to define a CImage I and CRect R for measurement (both are preseumed to already exist). The following script measures various statistics for the same image and rectangle:
|
-- create a CStats object |
|
-- specify the image and rectangle to be measured |
|
-- return the mean and standard deviation |
|
-- return the contra mean for power 0.5 |
|
-- return the 40th rank percentile. |
The next example uses SetImage to define a CImage I for measurement. Since no CRect is defined, the entire image is measured:
|
-- create a CStats object |
|
-- specify the image to be measured |
|
-- return the mean and standard deviation |
|
-- return the contra mean for power 0.5 |
|
-- return the 40th rank percentile. |
The following script shows the new, preferred way to compute statistics without using SetImage to define the CImage and CRect:
|
-- create an image |
|
-- create a rectangle |
-- |
-- do something |
|
-- create a CStats object |
|
-- measure the entire image I |
|
-- measure I inside rectangle R |
|
-- measure I inside rectangle R |
|
-- measure a lua table |