CImage:RowToTable


The RowToTable method copies the pixels of a CImage row 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 row into a CImage, is done using the TableToRow method.

Syntax

lua_table = CImage:RowToTable(nRow)

lua_table = CImage:RowToTable(nRow, nColMax)

lua_table = CImage:RowToTable(nRow, nColMin, nColMax)

bullet.gif    nRow is the row number

bullet.gif    nColMin is the minimum column to extract.

bullet.gif    nColMax is the maximum column to extract.

bullet.gif    lua_table is a 1-dimensional array.

bullet.gif    On failure, nil is returned.

Examples

The following script creates a 1-dimensional table consisting of image row 212. The number of table elements equals the number of columns in the image:

I = new_image()

-- create a CImage object

-- fill the image or open it from a file...

 

tbl = I:RowToTable(40)

-- create a lua_table from row 40

  

The next script creates a 1-dimensional table consisting of image row 40 over columns 200 to 300. The table will have 101 elements:

I = new_image()

-- create a CImage object

-- fill the image or open it from a file...

 

tbl = I:RowToTable(40, 200, 300)

-- create a lua_table from row 40, column 200 to 300.

 

Related Topics

CImage class, ColToTable, RectToTable, ToTable, arraytoimage, TableToRow, Table and Array Functions


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.