IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PuzzleActivities Class Reference

Simple puzzle activity monitor based on specified image regions. More...

Inheritance diagram for PuzzleActivities:
Inheritance graph
[legend]
Collaboration diagram for PuzzleActivities:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, imRegions)
 Constructor for simple puzzle scene activity detector. More...
 
def measure (self, y)
 
def process (self, x)
 Run entire processing pipeline. More...
 
- Public Member Functions inherited from imageRegions
def __init__ (self, imRegions=None, processor=None)
 Constructor for imageRegions class. More...
 
def addRegionByMask (self, regMask)
 Provide a masked region to use for defining a new state. More...
 
def addRegionByPolygon (self, regPoly, imsize=None)
 Add a region by specifying the polygon boundary. More...
 
def buildFromPolygons (imsize, thePolygons)
 Construct an imageRegions instance with provided polygon regions. More...
 
def calibrateFromPolygonMouseInputOverImageRGB (theImage, theFile, initRegions=None)
 Calibrate a region detector by requesting closed polygon input from user. More...
 
def emptyRegions (self)
 Delete regions image if exists and return to uninitialized state. More...
 
def initRegions (self, imsize)
 Initialize regions by providing target image dimensions. More...
 
def printState (self)
 Print current region detection state (as string). More...
 
def regions_close_cv (self, window_name="Activity Regions")
 Close the region image window. More...
 
def regions_display_cv (self, ratio=1, window_name="Activity Regions")
 Display the region image to see labels. More...
 
def saveTo (self, fPtr, relpath="activity.byRegion")
 Empty method for saving internal information to HDF5 file. More...
 
def setRegions (self, imRegions)
 Provide a label image where the pixel label indicates the raw activity label. More...
 
def specifyPolyRegionsFromImageRGB (self, theImage, doClear=False)
 Given an image, get user input as polygons that define the different regions. More...
 
def specifyRegionsFromMask (self, theMask, doClear=False)
 Given an image, get user input as point clicks that select mask regions. More...
 
def stringState (self)
 Convert current region detection state to string. More...
 
def wipeRegions (self)
 Clear the regions image. More...
 
- Public Member Functions inherited from fromState
def adapt (self)
 Adapt detection model, if implemented. More...
 
def correct (self)
 Correct detection state estimate, if implemented. More...
 
def detect (self, x)
 Perform detection only, which basically keeps the model static if it would normally update. More...
 
def getState (self)
 Get the current detection state estimate. More...
 
def predict (self)
 Predict detection state outcome, if implemented. More...
 
def saveTo (self, fPtr)
 Save configuration or other data to HDF5 file. More...
 
- Public Member Functions inherited from Base
def __init__ (self)
 Instantiate a detector Base activity class object. More...
 
def emptyDebug (self)
 Return empty debug state information. More...
 
def emptyState (self)
 Return empty state. More...
 
def getDebug (self)
 Return current/latest debug state information. More...
 
def save (self, fileName)
 Outer method for saving to a file given as a string. More...
 

Static Public Member Functions

def load (fileName, relpath=None)
 Outer method for loading file given as a string (with path). More...
 
def loadFrom (fptr, relpath="activity.byRegion")
 Inner method for loading internal information from HDF5 file. More...
 
- Static Public Member Functions inherited from Base
def loadFrom (fPtr)
 Empty method for loading internal information from HDF5 file. More...
 

Public Attributes

 z
 
- Public Attributes inherited from imageRegions
 imRegions
 Image regions array. More...
 
 isInit
 Flag specifying initialization state. More...
 
 lMax
 Max label associated to image regions. More...
 
 z
 
- Public Attributes inherited from fromState
 processor
 Pre-processor or similar. More...
 
 z
 The detection outcome. More...
 
- Public Attributes inherited from Base
 x
 Detection state. More...
 

Detailed Description

Simple puzzle activity monitor based on specified image regions.

Purpose of this class is to show how to integrate an activity detector into the puzzle scene monitor in a way compatible with the puzzle scene perceiver. For more specialized processing, create a sub-class.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  imRegions 
)

Constructor for simple puzzle scene activity detector.

Parameters
[in]imRegionsLabel-type image.

Reimplemented from fromState.

Reimplemented in SortActivity, SolveActivity, CosolveActivity, SolveActivity, SortActivityDepth, SortActivity, and CoSolveActivity.

Member Function Documentation

◆ load()

def load (   fileName,
  relpath = None 
)
static

Outer method for loading file given as a string (with path).

Opens file, preps for loading, invokes loadFrom routine, then closes. Overloaded to invoke coorect loadFrom member function.

Parameters
[in]fileNameThe full or relative path filename.
[in]relpathThe hdf5 (relative) path name to use for loading. Usually class has default, this is to override.

Reimplemented from imageRegions.

Reimplemented in SortActivity, SolveActivity, CosolveActivity, SolveActivity, SortActivityDepth, SortActivity, and CoSolveActivity.

◆ loadFrom()

def loadFrom (   fptr,
  relpath = "activity.byRegion" 
)
static

Inner method for loading internal information from HDF5 file.

Load data from given HDF5 pointer. Assumes in root from current file pointer location.

Reimplemented from imageRegions.

Reimplemented in SortActivity, SolveActivity, CosolveActivity, SolveActivity, SortActivityDepth, SortActivity, and CoSolveActivity.

◆ measure()

def measure (   self,
  y 
)
@brief  Compare signal to expected image region states.

@param[in]  zsig  The 2D pixel coords / 3D pixel coords + depth value.

Reimplemented from imageRegions.

Reimplemented in SolveActivity, SortActivityDepth, and SortActivity.

◆ process()

def process (   self,
  x 
)

Run entire processing pipeline.

The entire pipeline consists of predict, measure, correct, and adapt. At least if there is a measurement. If no measurement, then only predict is executed since there is no measurement to interpret, correct, and adapt with.

Reimplemented from fromState.

Reimplemented in SortActivity, SolveActivity, CosolveActivity, SolveActivity, SortActivityDepth, SortActivity, and CoSolveActivity.

Member Data Documentation

◆ z

z

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