def showRegionsForResultId(resultId, color): painting = getPaintingInResultId(resultId) title = Result.select(Result.q.id==resultId)[0].painting.title image = painting.getImage() regions = getRegionsForResultId(resultId) for region in regions: rect = region.getBoundingBox() p1 = cv.cvPoint(rect.x, rect.y) p2 = cv.cvPoint(rect.x + rect.width, rect.y + rect.height) cv.cvRectangle(image, p1, p2, color, 2) g.showImage(image, title)
def showPictureInResultId(resultId): painting = p.Painting(Result.select(Result.q.id==resultId)[0].painting) g.showImage(painting.getImage(), "Wee")