Esempio n. 1
0
	def update(self):
		data = self.get_input("Array")
		draw = self.get_input("Draw")
		if data == None or draw == None:
			return

		#print(data)
		#print(type(data))

		closed = True
		if self.get_int('Closed') > 0: closed = True
		approx_contours = []
		for contour in data:
			approx_curve = cv2.approxPolyDP(
				curve = contour,
				epsilon = self.get_double('Epsilon'),
				closed = closed
			)

			#print(approx_curve)
			#print(type(approx_curve))
			approx_contours.append(approx_curve)

		draw = draw.copy().convert('rgb')
		cv2.drawContours(draw.img, approx_contours, -1, (0,255,0), 2)

		self.set_output('Draw', draw)
		self.set_output('Array', approx_contours)
Esempio n. 2
0
    def update(self):
        data = self.get_input("Array")
        draw = self.get_input("Draw")
        if data == None or draw == None:
            return

        #print(data)
        #print(type(data))

        closed = True
        if self.get_int('Closed') > 0: closed = True
        approx_contours = []
        for contour in data:
            approx_curve = cv2.approxPolyDP(curve=contour,
                                            epsilon=self.get_double('Epsilon'),
                                            closed=closed)

            #print(approx_curve)
            #print(type(approx_curve))
            approx_contours.append(approx_curve)

        draw = draw.copy().convert('rgb')
        cv2.drawContours(draw.img, approx_contours, -1, (0, 255, 0), 2)

        self.set_output('Draw', draw)
        self.set_output('Array', approx_contours)
Esempio n. 3
0
	def update(self):
		data = self.get_input("Array")
		draw = self.get_input("Draw")
		if data == None or draw == None:
			return


		vmin = self.get_int('Vertex min')
		vmax = self.get_int('Vertex max')
		pmin = self.get_int('Perimeter min')
		pmax = self.get_int('Perimeter max')
		amin = self.get_double('Area min')
		amax = self.get_double('Area max')

		r = self.get_int('R')
		g = self.get_int('G')
		b = self.get_int('B')

		new_list = []
		for poly in data:
			if len(poly) > vmax or len(poly) < vmin: continue
			perimeter = cv2.arcLength(poly, True)
			if perimeter > pmax or perimeter < pmin: continue
			area = cv2.contourArea(poly)
			if area > amax or area < amin: continue
			#cv2.minEnclosingCircle(points) -> center, radius

			new_list.append(poly)

		draw = draw.copy().convert('rgb')
		cv2.drawContours(draw.img, new_list, -1, (r,g,b), 2)

		self.set_output('Draw', draw)
		self.set_output('Array', new_list)
Esempio n. 4
0
    def update(self):
        data = self.get_input("Array")
        draw = self.get_input("Draw")
        if data == None or draw == None:
            return

        vmin = self.get_int('Vertex min')
        vmax = self.get_int('Vertex max')
        pmin = self.get_int('Perimeter min')
        pmax = self.get_int('Perimeter max')
        amin = self.get_double('Area min')
        amax = self.get_double('Area max')

        r = self.get_int('R')
        g = self.get_int('G')
        b = self.get_int('B')

        new_list = []
        for poly in data:
            if len(poly) > vmax or len(poly) < vmin: continue
            perimeter = cv2.arcLength(poly, True)
            if perimeter > pmax or perimeter < pmin: continue
            area = cv2.contourArea(poly)
            if area > amax or area < amin: continue
            #cv2.minEnclosingCircle(points) -> center, radius

            new_list.append(poly)

        draw = draw.copy().convert('rgb')
        cv2.drawContours(draw.img, new_list, -1, (r, g, b), 2)

        self.set_output('Draw', draw)
        self.set_output('Array', new_list)