Instance of Matrix that can also generate defective puzzles by introducing erroenous puzzle pieces based on the configuration parameters and random sampling.
More...
|
def | __init__ (self, theBoard=[], imSource=[], theParams=CfgMatrix) |
| Constructor. More...
|
|
def | annotateDetectionsWithCircles (self, theImage, piCoords, blockOutGrid) |
| Uses trial settings to generate robot detection annotation on image. More...
|
|
def | annotatePuzzleImage (self, theImage, spCoords, fpCoords) |
| Given bad piece and false positive locations, mark them in image. More...
|
|
def | applyCorruptionToPiecesByMatrix (self, pgCoords) |
| Uses trial settings to generate corruption vectors for pieces. More...
|
|
def | applyDetectionToPuzzleImage (self, theImage, pgCoords, blockOutGrid) |
| Apply detection process to system, if robot specified to exist. More...
|
|
def | buildFrom_ImageAndRegions (theImage, theRegions, theParams=CfgMatrix()) |
|
def | corruptPieces (self, pcInds, pcErrs) |
| Corrupt the pieces indicated according to specified defect vector. More...
|
|
def | corruptPiecesByCoords (self, pcCoords, pcErrs) |
| Corrupt pieces at specified coordinates according to specified defect vector. More...
|
|
def | reset (self) |
| Reset puzzle to the original version. More...
|
|
def | samplePieces (self, nSamp, doBlockOut=True, blockOutMat=None) |
| Sample a small set of pieces based on block-out (or not). More...
|
|
def | __init__ (self, theBoard=[], theParams=CfgMatrix) |
| Constructor for the puzzle.builder.adjacent class. More...
|
|
def | coord2ind (self, theCoords) |
| Uses puzzle shape to convert puzzle piece coordinate to linear index/key. More...
|
|
def | explodedPuzzle (self, dx=100, dy=50, bgColor=(0, 0, 0)) |
| Create an exploded version of the puzzle. More...
|
|
def | getCoordinates (self) |
| Obtain solution board coordinates for the pieces. More...
|
|
def | retile (self, dx=150, dy=150, inOrder=True) |
| Organize puzzle pieces according to gridding. More...
|
|
def | shuffle (self, numPieces=None, reorient=False) |
| Randomly shuffle location of puzzle pieces of the puzzle. More...
|
|
def | sub2ind (self, theSubs) |
| Uses puzzle shape to convert puzzle piece subscripts to linear index/key. More...
|
|
def | swap (self, theswap=None, reorient=False) |
| Randomly shuffle location of puzzle pieces of the puzzle. More...
|
|
def | swapByCoords (self, swapCoords) |
| Specify puzzle piece coordinates that should be swapped. More...
|
|
def | processAdjacency (self) |
| Process the solution board and determine what pieces are adjacent or "close enough." It will determine the adjacency matrix. More...
|
|
def | corrections (self, pLoc) |
| Given an array of locations that correspond to the puzzle board (e.g., in the same order as puzzle board list), provide the correction vector that would move them to the calibrated locations. More...
|
|
def | distances (self, pLoc) |
| Given an array of locations that correspond to the puzzle board (e.g., in same order as puzzle board list), provide the distances between the locations and the calibrated locations. More...
|
|
def | piecesInPlace (self, pLoc, tauDist=None) |
| Return boolean array indicating whether the piece is correctly in place or not. More...
|
|
def | scoreBoard (self, theBoard) |
| Given a puzzle board with in ordered correspondence with the calibrated puzzle board, in the same order as puzzle board list), provide a score for the distance between the puzzle piece locations and the calibrated locations. More...
|
|
def | scoreByLocation (self, pLoc) |
| Given an array of locations that correspond to the puzzle board (e.g., in same order as puzzle board list), provide a score for the distance between the locations and the calibrated locations. More...
|
|
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...
|
|
|
def | buildFrom_ImageAndMask (theImage, theMask, theParams=CfgMatrix(), show_grid=False) |
| Given an image and an image mask, parse both to recover the puzzle calibration/solution. More...
|
|
def | buildFrom_ImageAndSpecs (theImage, theParams) |
| Given a fully specific Matrix puzzle and an image, instantiate a MatrixDefect puzzle. More...
|
|
def | buildFrom_ImageProcessing (theImage, theProcessor=None, theDetector=None, theParams=None) |
|
def | buildFrom_Sketch (theImage, theMask, theProcessor=None, theDetector=None, theParams=None) |
|
def | buildFromFile_ImageAndMask (fileName, theParams=None) |
| Load a saved arrangement calibration/solution stored as an image and a mask. More...
|
|
def | buildFromFile_Puzzle (fileName, theParams=None) |
| Load a saved arrangement calibration/solution puzzle board. More...
|
|
def | buildFromFiles_ImageAndMask (imFile, maskFile, theParams=None) |
| Load a saved arrangement calibration/solution stored as separate image and mask files. More...
|
|
def | generateStudy (theTrials, theSettings, theImage, filePre) |
| Generate all of the images associated to a study. More...
|
|
def | generateTrainingImages (theTrials, theSettings, theImage, filePre) |
| Generate all of the images associated to a study. More...
|
|
def | generateTrainingImages_Pilot01 (puzzleImage, theSettings, filePre, randSeed=3454564) |
| Generate trial matrix associated to training trials across all conditions and trial classes. More...
|
|
def | generateTrial (trialInfo, trialStgs, theImage, filePrefix) |
|
def | buildFrom_ImageAndMask (theImage, theMask, theParams=None) |
| Given an image and an image mask, process both to recover and instantiate a puzzle calibration/solution. More...
|
|
|
tuple | cent |
|
| dx = self.xcoords[1]-self.xcoords[0] |
|
| dy = self.ycoords[1]-self.ycoords[0] |
|
int | li = li+1 |
|
| markImage = cv2.circle(markImage, cent, r, (0, 0, 0) , 2) |
|
| modPiece = self.pieces[inds] |
|
list | piShift = []; |
|
| r = self.params.rho * np.linalg.norm(np.array([ self.xcoords[-1], self.ycoords[-1] ])) |
|
tuple | r = (self.params.rhoDetect * rad).astype('int') |
|
int | rad = np.linalg.norm(np.array([dx, dy]))/2 |
|
| selCoord = sc[selInd,:] |
|
int | selInd = random.randint(1,sc.shape[0])-1 |
|
list | shiftVec = [] |
|
int | theta = 2 * math.pi * random.random() |
|
int | ti = ti+1 |
|
list | xtake = [selCoord[0]-self.params.blockOut, 1+selCoord[0]+self.params.blockOut] |
|
list | ytake = [selCoord[1]-self.params.blockOut, 1+selCoord[1]+self.params.blockOut] |
|
| colTarg = int((imcols*theParams.isize[0])/imrows) |
|
| dc = int(imsize[1] / theParams.psize[0]) |
|
| dr = int(imsize[0] / theParams.psize[1]) |
|
| imcols = imsize[0] |
|
| imFact = theParams.isize[0] / imcols |
|
| imRatio = imcols / imrows |
|
| imrows = imsize[1] |
|
| imsize = theImage.shape |
|
| isize |
|
| order |
|
| partition_num |
|
| rowTarg = int((imrows*theParams.isize[1])/imcols) |
|
| shape |
|
| theImage = cv2.resize(theImage, None, fx=imFact, fy=imFact) |
|
| theMask = np.ones([imrows, imcols]) |
|
| thePuzzle = Matrix.buildFrom_ImageAndMask(theImage, theMask, theParams) |
|
| ticols = dc * theParams.psize[0] |
|
| tirows = dr * theParams.psize[1] |
|
| x_labels |
|
| x_list |
|
| x_parts |
|
| xcoords |
|
| y_labels |
|
| y_list |
|
| y_parts |
|
| ycoords |
|
Instance of Matrix that can also generate defective puzzles by introducing erroenous puzzle pieces based on the configuration parameters and random sampling.
Provides an API to the Matrix puzzle for creating faulty or defective puzzles.