基于OpenCV的目标物体颜色及轮廓的识别方法
2014-12-18侯宾张文志戴源成田洪强
侯宾+张文志+戴源成+田洪强
摘 要: 针对机器人视觉中对目标物体的拾取问题,提出一种基于OpenCV函数对从摄像头输入的目标物体的颜色及轮廓进行有效识别的方法。首先利用摄像头读取目标物体及周围环境,经一系列图像处理后进行目标物体的颜色识别,在此基础上进行Canny边缘检测并查找轮廓,最后将轮廓显示。结果表明,该实验程序可以很好地完成对目标物体的颜色及轮廓提取,且有效地避免了目标物体周围相近颜色的干扰。
关键词: 机器人视觉; 颜色识别; 轮廓识别; Canny边缘检测
中图分类号: TN919?34; TP391 文献标识码: A 文章编号: 1004?373X(2014)24?0076?04
Method of objects color and contour recognition based on OpenCV
HOU Bin, ZHANG Wen?zhi, DAI Yuan?cheng, TIAN Hong?qiang
(Inner Mongolia University of Technology, Huhhot 010051, China)
Abstract: Aiming at the problem of recognizing the target object in robot visual, a way based on OpenCV is proposed, which can effectively recognize the color and the contour of the objects from the camera. The target object and its surrounding environment are read out by camera, and then the color of the object is recognized after a series of image processing. On the basis of this, the Canny edge detection is carried on, and the contour is determined and displayed. The results show that the expe?
rimental procedure can complete the extraction of target objects' color and contour perfectly, and avoid the interference of similar color around objects effectively.
Keywords: robot vision; color recognition; contour recognition; Canny edge detection
0 引 言
机器人视觉是机器人感知外部世界的重要媒介,也是未来机器人传感器发展的主流方向。机器人视觉通过视觉传感器获取环境的图像数据,并通过软件进行图像的分析和理解,使机器人能够辨识目标物体及确定其位置[1]。随着机器人技术的快速发展及其在工业、医学、军事等领域的广泛应用,机器人视觉技术取得了快速发展,对机器人灵敏感知周围环境的能力要求也不断提高[2]。对目标物体的精确识别问题是机器人视觉中最基本的环节,而颜色识别和轮廓识别又是进行其他深入研究的基础。目前在这方面的主要应用是单一的对颜色或轮廓的提取。
基于上述情况,本文提出了基于OpenCV函数库,对摄像头取景范围内目标物体颜色及轮廓共同精确提取的方法。利用OpenCV函数库中提供的函数,对目标物体首先进行各种图像学方面的预处理以使得到的图像符合实验要求,然后利用阈值调节进行颜色识别,最后在颜色识别的基础上进行边缘检测及轮廓识别。……
