def equalsHists(self, processImage, processImageMask, imageForSearching): hist = searchBall.createHistByImage(processImage, processImageMask) maskedImg, finalHist = searchBall.equalsHists(hist, imageForSearching) return maskedImg, finalHist
def mouseEvents(self, event, x, y, flags, param): if event == cv2.EVENT_LBUTTONDOWN: self.refPT = [(x, y)] # self.addToHistPixelSet(self.hsvImage, [y, x]) if event == cv2.EVENT_LBUTTONUP: self.refPT.append((x, y)) self.classImageProcess.processColorsByCoordinates(self.refPT) colors = self.processColors(self.clonedProcessImage, self.refPT) self.redrawProcessImage(colors, self.clonedProcessImage) hist = searchBall.createHistByImage(self.hsvImage, self.mask) maskededImg, finalHist = searchBall.equalsHists(hist, self.imageForSearching) opening = searchBall.noiseFilter(maskededImg) closing = searchBall.closingFilter(opening) binary = searchBall.imageToBinary(closing) contour = searchBall.searchContoursBinary(binary, self.imageForSearching) searchBall.getCircleByContours(self.imageForSearching, contour) print contour