CImage:Pow
The Pow method raises the image pixels to a power. The power is defined by an exponent which may be a specific value or may be the pixels of another image array of identical dimensions.
bSuccess = CImage:Pow( nExponent )
bSuccess = CImage:Pow( CImage2 )
where
nExponent is the power to raise the image pixels.
CImage2 is a CImage in which each pixel acts as an exponent.
bSuccess is the returned success code. On success it is true, otherwise false.
This method has a possibility of an illegal operation if a negative pixel value is raised to a non-integral power. Mira traps this condition and substitutes a replacement value into the output pixel. The replacement value is set for math operations using the SetMathErrVal method.
Suppose an image is displayed in a CImageView named V. The following script raises the pixel values to the 1/4 power and redisplays the result:
|
-- attach the current displayed image |
|
-- perform the operation |
|
-- update the display after the shift |
The following script selects two images from the same CImageView window. It then raises each pixel of the first image I to an exponent defined by each pixel of a second image E. Assume that I is the image currently displayed.
|
-- attach the current image (which is image set member 1) |
|
-- attach the second image from image set member 2 |
|
-- perform the operation |
|
-- update the display after the shift |
The following script does the same thing using math operators from the CImage class:
|
-- attach the current image (which is image set member 1) |
|
-- attach the second image from image set member 2 |
|
-- perform the operation |
|
-- update the display after the shift |
The previous example could be made more compact, like this:
|
-- do everything |
|
-- update the display after the shift |