example1_identify_color.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: UTF-8 -*-
3 # Copyright 2019 The UFACTORY Inc. All Rights Reserved.
4 #
5 # Software License Agreement (BSD License)
6 #
7 # Author: Jimy Zhang <jimy.zhang@ufactory.cc> <jimy92@163.com>
8 # =============================================================================
9 
10 
11 #import rospy
12 #from std_msgs.msg import String
13 from camera_driver import CameraDriver
14 
15 def main():
16  #实例化CameraDriver,参数0 (调用/dev/video0摄像头)
17  camera = CameraDriver(0)
18  pose_mid = [[0,0]]*10
19  s = [0]*10
20  while(1):
21  image = camera.get_image() # 获取一帧图片
22 
23  # 识别image中的蓝色物体
24  camera.identify_colour(image, pose_mid, s, 1) # 识别image中的蓝色物体
25  # 打印蓝色物体的坐标信息
26  print(pose_mid)
27  # 打印蓝色物品的面积
28  print(s)
29  print(' ')
30 
31 if __name__ == '__main__':
32  main()


xarm_device
Author(s):
autogenerated on Sat May 8 2021 02:51:20