当前位置: 首页>>代码示例>>Python>>正文


Python Video.loadCalibration方法代码示例

本文整理汇总了Python中video.Video.loadCalibration方法的典型用法代码示例。如果您正苦于以下问题:Python Video.loadCalibration方法的具体用法?Python Video.loadCalibration怎么用?Python Video.loadCalibration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在video.Video的用法示例。


在下文中一共展示了Video.loadCalibration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Gui

# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import loadCalibration [as 别名]

#.........这里部分代码省略.........

                """ 
                Uncomment to gether affine calibration matrix numbers 
                on terminal
                """ 
                print self.video.aff_matrix
	if self.video.aff_flag == 2:
            mouse_coord = np.array([[(x-MIN_X)], [(y-MIN_Y)],[1]])
	    self.world_coord = np.dot(self.video.aff_matrix, mouse_coord)
	
	if self.define_template_flag == 0:
	    self.click_point1 = copy.deepcopy(self.last_click)
	    self.define_template_flag = 1
	elif self.define_template_flag == 1:
	    self.click_point2 = copy.deepcopy(self.last_click)
	    self.template = copy.deepcopy(self.video.bwFrame[2*self.click_point1[1]:2*self.click_point2[1],2*self.click_point1[0]:2*self.click_point2[0]])
	    print self.click_point1
            print self.click_point2
	    self.define_template_flag = -1
	    cv2.imwrite('./template.png', self.template)

    def affine_cal(self):
        """ 
        Function called when affine calibration button is called.
        Note it only chnage the flag to record the next mouse clicks
        and updates the status text label 
        """
        self.video.aff_flag = 1 
        self.ui.rdoutStatus.setText("Affine Calibration: Click point %d" 
                                    %(self.video.mouse_click_id + 1))

    def load_camera_cal(self):
        print "Load Camera Cal"
	self.video.loadCalibration()

    def tr_initialize(self):
	self.wayPointsPos = []
	self.wayPointsSpeed = []
	self.wayPointsTime = []
        print "Teach and Repeat"

    def tr_add_waypoint(self):
	#waypoints1 = copy.deepcopy(self.rex.joint_angles_fb)
	#waypoints2 = copy.deepcopy(self.rex.joint_angles_fb)
	#self.wayPointsPos.append(waypoints1)
	#self.wayPointsTime.append([self.currtime, self.currtime, self.currtime, self.currtime])
        #self.wayPointsSpeed.append([0.1, 0.1, 0.1, 0.1])
        #self.currtime += 70000
	#waypoints2[1] -= 0.7
	#self.wayPointsPos.append(waypoints2)
	#self.wayPointsTime.append([self.currtime, self.currtime, self.currtime, self.currtime])
        #self.wayPointsSpeed.append([0.1, 0.1, 0.1, 0.1])
        #self.currtime += 70000
	#self.waypointsfp.writerow(waypoints1)
	#self.waypointsfp.writerow(waypoints2)
	#np.save("waypointsPos",self.wayPointsPos)
	#np.save("waypointsSpeed", self.wayPointsSpeed)
	#np.save("waypointsTime", self.wayPointsTime)
	self.wayPointsPos.append(copy.deepcopy(self.rex.joint_angles_fb))
	self.wayPointsSpeed.append(copy.deepcopy(self.rex.speed_fb))
	self.wayPointsTime.append(copy.deepcopy(self.rex.time_fb))
	np.save("waypointsPos",self.wayPointsPos)
	np.save("waypointsSpeed", self.wayPointsSpeed)
	np.save("waypointsTime", self.wayPointsTime)
	#print self.wayPoints
        print "Add Waypoint"
开发者ID:rounakmehta93,项目名称:ArmLab,代码行数:70,代码来源:control_station.py

示例2: Gui

# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import loadCalibration [as 别名]

#.........这里部分代码省略.........

                """
                Uncomment to gether affine calibration matrix numbers
                on terminal
                """
                #print self.video.aff_matrix
        
        if self.get_template == 1:
            self.template_point = [(x-MIN_X)*(960.0/480.0), (y-MIN_Y)*(1280.0/640.0)]
            self.get_template += 1
        elif self.get_template == 2:
            self.get_template = 0
            bottom_point = [(x-MIN_X)*(960.0/480.0), (y-MIN_Y)*(1280.0/640.0)]
            dx = bottom_point[0] - self.template_point[0]
            dy = bottom_point[1] - self.template_point[1]
            grey_frame = cv2.cvtColor(self.video.currentFrame, cv2.COLOR_BGR2GRAY)
            self.template = grey_frame[self.template_point[1]-dy:bottom_point[1], self.template_point[0]-dx:bottom_point[0]]
            #self.template = cv2.cvtColor(self.template, cv2.COLOR_BGR2GRAY)
            cv2.imwrite('./template.png', self.template)
            print "Got Template"

    def affine_cal(self):
        """
        Function called when affine calibration button is called.
        Note it only chnage the flag to record the next mouse clicks
        and updates the status text label
        """
        self.video.aff_flag = 1
        self.ui.rdoutStatus.setText("Affine Calibration: Click point %d"
                                    %(self.video.mouse_click_id + 1))

    def load_camera_cal(self):
        print "Load Camera Cal"
        self.video.loadCalibration()

    def tr_initialize(self):
        print "Teach and Repeat"
        self.path_start_time = micro_time()
        self.rex.plan = []
        self.rex.plan_status = 0
        self.rex.wpt_number = 0
        self.rex.max_torque = 0.0
        self.ui.sldrMaxTorque.setValue(0.0)

    def tr_add_waypoint(self):
        print "Add Waypoint"
        self.rex.plan.append([micro_time() - self.path_start_time, self.rex.joint_angles_fb[:], [0,0,0,0]])
        self.rex.wpt_total += 1

    def tr_smooth_path(self):
        print "Smooth Path"
        #Basic smoothing
        new_plan = []
        #for i, (t, p) in enumerate(self.rex.plan):
        #    np = p[:]
        #    nt = t + 1000000 * i + 500000
        #    if p[1] < 0:
        #        np[1] += 10*D2R
        #    else:
        #        np[1] -= 10*D2R
        #
        #    new_plan.append([nt-500000, np])
        #    new_plan.append([nt, p[:]])
        #    new_plan.append([nt+500000, np])

        self.rex.plan = [[0, [0, 0, 0, 0], [0,0,0,0]]] + self.rex.plan
开发者ID:mittalrajat,项目名称:Robotics-Systems-Lab,代码行数:70,代码来源:control_station.py


注:本文中的video.Video.loadCalibration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。