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
CosolveActivity Class Reference

Class detects the state of the cosolve process. More...

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

Public Member Functions

def __init__ (self, imRegions)
 Constructor for simple puzzle scene activity detector. More...
 
def clearRobotActions (self)
 Clear the robot actions list. More...
 
def measure (self, StateCosolveInput y)
 
def measure_v2 (self, StateCosolveInput y)
 ALTERNATE: measure approach in test. More...
 
def process (self, x)
 Run entire processing pipeline. More...
 
def rosCallback (self, msg)
 ROS subscriber callback to store robot action. More...
 
- Public Member Functions inherited from PuzzleActivities
def measure (self, y)
 
- 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

 calibrated
 
 cfgTrack
 
 hand_threshold
 
 imRegions
 
 missingPieces
 
 piece_threshold
 
 puzzleBoardEstimate
 
 robot_action_threshold
 
 robotActions
 
 solMask
 
 soln
 
 theParams
 
 tracker
 
 unorg
 
 x
 
 z
 
 zonesMask
 
- Public Attributes inherited from PuzzleActivities
 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

Class detects the state of the cosolve process.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  imRegions 
)

Constructor for simple puzzle scene activity detector.

Parameters
[in]imRegionsLabel-type image.

Reimplemented from PuzzleActivities.

Member Function Documentation

◆ clearRobotActions()

def clearRobotActions (   self)

Clear the robot actions list.

◆ 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 PuzzleActivities.

◆ 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 PuzzleActivities.

◆ measure()

def measure (   self,
StateCosolveInput  y 
)
@brief  Compare image signal to empty solution board state.
@param[in]  y  StateCosolveInput

◆ measure_v2()

def measure_v2 (   self,
StateCosolveInput  y 
)

ALTERNATE: measure approach in test.

@brief  Extract useful details from the scene.
@param[in]  y  StateCosolveInput

◆ 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 PuzzleActivities.

◆ rosCallback()

def rosCallback (   self,
  msg 
)

ROS subscriber callback to store robot action.

Call this from your ROS subscriber.

Parameters
[in]msgpuzzAction ROS message

Member Data Documentation

◆ calibrated

calibrated

◆ cfgTrack

cfgTrack

◆ hand_threshold

hand_threshold

◆ imRegions

imRegions

◆ missingPieces

missingPieces

◆ piece_threshold

piece_threshold

◆ puzzleBoardEstimate

puzzleBoardEstimate

◆ robot_action_threshold

robot_action_threshold

◆ robotActions

robotActions

◆ solMask

solMask

◆ soln

soln

◆ theParams

theParams

◆ tracker

tracker

◆ unorg

unorg

◆ x

x

◆ z

z

◆ zonesMask

zonesMask

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