|  | 
| def | __init__ (self, thePuzzle, theSolution=None, thePlanner=None, theFig=None, shareFlag=True, theParams=ParamBasic) | 
|  | 
| def | addPiece (self, piece) | 
|  | 
| def | display (self, theImage=None, ID_DISPLAY=True, CONTOUR_DISPLAY=True, BOUNDING_BOX=True) | 
|  | 
| def | dragPieces (self, pVecs) | 
|  | 
| def | progress (self, gt_pAssignments) | 
|  | 
| def | rmPiece (self, id) | 
|  | 
| def | setPieces (self, pLocs) | 
|  | 
| def | takeAction (self, plan, verbose=False) | 
|  | 
| def | toImage (self, theImage=None, theMask=None, ID_DISPLAY=False, COLOR=(0, 0, 0), CONTOUR_DISPLAY=True, BOUNDING_BOX=True) | 
|  | 
| def | translateAction (self, pAssignments, piece_id) | 
|  | 
◆ __init__()
      
        
          | def __init__ | ( |  | self, | 
        
          |  |  |  | thePuzzle, | 
        
          |  |  |  | theSolution = None, | 
        
          |  |  |  | thePlanner = None, | 
        
          |  |  |  | theFig = None, | 
        
          |  |  |  | shareFlag = True, | 
        
          |  |  |  | theParams = ParamBasic | 
        
          |  | ) |  |  | 
      
 
@brief  Constructor for the class. Requires a puzzle board.
Args:
    thePuzzle: The puzzle board.
    theSolution: The solution board.
    thePlanner: The planner instance.
    theFig: The figure handle to use.
    shareFlag: Whether to share the board with the display.
    theParams: The params.
 
 
 
◆ addPiece()
      
        
          | def addPiece | ( |  | self, | 
        
          |  |  |  | piece | 
        
          |  | ) |  |  | 
      
 
@brief  Add puzzle piece instance to the board.
Args:
    piece: A puzzle piece instance.
 
 
 
◆ display()
      
        
          | def display | ( |  | self, | 
        
          |  |  |  | theImage = None, | 
        
          |  |  |  | ID_DISPLAY = True, | 
        
          |  |  |  | CONTOUR_DISPLAY = True, | 
        
          |  |  |  | BOUNDING_BOX = True | 
        
          |  | ) |  |  | 
      
 
@brief  Displays the current puzzle board.
Args:
    theImage: The image to insert pieces into. (optional)
    ID_DISPLAY: The flag indicating ID_DISPLAY or not.
    CONTOUR_DISPLAY: The flag indicating CONTOUR_DISPLAY or not.
    BOUNDING_BOX: The flag indicating display with a limited bounding box region or not.
 
 
 
◆ dragPieces()
      
        
          | def dragPieces | ( |  | self, | 
        
          |  |  |  | pVecs | 
        
          |  | ) |  |  | 
      
 
@brief  Moves pieces incrementally from where it is.
Args:
    pVecs: A dict of puzzle pieces ids and movement vector.
 
 
 
◆ progress()
      
        
          | def progress | ( |  | self, | 
        
          |  |  |  | gt_pAssignments | 
        
          |  | ) |  |  | 
      
 
@brief Check the status of the progress. (Return the ratio of the completed puzzle pieces)
@note
It is still a simplified function which assumes if a puzzle piece shares the
same id occupies the same place, then it is completed.
It is not always true when the rotation is not correct.
Args:
    gt_pAssignments: The ground truth assignment.
Returns:
    thePercentage: The progress.
 
 
 
◆ rmPiece()
@brief  Remove puzzle piece instance from the board.
Args:
    id: The puzzle piece id.
 
 
 
◆ setPieces()
      
        
          | def setPieces | ( |  | self, | 
        
          |  |  |  | pLocs | 
        
          |  | ) |  |  | 
      
 
@brief Sets the positions of pieces.
Args:
    pLocs: A dict of puzzle pieces ids and their locations.
 
 
 
◆ takeAction()
      
        
          | def takeAction | ( |  | self, | 
        
          |  |  |  | plan, | 
        
          |  |  |  | verbose = False | 
        
          |  | ) |  |  | 
      
 
@brief Perform the plan.
Args:
    plan: A tuple (piece_id, piece_index, action_type, action_param)
Returns:
    finishFlag: Signal indicating the end of plan.
 
 
 
◆ toImage()
      
        
          | def toImage | ( |  | self, | 
        
          |  |  |  | theImage = None, | 
        
          |  |  |  | theMask = None, | 
        
          |  |  |  | ID_DISPLAY = False, | 
        
          |  |  |  | COLOR = (0, 0, 0), | 
        
          |  |  |  | CONTOUR_DISPLAY = True, | 
        
          |  |  |  | BOUNDING_BOX = True | 
        
          |  | ) |  |  | 
      
 
@brief  Uses puzzle piece locations to create an image for
        visualizing them.  If given an image, then will place in it.
Args:
    theImage: The image to insert pieces into. (optional)
    theMask: The binary mask to remove hand/or other instances. (optional)
    ID_DISPLAY: The flag indicating ID_DISPLAY or not.
    COLOR: The color of the background.
    CONTOUR_DISPLAY: The flag indicating CONTOUR_DISPLAY or not.
    BOUNDING_BOX: The flag indicating display with a limited bounding box region or not.
Returns:
    theImage: The output image.
 
 
 
◆ translateAction()
      
        
          | def translateAction | ( |  | self, | 
        
          |  |  |  | pAssignments, | 
        
          |  |  |  | piece_id | 
        
          |  | ) |  |  | 
      
 
@brief Translation based on the current match and self.matchSimulator
Args:
    pAssignments: The planner's match.
    piece_id: Index of the piece in the planner's board.
Returns:
    piece_id: Updated ID of the piece.
 
 
 
◆ canvas
◆ fig
◆ matchSimulator
◆ params
◆ planner
◆ puzzle
◆ shareFlag
◆ solution
The documentation for this class was generated from the following file:
- /local/source/python/puzzle_solver/puzzle/simulator/basic.py