ResampleParams Table
The ResampleParams table contains properties used for resampling image pixels. The values in this data structure are used by various CImage class methods such as Scale and Rotate . Values in this structure must be passed to the script using the SetResampleParams function. Default resampling parameters are used unless you set them using this structure; see the Remarks section, below.
Data from the ResampleParams table may be set using the table name, ResampleParams , followed by a dot and the member name, like this: ResampleParams.bMedianEdge accesses the table member named bMedianEdge.
ResampleParams Table Members
bMedianEdge |
Specifies whether a blank image edge after resampling is filled with the median value of edge pixels (true) or uses the value of the sEdgeValue member (false). |
bConserveFlux |
If true, flux (signal per unit area) is conserved during geometric scaling. |
sEdgeValue |
Specifies the new edge value for blank pixels when the bMedianEdge is false. This is a string value, with the default “0”. If working with an RGB image, you can assign independent values to the 3 channels, like this: “100,214,55”. |
sFilter |
Specifies the resampling filter by the values “bi-cubic”. Only these values are supported. |
At startup, Mira sets default values for all ResampleParams members. The default values are as follows:
bMedianEdge = true
bConserveFlux = true
sEdgeValue = “0”
sFilter = ”bi-cubic”
Usually you use the same parameters for various processes that resample. If the defaults are not what you want, set the values and use SetResampleParams to change them in the script. You might do this in a separate source file and use Include at the beginning of your script..
Example 1. This script sets resampling parameters for use by the CImage:ScaleXy method. In particular, this script changes the edge value assignment, switches to bi-linear filtering, and does not conserve flux in the scaled image:
|
-- Alias the structure name to reduce typing |
|
-- force a specific value for blank edge pixels |
|
-- set blank edge pixels to a value of 100 |
|
-- do not conserve flux |
|
-- choose the bi-linear resampling method |
|
-- assign the parameters to the script |
|
-- attach an image from the CImageView |
|
-- scale the image, but do not conserve flux |
Example 2. Suppose you want to use the same resampling parameters all the time. To do the same thing using the Include() strategy (see Remarks, above), use the script below. The first script is saved in a file named ‘ResampleDefs.lua’ which is saved in the ‘[Mira]\Scripts\Include’ folder:
|
-- Alias the structure name to reduce typing |
|
-- force a specific value for blank edge pixels |
|
-- set blank edge pixels to a value of 100 |
|
-- do not conserve flux |
|
-- choose the bi-linear resampling method |
|
-- assign the parameters to the script |
You can include ‘ResampleDefs.lua’ into your scripts, like this:
|
-- include the resampling parameters |
-- do some processing: |
|
|
-- attach an image from the CImageView |
|
-- scale the image, but do not conserve flux |
|
-- rotate the image using same resampling |
SetResampleParams, CImage Class, Image Geometry commands
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.