|
IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
|
A puzzle piece clustering method based on color. More...


Public Member Functions | |
| def | __init__ (self, thePuzzle, extractor=Histogram(), theParams=ParamColorCluster) |
| Constructor for the byColor class. More... | |
| def | process (self) |
| Extract color features from the data. More... | |
| def | score (self, cluster_id_pred_dict, method='label') |
| Score the clustering result. More... | |
Public Member Functions inherited from Board | |
| def | __init__ (self, *argv) |
| Constructor for puzzle board. More... | |
| def | addPiece (self, piece, ORIGINAL_ID=False) |
| Add puzzle piece instance to the board. More... | |
| def | addPieceFromImageAndMask (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=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... | |
Public Attributes | |
| feaExtractor | |
| feaLabel | |
| feaLabel_dict | |
| feature | |
| feature_dict | |
| params | |
Public Attributes inherited from Board | |
| id_count | |
| pieces | |
A puzzle piece clustering method based on color.
The feature extractor should be based on color.
| def __init__ | ( | self, | |
| thePuzzle, | |||
extractor = Histogram(), |
|||
theParams = ParamColorCluster |
|||
| ) |
Constructor for the byColor class.
Args: thePuzzle: The input puzzle board. extractor: A matcher instance. theParams: The param for threshold.
| def process | ( | self | ) |
Extract color features from the data.
Since this instance is a board, the presumption is that there is a measurement available in the stored board data. If there is nothing then there can be no clustering achieved.
| def score | ( | self, | |
| cluster_id_pred_dict, | |||
method = 'label' |
|||
| ) |
Score the clustering result.
See https://scikit-learn.org/stable/modules/clustering.html#overview-of-clustering-methods
Args: cluster_id_pred_dict: The predicted cluster id for each piece. method: The method to score the clustering result. ['label', 'histogram']
Returns: The score of the clustering result.
| feaExtractor |
| feaLabel |
| feaLabel_dict |
| feature |
| feature_dict |
| params |