new_imextract


The new_imextract function is a non-class version of the CImExtract:new method which creates and returns a new CImExtract object. You must call new before using any class methods or properties.

Syntax

C = new_imextract()

bullet.gif    Creates a default CImExtract object with properties initialized to default values.

C = new_imextract( Params )

bullet.gif    Creates a CImExtract object with default properties updated to values in the ImExtractParams Table, Params.

C = new_imextract( CImExtract_old )

bullet.gif    This is a copy constructor. It creates a new CImExtract object initialized to the members of theCImExtract_old argument.

Example

The following script creates a new CImExtract object, attaches an image window and an image, then extracts sources from that image. An ImExtractParams table is used to set several specific properties. Note that each table entries must include a comma.

M = new_imextract()

-- create a new CImExtract

 

 

Params =

 -- ImExtractParams properties to change

{

  

  bProcFilter = true,

 

  bFilterUseSepMin = true,

 

  nFilterSepMin = 10,

 

  bFilterUseAreaMax = true,

 

  nFilterAreaMax = 100,

 

  nBgMethod = 1,

 

  nDetectTreshold = 45,

-- threshold value = 45

  nDetectTest = 0,

-- use pixels greater than or equal to threshold

}

  

M:SetParams(Params)

  

 

 

V = attachlist_imageview()

-- connect to an image window

Assert( V, "No image window")

 -- exit if no image window

-- grab an image from the window, V

 

--DO NOT declare I as "local" inside the block

 

if V:Count() > 1 then

  

  I = CImage:AttachFromList( V )

-- pick the image from the CImageView V

  Assert( I, "No Images available")

 -- exit if no image

else

 

  I = V:GetImage()

-- pick the only image in the window

end

 

 

 

bSuccess = M:Extract(I)

-- run the image extraction procedure

Related Topics

CImExtract class, new, delete, ImExtractParams Table


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