TemplateMatcher.findMatchesByGrayscaleAtOriginalResolution(testImage, model.getTopRight().getImage(), numMatches, minSimilarity);
final List<RegionMatch> tms4 =
TemplateMatcher.findMatchesByGrayscaleAtOriginalResolution(testImage, model.getBottomLeft().getImage(), numMatches, minSimilarity);
ImageRenderer matchedPartsRenderer = new PiccoloImageRenderer(testImage){
@Override
protected void addContent(PLayer layer) {
for (List<RegionMatch> tmss : Lists.newArrayList(tms1,tms2,tms3,tms4)){
for (RegionMatch tms : tmss){
PPath c = PPath.createRectangle(tms.getX(),tms.getY(),tms.getWidth(),tms.getHeight());
c.setStroke(new BasicStroke(2f));
c.setStrokePaint(Color.blue);
c.setTransparency(0.5f);
layer.addChild(c);
}
}
}
};
logger.step(matchedPartsRenderer, "matched parts");
// generate hypotheses
final List<MatchHypothesis> hypotheses = Lists.newArrayList();
for (RegionMatch scoreMatch1 : tms1){
for (RegionMatch scoreMatch3 : tms3){
ModelPartMatch m1 = new ModelPartMatch(model.getTopLeft(), scoreMatch1);
ModelPartMatch m2 = new ModelPartMatch(model.getBottomRight(), scoreMatch3);
MatchHypothesis newHypothesis = new MatchHypothesis(m1,m2);
if (newHypothesis.isValid()){
hypotheses.add(newHypothesis);
}
}
}
ImageRenderer hypothesesRenderer = new PiccoloImageRenderer(testImage){
@Override
protected void addContent(PLayer layer) {
for (MatchHypothesis h : hypotheses){
ModelPartMatch m1 = h.getTopLeft();
ModelPartMatch m2 = h.getBottomRight();