|
CImage:RectToTable
The RectToTable method copies the pixels
from a rectangular region of a
CImage into a 2-dimensional array. If the
CImage has a numeric pixel type (e.g., "ushort", "float",
etc.) then the array has numeric values. If the CImage has
an rgb pixel type, then the array has rgb strings as values, for
example "255,0,0" for pure red. See
Pixel Types. Note that this method does not work with
a 1-dimensional CImage. The inverse operation, pasting a
rectangle region into a CImage, is done using the
TableToRect method.
Syntax
lua_table = CImage:RectToTable(nColMin, nColMax,
nRowMin, nRowMax)
nColMin is the minimum column to extract.
nColMax is the maximum column to extract.
nRowMin is the minimum row to extract.
nRowMax is the maximum row to extract.
lua_table is a 2-dimensional array.
On failure,
nil is returned.
Remarks
The parameter order follows the standard order for
describing image sections: [nMinCol:nMaxCol,
nMinRow:nMaxRow]. Assuming the image has nCols total columns and nRows total rows, the specified limits are
automatically chopped at the limits [1:nCols,
1:nRows].
Examples
The following script copies a 2-dimensional image
rectangle [30:49,120:159] into a 2-dimensional array. The array
size is (49-30+1) * (159-120+1) = 20*40 = 800 elements:
|
I = new_image()
|
|
|
|
|
|
tbl =
I:RectToTable(30,49,120,159)
|
|
Related Topics
CImage class
ColToTable
RowToTable
ToTable
arraytoimage
TableToRect
Table and Array Functions
Mira Pro x64 Script User's Guide, v.8.76 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.
|