コード例 #1
0
    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
コード例 #2
0
 def createCircleAroundContours(self, image, contour):
     return searchBall.getCircleByContours(image, contour)