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

Solution board stores information about the solution board. More...

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

Public Member Functions

def __init__ (self, *argv)
 Constructor for puzzle solution board. More...
 
def addPieceFromMaskAndImage (self, theImage, theMask, centroidLoc=None, cLoc=None, zone=0)
 : Overrides parent method with zone value More...
 
def createBoardByStatus (self, recordedBoard, status)
 : Create a partial board from the recorded board based on the status More...
 
def createBoardByZone (self, recordedBoard, zone, checkStatus=None)
 Create a partial board from the recorded board based on zone and status. More...
 
def createPartialBoard (self, recordedBoard, np.ndarray solutionStateMask, threshold=0.5)
 Create a partial board from the recorded board and solution state mask. More...
 
def setPieceStatus (self, solutionMask, threshold=0.5)
 : Method to iterate through piece locations and set the status of the solution board pieces. More...
 
- Public Member Functions inherited from Board
def addPiece (self, piece, ORIGINAL_ID=False)
 Add puzzle piece instance to the board. More...
 
def addPieceFromMaskAndImage (self, theImage, theMask, centroidLoc=None, cLoc=None)
 Given a mask and an image of same base dimensions, use to instantiate a puzzle piece template. More...
 
def addPieces (self, pieces)
 Add puzzle piece to board. More...
 
def boundingBox (self)
 Iterate through pieces to get tight bounding box. More...
 
def clear (self)
 
def display_cv (self, theImage=None, fh=None, ID_DISPLAY=False, CONTOUR_DISPLAY=False, BOUNDING_BOX=False, window_name='Puzzle')
 Display the puzzle board as an image using matplot library. More...
 
def display_mp (self, theImage=None, ax=None, fh=None, ID_DISPLAY=False, CONTOUR_DISPLAY=False, BOUNDING_BOX=True)
 Display the puzzle board as an image using matplot library. More...
 
def display_mp_expanded (self, theImage=None, ax=None, fh=None, ID_DISPLAY=False, CONTOUR_DISPLAY=False, BOUNDING_BOX=False)
 Display the puzzle board as an image using matplot library. More...
 
def extents (self)
 Iterate through puzzle pieces to get tight bounding box extents of the board. More...
 
def fromImageAndLabels (self, theImage, theLabels)
 
Template getPiece (self, id)
 Get puzzle piece instance based on id. More...
 
def markMissing (self, indSetMeasured)
 Given set of indices to measured pieces, mark remaining as unmeasured. More...
 
def offset (self, dr)
 Offset the location of the entire puzzle in the board. More...
 
def pieceLocations (self, isCenter=False)
 Returns list/array of puzzle piece locations. More...
 
def relabel (self, newLabels, idContinue)
 Relabel the puzzle piece IDs in the board using new label reassignments and adjust IDs for those without reassignment. More...
 
def rmPiece (self, id)
 
def size (self)
 Number of pieces on the board. More...
 
def testAdjacent (self, id_A, id_B, tauAdj)
 Check if two puzzle pieces are adjacent or not. More...
 
def toImage (self, theImage=None, ID_DISPLAY=False, COLOR=(0, 0, 0), ID_COLOR=(255, 255, 255), CONTOUR_DISPLAY=True, BOUNDING_BOX=True)
 Uses puzzle piece locations to create an image for visualizing them. More...
 
def toImageAndSegmentation (self, theImage=None, ID_DISPLAY=False, COLOR=(0, 0, 0), ID_COLOR=(255, 255, 255), CONTOUR_DISPLAY=False, BOUNDING_BOX=False)
 Render the board image together with an ID-labelled segmentation image. More...
 
def toImageExpanded (self, theImage=None, ID_DISPLAY=False, COLOR=(0, 0, 0), ID_COLOR=(255, 255, 255), CONTOUR_DISPLAY=True, BOUNDING_BOX=False)
 Uses puzzle piece locations to create an image for visualizing them. More...
 

Public Attributes

 zones
 
- Public Attributes inherited from Board
 id_count
 
 pieces
 

Detailed Description

Solution board stores information about the solution board.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
argv 
)

Constructor for puzzle solution board.

Can pass contents at instantiation time or delay until later.

Args: *argv: The input params.

Reimplemented from Board.

Member Function Documentation

◆ addPieceFromMaskAndImage()

def addPieceFromMaskAndImage (   self,
  theImage,
  theMask,
  centroidLoc = None,
  cLoc = None,
  zone = 0 
)

: Overrides parent method with zone value

◆ createBoardByStatus()

def createBoardByStatus (   self,
  recordedBoard,
  status 
)

: Create a partial board from the recorded board based on the status

Parameters
[in]

◆ createBoardByZone()

def createBoardByZone (   self,
  recordedBoard,
  zone,
  checkStatus = None 
)

Create a partial board from the recorded board based on zone and status.

Parameters
[in]recordedBoardThe recorded board to create the partial board from.
[in]zoneThe zone to filter pieces by.
[in]checkStatusExtract pieces of a certain status only in zone

◆ createPartialBoard()

def createPartialBoard (   self,
  recordedBoard,
np.ndarray  solutionStateMask,
  threshold = 0.5 
)

Create a partial board from the recorded board and solution state mask.

Parameters
[in]recordedBoardThe recorded board to create the partial board from.
[in]solutionStateMaskThe mask indicating the solution state.

◆ setPieceStatus()

def setPieceStatus (   self,
  solutionMask,
  threshold = 0.5 
)

: Method to iterate through piece locations and set the status of the solution board pieces.

Parameters
[in]solutionMask- a boolean / int mask for solution region
[in]threshold- threshold to determine if piece is present or not

Member Data Documentation

◆ zones

zones

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