CImExtract:GetSource
The GetSource method returns a table of properties for a source in an image extracted using the CImExtract class. The properties are returned as a table of type Source Properties table.
tblSource = CImExtract:GetSource( nSourceIndex, bUseIndex ) tblSource = CImExtract:GetSource( nSourceIndex ) |
nSourceIndex is the index of the source from the list of extracted sources, between 1 and CImExtract:Count.
bUseIndex is used to select whether the returned table is organized by property name or numeric index. If omitted or set to false, the source properties table is referenced by property name rather than its table index.
tblSource is a table containing the extracted properties of the source.
On failure, nil is returned
Suppose an image window exists on the Mira screen. The script below performs source extraction on an image from this window and then repeatedly uses GetSource to fetch the (x,y) coordinates from each source's Source Properties table.
Before calling Extract, the default configuration is updated using a ImExtractParams table. Note that your ImExtractParams table does not need to be named Params as shown here.
|
-- attach an image window |
|
-- leave script if no image window |
|
|
|
-- get the top-most or only image |
|
-- leave script if no image |
|
|
|
-- create a CImExtract object |
|
-- setup an ImExtractParams table |
|
-- use a comma after each "name=value" pair |
|
|
|
|
|
|
|
|
|
|
|
|
|
-- threshold value = 45 |
|
-- detect pixels >= threshold |
|
|
|
-- set new configuration properties |
|
|
|
-- extract sources from image I |
|
|
|
|
-- report the number of sources extracted: |
|
|
|
|
|
|
|
|
|
-- list the x,y coordinates for all sources: |
|
|
|
|
-- fetch the properties of source i |
|
|
|
|
CImExtract class, Count, Extract, Source Properties Table
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.