IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
Public Member Functions | Public Attributes | List of all members
centroidMulti Class Reference
Inheritance diagram for centroidMulti:
Inheritance graph
[legend]
Collaboration diagram for centroidMulti:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, iPt=None, params=CfgCentMulti())
 Centroid track-pointer constructor. More...
 
def get (self, fname)
 Get parameter of the tracker. More...
 
def measure (self, I)
 Measure the track point from the given image. More...
 
def process (self, I)
 Process the input image according to centroid tracking. More...
 
def regionProposal (I)
 Find out the centroid for multiple objects. More...
 
def set (self, fname, fval)
 Set parameters for the tracker. More...
 
- Public Member Functions inherited from centroid
def adapt (self)
 Adapt internal tracking parameters. More...
 
def correct (self)
 Correct track state based on predication and measurement. More...
 
def display_cv (self, I, ratio=None, window_name="track point ")
 Use opencv display routines to plot the trackpoint along with the given image. More...
 
def displayDebugState (self, dbstate=None)
 Displays internally stored intermediate process output. More...
 
def displayState (self, dstate=None, ax=None)
 Displays the current track pointer measurement. More...
 
def emptyState (self)
 Return an empty state structure (in python a dataclass). More...
 
def getState (self)
 Return the track-pointer state. More...
 
def offset (self, dp)
 Apply a vector offset to the track point. More...
 
def predict (self)
 Predict next track state based on current track state. More...
 
def setIfMissing (self, params, pname, pval)
 Set missing parameters in the registration parameters structure. More...
 
def setState (self, dPt)
 Use a track state element to define internal track state. More...
 
def transform (self, g)
 Apply a Lie group transformation (linear/affine) to the track point. More...
 

Public Attributes

 haveMeas
 
 labelIm
 
 labelImage
 
 tpt
 
 trackProps
 
- Public Attributes inherited from centroid
 haveMeas
 
 params
 
 tpt
 

Detailed Description

@ingroup  TrackPointer
@brief    Used to track the centroid of multiple (binarized) objects.
 
Performs tracking of multiple objects by computing their centroids.
 
There are two ways to perform centroid tracking.  One is to presume
that the object to track has already been binarized and it is simply a
matter of computing the centroid.  The other is that the binarization
needs to first be computed, then the centroid calculated.  If
binarization of the input is desired, use an ``improcessor`` to perform the
binarization as a pre-processing step.  If the binarization is too
complicated for an improcess procedure, then write a tracker wrapper around
the binarization + tracking combination. It will usually then become a
``perceiver`` object.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  iPt = None,
  params = CfgCentMulti() 
)

Centroid track-pointer constructor.

Parameters
[in]paramsParameter settings.
[in]iPtInitial track point coordinates.
Todo:
Should swap order if initial point is optional but params have non-trivial definition if not given. Really, should have a None check instead. Why was this particular choice made? Seems to lack flexibility or is it related to best practice?

Reimplemented from centroid.

Member Function Documentation

◆ get()

def get (   self,
  fname 
)

Get parameter of the tracker.

Parameters
[in]fnameName of parameter.
[out]fvalValue of parameter.
Todo:
Not coded, just the stub.

Reimplemented from centroid.

◆ measure()

def measure (   self,
  I 
)

Measure the track point from the given image.

Parameters
[in]IThe input image.
[out]mstateMeasured state, if desired as output.

Reimplemented from centroid.

◆ process()

def process (   self,
  I 
)

Process the input image according to centroid tracking.

Parameters
[in]IThe input image.

Reimplemented from centroid.

◆ regionProposal()

def regionProposal (   I)

Find out the centroid for multiple objects.

Parameters
[in]IThe input mask image.
Note
Code here is horrendous. What is purpose here? There are better methods. Even the stackoverflow link in code (below) has one. 08/03 PAV.
Original code can be implemented with scikit labels. Note that regionprops assumes different areas are with different labels. See https://stackoverflow.com/a/61591279/5269146

◆ set()

def set (   self,
  fname,
  fval 
)

Set parameters for the tracker.

Parameters
[in]fnameName of parameter. fval Value of parameter.
Todo:
Not coded, just the stub.

Reimplemented from centroid.

Member Data Documentation

◆ haveMeas

haveMeas

◆ labelIm

labelIm

◆ labelImage

labelImage

◆ tpt

tpt

◆ trackProps

trackProps

The documentation for this class was generated from the following file: