Ejemplo n.º 1
0
        def process_node(tup):
            node, color, size, text = tup
            color_scalar = cv.cvScalar(color[0], color[1], color[2])
            node_val = node.val(t)

            if node_val.__class__ != tuple:
                if node_val != None:
                    v_cv = self.disp.to_screen(node.val(t))

                def circ(n):
                    pt = cv.cvPoint(int(round(n[0, 0])), int(round(n[1, 0])))
                    cv.cvCircle(self.disp.buffer, pt, size, color_scalar,
                                cv.CV_FILLED, cv.CV_AA)
                    pt2 = cv.cvPoint(pt.x + 2, pt.y + 2)
                    cv.cvPutText(self.disp.buffer, text, pt, self.disp.font,
                                 cv.cvScalar(255, 255, 255))
                    cv.cvPutText(self.disp.buffer, text, pt2, self.disp.font,
                                 cv.cvScalar(50, 50, 50))

                map(circ, fun.points_of_mat(v_cv))
            else:
                start_pts, end_pts = node_val
                for idx in range(start_pts.shape[1]):
                    start_pt = cvpoint_of_pt(
                        self.disp.to_screen(start_pts[:, idx]))[0]
                    end_pt = cvpoint_of_pt(self.disp.to_screen(
                        end_pts[:, idx]))[0]
                    cv.cvLine(self.disp.buffer, start_pt, end_pt, color_scalar,
                              size, cv.CV_AA)
Ejemplo n.º 2
0
		def process_node(tup): 
			node, color, size, text = tup 
			color_scalar = cv.cvScalar(color[0], color[1], color[2]) 
			node_val     = node.val(t) 

			if node_val.__class__ != tuple: 
				if node_val != None: 
					v_cv = self.disp.to_screen(node.val(t)) 

				def circ(n): 
					pt  = cv.cvPoint(int(round(n[0,0])),int(round(n[1,0]))) 
					cv.cvCircle(self.disp.buffer, pt, size, 
							color_scalar, cv.CV_FILLED, cv.CV_AA) 
					pt2 = cv.cvPoint(pt.x + 2, pt.y + 2) 
					cv.cvPutText(self.disp.buffer, text, pt,  self.disp.font, cv.cvScalar(255,255,255)) 
					cv.cvPutText(self.disp.buffer, text, pt2, self.disp.font, cv.cvScalar(50,50,50)) 
				map(circ, fun.points_of_mat(v_cv))
			else: 
				start_pts, end_pts = node_val 
				for idx in range(start_pts.shape[1]): 
					start_pt = cvpoint_of_pt(self.disp.to_screen(start_pts[:,idx]))[0] 
					end_pt   = cvpoint_of_pt(self.disp.to_screen(  end_pts[:,idx]))[0] 
					cv.cvLine(self.disp.buffer, start_pt, end_pt, 
							color_scalar, size, cv.CV_AA)
Ejemplo n.º 3
0
    def point(self, pts, size=1, color=cv.cvScalar(100,100,100)):
		def circ(n):
			pt  = cv.cvPoint(int(round(n[0,0])),int(round(n[1,0])))
			cv.cvCircle(self.buffer, pt, size,
					color, cv.CV_FILLED, cv.CV_AA)
		map(circ, fun.points_of_mat(pts))
Ejemplo n.º 4
0
    def point(self, pts, size=1, color=cv.cvScalar(100, 100, 100)):
        def circ(n):
            pt = cv.cvPoint(int(round(n[0, 0])), int(round(n[1, 0])))
            cv.cvCircle(self.buffer, pt, size, color, cv.CV_FILLED, cv.CV_AA)

        map(circ, fun.points_of_mat(pts))