CImage:ColToTable
The ColToTable method copies the pixels of a CImage column into a 1-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. The inverse operation, pasting a column into a CImage, is done using the TableToCol method.
lua_table = CImage:ColToTable(nCol)
lua_table = CImage:ColToTable(nCol, nRowMax)
lua_table = CImage:ColToTable(nCol, nRowMin, nRowMax)
nCol is the column number
nRowMin is the minimum row to extract.
nRowMax is the maximum row to extract.
lua_table is a 1--dimensional array.
On failure, nil is returned.
The following script creates a 1-dimensional table consisting of image column 40. The number of table elements equals the number of rows in the image:
|
-- create a CImage object |
-- fill the image or open it from a file... |
|
|
-- create a lua_table from column 40 |
The next script creates a 1-dimensional table consisting of image column 40 over rows 200 to 300. The table will have 101 elements:
|
-- create a CImage object |
-- fill the image or open it from a file... |
|
|
-- create a lua_table from the image pixels. |
CImage class, RowToTable, RectToTable, ToTable, arraytoimage, TableToCol, Table and Array Functions
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.