CMeasurePoints:Add


The Add method adds a point marker to the image and reports measurements of its coordinates and pixel value. The Point Measurement toolbar is opened if not already open. See the toolbar description in the Mira User's Guide.

Syntax

bSuccess = CMeasurePoints:Add( Image_obj, x, y )

bullet.gif    where Image_obj is a CImage object.

bullet.gif    x and y are the coordinates of the point.

bullet.gif    On success, bSuccess is returned as true.

Example

Suppose a CImage object I exists. The following script creates a new CMeasurePoints object and measures its coordinates and pixel value. The passed coordinates are updated to the local centroid position by setting properties in the PointParams table.

P = new_measurepoints()

-- create a new CMeasurePoints object

 

 

Params =

 -- PointParams properties to change

{

  

  bSetColor = true,

 

  sColor = "0,255,0",

 

  bSetLineThk = true,

 

  nLineThk = 1.5,

 

  bSetCentroid = true,

-- centroid the point

  bCentroid = true,

-- centroid the point

}

  

P: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

 

if V:Count() > 1 then

  

  I = CImage:AttachFromList( V )

-- pick the image from CImageView V

  Assert( I, "No Images available")

 -- exit if no image

else

 

  I = V:GetImage()

-- pick the only image in the window

end

 

x = 300; y = 205

-- initial coordinates of the point

bSuccess = P:Add( I, x, y )

-- Add the measurement to the image

Related Topics

CMeasurePoints class, PointParams Table

 


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