|
IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
|
Generic puzzle piece matching class. More...

Public Member Functions | |
| def | __init__ (self, theParams=CfgMatcher) |
| Constructor for the matcher class. More... | |
| def | compare (self, piece_A, piece_B) |
| Compare between two passed puzzle piece data. More... | |
| tuple[float, np.ndarray] | estimateAffineMatch (self, piece_A, piece_B) |
| Estimate the rigid affine transform that aligns piece A to piece B. More... | |
| def | extractFeature (self, piece) |
| Process raw puzzle piece data to obtain encoded description of piece. More... | |
| "Matcher" | fit (self, groups, list[str]|None labels=None) |
| Given raw data regarding expected element instances, identify model to differentiate them if possible for this matcher type. More... | |
| "Matcher" | fitFromImageSegmented (self, Irgb, Iseg, hasLabs=False) |
| Given an image and a segmentation, generate fit. More... | |
| def | score (self, piece_A, piece_B) |
| Compute the score between two passed puzzle piece data. More... | |
| def | solveMatchedPuzzle (self, puzzle, sol) |
Static Public Member Functions | |
| tuple[np.ndarray, np.ndarray] | pcaFrame (piece) |
| Estimate a signed PCA frame from a puzzle piece's foreground pixels. More... | |
Public Attributes | |
| params | |
Generic puzzle piece matching class.
Actual instances should use similarity of difference matching sub-classes.
| def __init__ | ( | self, | |
theParams = CfgMatcher |
|||
| ) |
Constructor for the matcher class.
| [in] | theParams | The matcher configuration (optional). |
Reimplemented in MatchSimilar, SIFTCV, PCA, Moments, HistogramCV, Distance, and MatchDifferent.
| def compare | ( | self, | |
| piece_A, | |||
| piece_B | |||
| ) |
Compare between two passed puzzle piece data.
This member function should be overloaded.
| [in] | piece_A | Puzzle piece A instance. |
| [in] | piece_B | Puzzle piece B instance. |
| [out] | Outcome | of matching classification, when function overloaded. |
Reimplemented in Sift, MatchSimilar, and MatchDifferent.
| tuple[float, np.ndarray] estimateAffineMatch | ( | self, | |
| piece_A, | |||
| piece_B | |||
| ) |
Estimate the rigid affine transform that aligns piece A to piece B.
The transform maps global pixel coordinates from piece_A into the global coordinate frame of piece_B. Its rotation is determined by their signed PCA frames and its translation maps the A centroid onto the B centroid.
(rotation_degrees, affine) where affine is a 3x3 homogeneous rigid transform. | def extractFeature | ( | self, | |
| piece | |||
| ) |
Process raw puzzle piece data to obtain encoded description of piece.
Use to recognize/associate the piece given new measurements. This member function should be overloaded.
| [in] | piece | Template instance saving a piece's info. |
| [out] | featVec | The "feature" vector. |
Reimplemented in SIFTCV, PCA, Moments, HistogramCV, Distance, ColorBoWMatcher, and Edge.
| "Matcher" fit | ( | self, | |
| groups, | |||
| list[str] | None | labels = None |
||
| ) |
Given raw data regarding expected element instances, identify model to differentiate them if possible for this matcher type.
This base class does nothing. Overload as fitting.
| groups | List of (3, N) RGB matrices forming the database. |
| labels | Optional list of human-readable names, one per group. Auto-generated as "group_0", "group_1", ... if None. |
| "Matcher" fitFromImageSegmented | ( | self, | |
| Irgb, | |||
| Iseg, | |||
hasLabs = False |
|||
| ) |
Given an image and a segmentation, generate fit.
This base class does nothing. Overload as fitting.
Permits fitting based on two images, one with all objects of interest in it as a color image and the second a segmentation isolating the objects. It should be considered binary in nature, then no labels assumed. If it has labels (each unique value is the label), then snag from Iseg as labels.
| [in] | Irgb | Source color image. |
| [in] | Iseg | Binary segmentation of image, or label segmentation. |
| [in] | hasLabs | Iseg has labels and is interpreted as binary. Default: False. |
Reimplemented in ColorBoWMatcher.
|
static |
Estimate a signed PCA frame from a puzzle piece's foreground pixels.
| [in] | piece | Template puzzle piece. |
(center, frame) where center is the global pixel centroid and frame is a 2x2 right-handed rotation matrix whose first column is the major PCA axis. | def score | ( | self, | |
| piece_A, | |||
| piece_B | |||
| ) |
Compute the score between two passed puzzle piece data.
| [in] | piece_A | Template instance saving a piece's info. |
| [in] | piece_B | Template instance saving a piece's info. |
| [out] | Distance | of the feature vectors. (Overload if not proper). |
Reimplemented in Sift, SIFTCV, PCA, Moments, HistogramCV, and ColorBoWMatcher.
| def solveMatchedPuzzle | ( | self, | |
| puzzle, | |||
| sol | |||
| ) |
Reimplemented in SIFTCV.
| params |