a circular hough transform hardware for industrial circle detction applications
一种快速准确识别圆形目标的新算法 (1)

576
激光与红外
第37卷
第37卷 第6期 2007年6月
激光与红外
IASER & INFRARED
文章编号:1001-5078(2007)06-0575-04
V01.37.No.6 June,2007
一种快速准确识别圆形目标的新算法
李江涛,倪国强,王强,黄光华
(北京理工大学信息科技学院光电工程系,北京100081)
摘要:在对二值圆形图像深入认识的基础上,研究了自动提取图像中圆形目标的理论,提出
下面介绍算法自动识别多尺度圆形目标另一个
非常重要的参数:数字圆上像素点到圆心的距离与
理想状态的圆半径差值△。以上面所列出的圆为
例,来研究它们的圆上像素距圆心的最大距离与真
实R之间的差值规律,如表2所示。实验表明,以
圆心为坐标原点,随着像素偏离x或y轴,厶将增
大,并在45。时将达到最大值。所以选取圆的第一
李江涛倪国强王强等一种快速准确识别圆形目标的新算法
577
R
图3真实半径与理想半径(R)之间的差值A
本节从不断变化的圆中找出了共有的特性规 律,定义了乃和厶这两个重要的数字圆参数。依据 这两个参数可以快速自动识别不同尺度上的圆形目 标。由于客观成像条件、摄像器件以及边缘提取算 法的影响,造成二值图像中的圆形目标有些形状上 的畸变,或者边缘的缺失。所以在△,D的选取上, 要适当放宽条件才可探测出目标。经过多种图像反 复地实验,当D取4.28,△取0.59时取得的识别效 果相对较好,虚警率和漏检率较低。但是为了体现 自动识别的性质,一旦确定两个参数,将不再更改。 3算法的原理、流程及实现
KRA一种双阶段精确圆检测算法

Qiye Keji Yu Fazhan圆检测是计算机视觉领域的常见方向,被广泛应用于工程实践项目。
Hough 变换圆检测[1]是最基本的检测方法,其原理是把曲线由图像空间中映射到由圆的3个参数构成的参数空间,累加统计参数空间的点,最大累加值的参数即为所求圆的参数。
但该算法存在很多不足之处,在参数量、计算量和内存占用方面有很大的改进空间。
针对上述不足,Xu L 等人[2]提出使用随机Hough 变换做圆检测,该方法在图像空间中随机选取不共线的3个特征点,映射成参数空间中的一个点,是多到一的映射,大大减少了计算量,但是在图像复杂的情形下,由于噪声较多,从而引入大量的无效采样,增加迭代次数,降低检测效率[3]。
随后,有很多改进的算法被提出,周勇亮等人[4]提出一种有效继承的累计加速算法,每次成功检测圆后不清空参数空间,在随机Hough 变换圆检测算法上测试取得很好的速度提升,但是对于单圆和极端情况下加速效果并不明显。
Chen 等人[5]在随机Hough 变换的基础上进行了改进,使用第4个随机采样点判断是否在候选圆上,随后再验证圆的真伪,提高了圆的检测速度。
除此之外,还有许多学者从不同的角度改进圆检测算法,如在Hough 变换的基础上结合梯度信息[6],运用圆的几何属性做圆检测[7]及使用图像的直方图[8]作为评判依据,这些措施都取得了不错的提升。
文中提到的改进算法是基于随机Hough 变换(RHT )圆检测算法进行,虽然大幅提高了算法检测效率,但是仍存在漏检及无效积累等严重问题。
为了改善这一问题,本文提出了一种基于k-means 聚类算法和随机Hough 变换圆检测结合的新的圆检测算法,通过结合两种算法的优点,对采样空间进行约束,大大减少了无效采样并降低了圆的漏检率。
1传统的随机Hough 变换圆检测在平面直角坐标系中,圆的标准方程如下:(x -a )2+(y -b )2=r 2(1)其中,(a ,b )为圆心坐标,r 为圆的半径,(a ,b ,r )为圆的3个参数,分别是圆心坐标和半径。
图像处理专业英语词汇

FFT 滤波器FFT filtersVGA 调色板和许多其他参数VGA palette and many others 按名称排序sort by name包括角度和刻度including angle and scale保持目标keep targets保存save保存和装载save and load饱和度saturation饱和加法和减法add and subtract with saturate背景淡化background flatten背景发现find background边缘和条纹测量Edge and Stripe/Measurement边缘和条纹的提取find edge and stripe编辑Edit编辑edit编辑或删除相关区域edit or delete relative region编码Code编码条Coda Bar变换forward or reverse fast Fourier transformation变量和自定义的行为variables and custom actions变量检测examine variables变形warping变形系数warping coefficients标题tile标注和影响区域label and zone of influence标准normal标准偏差standard deviation表面弯曲convex并入图像merge to image采集栏digitizer bar采集类型grab type菜单形式menu item参数Preferences参数轴和角度reference axis and angle测量measurement测量方法提取extract measurements from测量结果显示和统计display measurement results and statistics测量转换transfer to measurement插入Insert插入条件检查Insert condition checks查找最大值find extreme maximum长度length超过50 个不同特征的计算calculate over 50 different features area 撤销次数number of undo levels乘multiply尺寸size处理Processing处理/采集图像到一个新的窗口processed/grabbed image into new window 窗口window窗口监视watch window窗位window leveling创建create垂直边沿vertical edge从表格新建new from grid从工具条按钮from toolbar button从用户窗口融合merge from user form粗糙roughness错误纠正error correction错误匹配fit error打开open打开近期的文件或脚本open recent file or script打印print打印设置print setup打印预览print preview大小和日期size and date带通band pass带有调色板的8- bit带有动态预览的直方图和x, y 线曲线椭圆轮廓histogram and x, y line curve ellipse profiles with dynamic preview带阻band reject代码类型code type单步single step单一simple单帧采集snap shot导入VB等等etc.低通low pass第一帧first点point调色板预览palette viewer调试方式debug mode调用外部的DLL调整大小resize调整轮廓滤波器的平滑度和轮廓的最小域值adjust smoothness of contour filter and minimum threshold for contours定点除fixed point divide定位精度positional accuracy定义一个包含有不相关的不一致的或无特征区域的模板define model including mask for irrelevant inconsistent or featureless areas定制制定-配置菜单Customize - configure menus动态预览with dynamic preview读出或产生一个条形或矩阵码read or generate bar and matrix codes读取和查验特征字符串erify character strings断点break points对比度contrast对比度拉伸contrast stretch对称symmetry对模板应用“不关心的”像素标注apply don't care pixel mask to model 多边形polygon二进制binary二进制分离separate binary二值和灰度binary and grayscale翻转reverse返回return放大或缩小7 个级别zoom in or out 7 levels分类结果sort results分水岭Watershed分析Analysis分组视图view components浮点float腐蚀erode复合视图view composite复合输入combined with input复制duplicate复制duplicateselect all傅立叶变换Fourier transform改变热点值change hotspot values感兴趣区域ROI高级几何学Advanced geometry高通high pass格式栏formatbar更改默认的搜索参数modify default search parameters 工具Utilities工具栏toolbar工具属性tool properties工具条toolbar工作区workspace bar共享轮廓shared contours构件build构造表格construct grid关闭close和/或and/or和逆FFT画图工具drawing tools缓存buffer换算convert灰度grayscale恢复目标restore targets回放playback绘图连结connect map获得/装载标注make/load mask获取选定粒子draw selected blobs或从一个相关区域创建一个ROI or create an ROI from a relative region基线score基于校准映射的畸变校正distortion correction based on calibration mapping 极性polarity极坐标转换polar coordinate transformation几何学Geometry记录record加粗thick加法add间隔spacing间距distance兼容compatible简洁compactness剪切cut减法subtract减小缩进outdent交互式的定义字体参数包括搜索限制ine font parameters including search constraints 脚本栏script bar角度angle角度和缩放范围angle and scale range接收和确定域值acceptance and certainty thresholds结果栏result bar解开目标unlock targets精确度和时间间隔accuracy and timeout interval矩形rectangle矩形rectangular绝对差分absolute difference绝对值absolute value均匀uniform均值average拷贝copy拷贝序列copy sequence可接收的域值acceptance threshold克隆clone控制control控制controls快捷健shortcut key宽度breadth宽度width拉普拉斯Laplacians拉伸elongation蓝blue类型type粒子blob粒子标注label blobs粒子分离segment blobs粒子内的孔数目number of holes in a blob 亮度brightness亮度luminance另存为save as滤波器filters绿green轮廓profile overlay轮廓极性contour polarity逻辑运算logical operations面积area模板编辑edit model模板覆盖model coverage模板和目标覆盖model and target coverage 模板索引model index模板探测器Model Finder模板位置和角度model position and angle 模板中心model center模糊mask模块import VB module模块modules模式匹配Pattern matching默认案例default cases目标Targets目标分离separate objects目标评价target score欧拉数Euler number盆basins膨胀dilate匹配率match scores匹配数目number of matches平方和sum of the squares平滑smooth平均average平均averaged平均值mean平移translation前景色foreground color清除缓冲区为一个恒量clear buffer to a constant清除特定部分delete special区域增长region-growing ROI取反negate全部删除delete all缺省填充和相连粒子分离fill holes and separate touching blobs任意指定位置的中心矩和二阶矩central and ordinary moments of any order location: X, Y 锐化sharpen三维视图view 3D色度hue删除delete删除帧delete frame设置settings设置相机类型enable digitizer camera type设置要点set main示例demos事件发现数量number of occurrences事件数目number of occurrences视图View收藏collectionDICOM手动manually手绘曲线freehand输出选项output options输出选择结果export selected results输入通道input channel属性页properties page数据矩阵DataMatrix数字化设置Digitizer settings双缓存double buffer双域值two-level水平边沿horizontal edge搜索find搜索和其他应用Windows Finder and other applications 搜索角度search angle搜索结果search results搜索区域search area搜索区域search region搜索速度search speed速度speed算法arithmetic缩放scaling缩放和偏移scale and offset锁定目标lock destination锁定实时图像处理效果预览lock live preview of processing effects on images 锁定预览Lock preview锁定源lock source特定角度at specific angle特定匹配操作hit or miss梯度rank替换replace添加噪声add noise条带直径ferret diameter停止stop停止采集halt grab同步synchronize同步通道sync channel统计Statistics图像Image图像大小image size图像拷贝copy image图像属性image properties图形graph退出exit椭圆ellipse椭圆ellipses外形shape伪彩pseudo-color位置position文本查看view as text文件File文件MIL MFO font file文件load and save as MIL MMF files文件load and save models as MIL MMO files OCR文件中的函数make calls to functions in external DLL files文件转换器file converterActiveMIL Builder ActiveMIL Builder 无符号抽取部分Extract band -细化thin下一帧next显示表现字体的灰度级ayscale representations of fonts显示代码show code线line线lines相对起点relative origin像素总数sum of all pixels向前或向后移动Move to front or back向上或向下up or down校准Calibration校准calibrate新的/感兴趣区域粘贴paste into New/ROI新建new信息/ 图形层DICOM information/overlay形态morphology行为actions修改modify修改路径modify paths修改搜索参数modify default search parameters 序列采集sequence旋转rotation旋转模板rotate model选择select选择selector循环loops移动move移动shift应用过滤器和分类器apply filters and classifiers 影响区域zone of influence映射mapping用户定义user defined用基于变化上的控制实时预览分水岭转化结果阻止过分切割live preview of resulting watershed transformations with control over variation to prevent over segmentation用某个值填充fill with value优化和编辑调色板palette optimization/editor有条件的conditional域值threshold预处理模板优化搜索速度循环全部扫描preprocess model to optimize search speed circular over-scan预览previous元件数目和开始(自动或手动)number of cells and threshold auto or manual元件最小/最大尺寸cell size min/max源source允许的匹配错误率和加权fit error and weight运行run在目标中匹配数目number of modelmatches in target暂停pause增大缩进indent整数除integer divide正FFT正常连续continuous normal支持象征学supported symbologies: BC 412直方图均衡histogram equalization执行execute执行外部程序和自动完成VBA only execute external programs and perform Automation VBA only指定specify指数exponential Rayleigh中值median重复repeat重建reconstruct重建和修改字体restore and modify fonts重新操作redo重心center of gravity周长perimeter注释annotations转换Convert转换convert装载load装载和保存模板为MIL MMO装载和另存为MIL MFO装载和另存为MIL MMF状态栏status bar资源管理器拖放图像drag-and-drop images from Windows ExplorerWindows自动或手动automatic or manual自动或手动模板创建automatic or manual model creation字符产大小string size字符串string字体font最大maximum最大化maximum最大数maxima最后一帧last frame最小minimum最小化minimum最小间隔标准minimum separation criteria最小数minima坐标盒的范围bounding box coordinates图像数据操作Image data manipulation内存分配与释放allocation release图像复制copying设定和转换setting and conversion图像/视频的输入输出Image and video I/O支持文件或摄像头的输入file and camera based input图像/视频文件的输出image/video file output矩阵/向量数据操作及线性代数运算Matrix and vector manipulation and linear algebra routines 矩阵乘积products矩阵方程求解solvers特征值eigenvalues奇异值分解SVD支持多种动态数据结构Various dynamic data structures 链表lists队列queues数据集sets树trees图graphs基本图像处理Basic image processing去噪filtering边缘检测edge detection角点检测corner detection采样与插值sampling and interpolation色彩变换color conversion形态学处理morphological operations直方图histograms图像金字塔结构image pyramids结构分析Structural analysis连通域/分支connected components轮廓处理contour processing距离转换distance transform图像矩various moments模板匹配template matching霍夫变换Hough transform多项式逼近polygonal approximation曲线拟合line fitting椭圆拟合ellipse fitting狄劳尼三角化Delaunay triangulation摄像头定标Camera calibration寻找和跟踪定标模式finding and tracking calibration patterns 参数定标calibration,基本矩阵估计fundamental matrix estimation单应矩阵估计homography estimation立体视觉匹配stereo correspondence)运动分析Motion analysis光流optical flow动作分割motion segmentation目标跟踪tracking目标识别Object recognition特征方法eigen-methodsHMM模型HMM基本的GUI Basic GUI显示图像/视频display image/video键盘/鼠标操作keyboard and mouse handling滑动条scroll-bars图像标注Image labeling直线line曲线conic多边形polygon、文本标注text drawing梯度方向gradient directions系数coefficient空间频率spatial frequencies串级过滤cascade filtering卷积运算convolution operation有限差分近似the finite difference approximation 对数刻度logarithmic scale仿射参数affine parameters斑点Blob差距disparityAlgebraic operation 代数运算;一种图像处理运算,包括两幅图像对应像素的和、差、积、商。
英文原稿

Road-Sign Detection and Recognition Based on SupportVector MachinesSaturnino Maldonado-Bascón, Member, IEEE, Sergio Lafuente-Arroyo, PedroGil-Jiménez,Hilario Gómez-Moreno, Member, IEEE, and Francisco López-FerrerasAbstract—This paper presents an automatic road-sign detection and recognition sys-tembased on support vector machines (SVMs).In automatic traffic-sign maintenance and in a visual driver-assistance system, road-sign detection and recognition are two of the most important functions. Our system is able to detect and recognize circular, rectangular, triangular, and octagonal signs and, hence, covers all existing Spanish traffic-sign shapes. Road signs provide drivers important information and help them to drive more safely and more easily by guiding and warning them and thus regulating their actions. The proposed recognition system is based on the generalization proper-ties of SVMs. The system consists of three stages: 1) segmentation according to the color of the pixel; 2) traffic-sign detection by shape classification using linear SVMs; and 3) content recognition based on Gaussian-kernel SVMs. Because of the used segmentation stage by red, blue, yellow, white, or combinations of these colors, all traffic signs can be detected, and some of them can be detected by several colors. Re-sults show a high success rate and a very low amount of false positives in the final recognition stage. From these results, we can conclude that the proposed algorithm is invariant to trans- lation, rotation, scale, and, in many situations, even to partial oc-clusions.Index Terms—Classification, detection, hue, hue saturation intensity (HSI), road sign, support vector machines (SVMs)I. INTRODUCTIONTRAFFIC-SIGN detection and recognition have been an important issue for re-search recently. Traffic signs have a dual role: First, they regulate the traffic and, second, indicate the state of the road, guiding and warning drivers and pedestrians. These signs can be classified according to their color and shape, and both these cha-racteristics constitute their content, as shown in Table I. The visibility of traffic signs is crucial for the drivers’safety. For example, very serious accidents happen when drivers do not notice a stop sign, as pointed out in [1]. Of course, many other acci-dents are not related to traffic signs and are due to factors such as the psychological state of drivers. The causes for accidents that are related to traffic signs may be occlu-sion or partial occlusion of the sign, deterioration of the sign, or possible distraction ofthe driver. This work is twofold: First, the algorithm that is described here can be usedto evaluate the signaling of the road for maintenance purposes, and second, in a future application, it can be used for driver-assistance systems.It is interesting to pay attention to some of the common problems that are in-volved in traffic-sign detection. These problems are analyzed, and a test set has been reported in [2] and [3]. The first problem to be overcome is caused by the variable lighting conditions of the scene in a natural environment. These different conditionsare brought about by changes in the weather(producing bright spots and shadows), thetime of the day or night, and the state of the road sign itself subject to deterioration or vandalism. Another problem to surpass is the possible rotation of the signs. Althoughthe perfect position for a road sign is perpendicular to the trajectory of the vehicle, many times, the sign is not positioned that way. Therefore, an automatic system mustbe able to detect signs in many positions and, hence, must be invariant to rotation and translation. The next problem is related to traffic-sign size because we find signs of different dimensions, although officially, there are only three normal sizes for nonur-ban environments. Due to the method that we follow to capture the signs, we get an image sequence as we approach the sign. Thus, our aim is to implement an algorithmto detect the sign as soon as it becomes visible. For this reason, we cannot accept a system that only detects signs of a specific size. The last problem that we describehere has been mentioned previously. Occlusions often occur because objects such as trees, other signs, or vehicles can reduce the visibility of the signs and, in conclusion, make the detection system fail. In this paper, we overcome these problems with a high success rate.TABLE IMEANING OF SPANISH TRAFFIC SIGNS ACCORDINGTOTHE COLOR AND SHAPEFinally, the number of different signs is quite large. They are summarized in Fig. 1(a)–(f), where all signs that are employed in Spain are illustrated. Due to this amount, we have to develop strategies to divide the recognition process into different groups.(a)(b)(c)(d)(e)(f)(g)Fig. 1. Traffic-sign database. (a) Danger. (b) Prohibition. (c) Obligation.(d) Warning and infor-mation. (e) Priority. (f) End of prohibition.The organization of this paper is given as follows: Section II focuses on previous research works. We will present first the traffic-sign detection process and then the traffic-sign recognition of the inner area in correspondence to the previously detected sign, with respect to the most relevant techniques that are developed for this purpose.The structure of Section III consists of an exhaustive description of detection and recognition stages, which follows the algorithm shown in Fig. 2. The complete process is triggered by color segmentation of the frame, where the system will search objects with similar colors as traffic signs, i.e., red,blue, white, and yellow, as pre-sented in Section III-A. Once all objects representing possible candidates have been extracted,some features such as size or aspect ratio are analyzed using a table of all the geometric shapes in which traffic signs are designed. Therefore, only the objects that are not discarded in this selection step are analyzed in posterior modules. As the number of different traffic signs is quite large, shape classification is performed prior to the recognition module using the distance to borders (DtBs) as input vectors (as presented in Section III-B) in order to improve computation time in the next stage of recognition. As traffic signs can appear atmany different angles to the camera’s optical axis, each blob of interest is rotated until they are all aligned in the same way before the classification process begins. Every image is processed in the same way; if no suitable objects that correlate in either color and geometric properties are found, another frame is analyzed. Section III-C deals with the recognition module. Both modules, i.e., shape classification and traffic-sign recognition, are implemented with SVMs,which is a novel technique in this field. In the complete system,the possible outputs of both modules are determined by color.By establishing the color first, only some geometric shapes and only a subset of the traffic-sign database are then liable to be considered in the classification and recognition stages.Therefore, those objects withsimilar colors as traffic signs(for example, cars and buildings), which hence represent noisy objects for our system, are rejected with high probability in one of these three selective stages: 1) geometric feature selection;2) shape classification; and 3) recogni-tion of the inner area.Results that are illustrated in Section IV will confirm the ro-bustness of the proposed algorithm. Finally, conclusions will be presented in Section V.Fig. 2. Algorithm description.II. STATE OF THE ARTTraffic-sign recognition algorithms are divided, in most cases, into two stages: 1) detection and 2) recognition.In many works, the first block of the detection system consists of a segmentation stage by thresholding with a given color space to extract the sign color from the image. Direct thresholding over the red green blue (RGB) space is seldom used because it is very sensitive to lighting changes. Thus, in[4], a color ratio between the intensity of the specific RGB color components and the sum of intensity of RGB is used to detectstrong colors in the image. A different relation between the RGB components is em-ployed in [5], where one component is taken as a reference. Although other spaces are used, for example, the YUV system is considered in [6] to detect blue rectangular signs, the most frequently employed space is the hue saturation intensity (HSI) system because color information, which is encoded with hue and saturation compo-nents,presents low variations for objects of interest with a similar color. In [7], proper thresholds on hue and saturation bands are fixed to extract the red and blue colors. In [8], a nonlinear transformation over hue and saturation is employed to enhance the desired colors in the image (red and blue) using two lookup tables for every color for which we are looking. A similarity measurement between the hue component and the previously stored hue values of particular colors in road signs is calculated in [9], and this measurement is fed into a perceptual analyzer that is implemented by a neuronal network.Nevertheless, there are some works where thresholding is not applied directly using a specific color space. Thresholding by looking for chromatic and achromatic colors is applied in [10]by a simple vector filter (SVF). The SVF has characteristics that can extract the specific color and eliminate all the outlines at the same time. Normalized error between the luminance component and RGB components is ob-tained in [8], computing an energy function in order to identify the inner area of the sign.Other methods for detection have been developed based on edge detection. Many robust-shaped detectors such as Hough circle transform are slow to compute over large images. Nevertheless, some recent works (see [11] and [12]) have implemented a fast algorithm based on radial symmetry that is adapted to triangular, square, di-amond, octagonal, and circular shapes. It operates on the gradient of a grayscale im-age and exploits the nature of shapes that vote a center point for circular signs and a line of votes in the case of regular polygons. The main advantage of this method is that it is able to run in real time. As it detects shapes based on edges, the algorithm is robust to changing illumination.In [13], a technique based on genetic algorithms is proposed to recognize circular traffic signs by using only the brightness of an input image, which is obtained in the form of a binary image with the help of a smoothing and a Laplacian filter. In[14], two neural networks (NNs) are developed to extract color and shape features. Both these features are applied to a hue component and a gradient image, where the centers of specific color regions and the centers of certain fixed shapes are given.In [15], theBayes classifier chooses a color class based on the maximum conditional probability of each color, where equal apriori probability for each of the five colors (red, yel-low,green, blue, and white) is assumed.Once the candidate regions have been separated from the image, some research has gone into classifying the candidate signs according to their shape. The classification criterion can be based on the idea of dividing the possible groups of traffic signs by color and shape, such as red circular, red triangular,and blue circular. In [5], different methods using the extracted corners are applied to the traffic-sign shapes, and in [14], color extraction is complemented with shape features using two NNs.Another method is used in [15]. After segmentation using a Bayes classifier, the scale-invariant feature transform that is presented in [16] is applied after the key points, which are going to represent each object that have been determined.In the recognition stage, an NN is used for the classification,following the Adap-tive Resonance Theory paradigm in [17].In [6], the identification of signs is carried out by a normalized correlation-based pattern matching using a traffic-sign database. In [18], the proposed sign recognition system consists of a nonlinear correlator. The scene and the reference pattern are both Fourier transformed and nonlinearly modified. The correlation plane between the input and the reference signs is obtained by the in-verse Fourier transform. In [19], the recognition is done using matching pursuit (MP) in two processes:1) training and 2) test. The training process finds a set of the best MP filter bases for each road sign. The testing process projects the input unknown road sign to a different set of MP filter bases to find the best match.Instead of recognition of road-sign symbols, a framework for detecting text on road signs from video is presented in [20]. The system finds a number of discrimina-tive feature points, which are easy to track, in the current video using the detector of Shi and Tomasi.Although many works are applied in a single-frame way, in[14], the detection system is sensitive to some particular image size, and a Kalman filter is used to track a sign through the frames until it is sufficiently large to be recognized as a specific standard sign. A more recent work [9] presents an automatic road-sign detection and recognition system that is based on a computational model of human visual recogni-tion processing.The system consists of three major components: 1) sensory;2) per-ceptual; and 3) conceptual analyzers. The sensory analyzer extracts the spatial and temporal information of interest from video sequences. The extracted information then serves as the input stimuli to a spatiotemporal attentional NN in the perceptualanalyzer. If the stimulation continues, the focuses of attention will be established in the NNs where the used features indicate the color horizontal projection of the road sign; they indicate good results because of the tracking system although they consider that road signs are always composed of a color rim with a black/white interior. The detected sign is normalized and correlated with all of the prototypes in [8]; a horizon-tal and vertical displacement of ±3 pixels is allowed.In order to reduce the computation time, in [19], color is used as apriori informa-tion, and the possible road location is limited to certain designated regions.。
霍夫变换(hough transform)

一、概述霍夫变换是一种常用的图像处理技术,它可以用于检测图像中的直线、圆或者其他形状。
它具有很好的鲁棒性,可以应对图像中存在的噪声和其他干扰。
霍夫变换在计算机视觉、图像处理和模式识别领域有着广泛的应用,成为了处理图像中几何形状的重要工具。
二、霍夫变换的原理霍夫变换最初是由美国科学家保罗·霍夫在1962年提出的,用于检测图像中的直线。
后来,霍夫变换被扩展到检测圆或者其他形状。
霍夫变换的基本原理是将空间域中的坐标转换到参数域中,在参数域中对应的曲线经过的点在空间域中具有共线的特点。
通过累加空间域中的点的参数,可以找到曲线或者形状的参数方程,从而实现对图像中形状的检测。
具体来说,对于检测直线来说,可以通过霍夫变换将直线表示为参数空间中的斜率和截距,从而可以在参数空间中进行累加,最终找到直线的参数方程。
三、霍夫变换在直线检测中的应用1. 边缘检测在使用霍夫变换检测直线之前,通常需要对图像进行边缘检测。
边缘检测可以帮助找到图像中明显的过渡区域,这些过渡区域通常对应着直线的轮廓。
常用的边缘检测算法包括Sobel算子、Canny算子等。
2. 参数空间的设置为了使用霍夫变换来检测直线,需要设定参数空间的范围。
对于直线检测来说,一般可以设定直线的斜率和截距的取值范围。
3. 累加过程在设定好参数空间后,需要对图像中的边缘点进行霍夫变换的累加过程。
对于每一个边缘点,都可以在参数空间中找到对应的直线,通过对参数空间的累加,可以找到参数空间中的峰值,这些峰值对应着图像中的直线。
4. 直线检测可以根据参数空间中的峰值来确定图像中的直线。
通常可以设定一个阈值来筛选参数空间中的峰值,从而得到最终的直线检测结果。
四、霍夫变换在圆检测中的应用除了直线检测,霍夫变换也可以用于检测图像中的圆。
与直线检测类似,圆检测也需要进行边缘检测和参数空间的设定。
不同的是,在圆检测中,需要设定圆心和半径的参数空间范围。
五、霍夫变换的改进和应用1. 累加数组的优化在传统的霍夫变换中,需要对参数空间进行离散化,这会导致计算量较大。
数学建模 建模答案.docx

programi :(1) function [accum, varargout] = CircularHough_Grd(img, radrange, varargin) %Detect circular shapes in a grayscale image. Resolve their center %positions and radii.%% [accum, circen, cirrad, dbg_LMmask] = CircularHough_Grd(% img, radrange, grdthres, fltr4LM_R, multirad, fltr4accum)% Circular Hough transform based on the gradient field of an image.% NOTE: Operates on grayscale images, NOT B/W bitmaps.% NO loops in the implementation of Circular Hough transform,% which means faster operation but at the same time larger% memory consumption.%%%%%%%%% INPUT: (img, radrange, grdthres, fltr4LM_R, multirad, fltr4accum) % % img: A 2-D grayscale image (NO B/W bitmap)%% radrange: The possible minimum and maximum radii of the circles% to be searched, in the format of% [minimum radius , maximum_radius] (unit: pixels)% **NOTE**: A smaller range saves computational time and% memory.%% grdthres: (Optional, default is 10, must be non-negative)% The algorithm is based on the gradient field of the% input image. A thresholding on the gradient magnitude% is performed before the voting process of the Circular% Hough transform to remove the Uniform intensity'% (sort-of) image background from the voting process.% In other words, pixels with gradient magnitudes smaller% than 'grdthres' are NOT considered in the computation.% **NOTE**: The default parameter value is chosen for% images with a maximum intensity close to 255. For cases% with dramatically different maximum intensities, e.g.% 10-bit bitmaps in stead of the assumed 8-bit, the default% value can NOT be used. A value of 4% to 10% of the maximum% intensity may work for general cases.%% fltr4LM_R: (Optional, default is 8, minimum is 3)% The radius of the filter used in the search of local% maxima in the accumulation array. To detect circles whose% shapes are less perfect, the radius of the filter needs% to be set larger.%% multirad: (Optional, default is 0.5)% In case of concentric circles, multiple radii may be% detected corresponding to a single center position. This% argument sets the tolerance of picking up the likely% radii values. It ranges from 0.1 to 1, where 0.1% corresponds to the largest tolerance, meaning more radii % values will be detected, and 1 corresponds to the smallest % tolerance, in which case only the "principal" radius will% be picked up.%% fltr4accum: (Optional. A default filter will be used if not given)% Filter used to smooth the accumulation array. Depending % on the image and the parameter settings, the accumulation % array built has different noise level and noise pattern% (e.g. noise frequencies). The filter should be set to an% appropriately size such that ifs able to suppress the% dominant noise frequency.%%%%%%%%% OUTPUT: [accum, circen, cirrad, dbg_LMmask]%% accum: The result accumulation array from the Circular Hough% transform. The accumulation array has the same dimension % as the input image.%% circen: (Optional)% Center positions of the circles detected. Is a N-by-2% matrix with each row contains the (x, y) positions% of a circle. For concentric circles (with the same center% position), say k of them, the same center position will% appear k times in the matrix.%% cirrad: (Optional)% Estimated radii of the circles detected. Is a N-by-1% column vector with a one-to-one correspondance to the% output tircen*. A value 0 for the radius indicates a% failed detection of the circle's radius.%% dbg_LMmask: (Optional, for debugging purpose)% Mask from the search of local maxima in the accumulation % array.%%%%%%%%%% EXAMPLE #0:% rawimg = imread('TestImg_CHT_a2.bmp');% tic;% [accum, circen, cirrad] = CircularHough_Grd(rawimg, [15 60]);% toe;% figure(l); imagesc(accum); axis image;% title(,Accumulation Array from Circular Hough Transfbrm,);% figure(2); imagesc(rawimg); colormap(,gray,); axis image;% hold on;% plot(circen(:,l), circen(:,2), *r+');% for k = 1 : size(circen, 1),% DrawCircle(circen(k, 1), circen(k,2), cirrad(k), 32,,b」);% end% hold off;% title([*Raw Image with Circles Detected% '(center positions and radii marked)*]);% figure(3); surf(accum, 'EdgeColoF, hone'); axis ij;% title('3-D View of the Accumulation Array*);%% COMMENTS ON EXAMPLE #0:% Kind of an easy case to handle. To detect circles in the image whose% radii range from 15 to 60. Default values for arguments 'grdthres',% 'fltr4LM_R', 'multirad* and ,fltr4accum, are used.%%%%%%%%%% EXAMPLE #1:% rawimg = imread('TestImg_CHT_a3.bmp');% tic;% [accum, circen, cirrad] = CircularHough_Grd(rawimg, [15 60], 10, 20);% toe;% figure(l); imagesc(accum); axis image;% title(,Accumulation Array from Circular Hough Transfbrm,);% figure(2); imagesc(rawimg); colormap('gray'); axis image;% hold on;% plot(circen(:,l), circen(:,2), T+');% for k = 1 : size(circen, 1),% DrawCircle(circen(k, 1), circen(k,2), cirrad(k), 32, 'b-');% end% hold off;% title([*Raw Image with Circles Detected% '(center positions and radii marked)*]);% figure(3); surf(accum, 'EdgeColoF, hone'); axis ij;% title(*3-D View of the Accumulation Array*);%% COMMENTS ON EXAMPLE #1:% The shapes in the raw image are not very good circles. As a result,% the profile of the peaks in the accumulation array are kind of% 'stumpy', which can be seen clearly from the 3-D view of the% accumulation array, (As a comparison, please see the sharp peaks in % the accumulation array in example #0) To extract the peak positions % nicely, a value of 20 (default is 8) is used for argument 'fltr4LM_R', % which is the radius of the filter used in the search of peaks.%%%%%%%%%% EXAMPLE #2:% rawimg = imread(,TestImg_CHT_b3 .bmp1);% fltr4img = [1 1 1 1 1; 1 2 2 2 1; 1 2 4 2 1; 1 2 2 2 1; 1 1 1 1 1];% fltr4img = fltr4img / sum(fltr4img(:));% imgfltrd = filter2( fltr4img , rawimg );% tic;% [accum, circen, cirrad] = CircularHough_Grd(imgfltrd, [15 80], 8, 10); % toe;% figure(l); imagesc(accum); axis image;% title(,Accumulation Array from Circular Hough Transfbrm,);% figure(2); imagesc(rawimg); colormap('gray'); axis image;% hold on;% plot(circen(:,l), circen(:,2), T+');% for k = 1 : size(circen, 1),% DrawCircle(circen(k, 1), circen(k,2), cirrad(k), 32, 'b-');% end% hold off;% title([*Raw Image with Circles Detected% '(center positions and radii marked)*]);%% COMMENTS ON EXAMPLE #2:% The circles in the raw image have small scale irregularities along % the edges, which could lead to an accumulation array that is bad for % local maxima detection. A 5-by-5 filter is used to smooth out the % small scale irregularities. A blurred image is actually good for the % algorithm implemented here which is based on the image's gradient % field.%%%%%%%%%% EXAMPLE #3:% rawimg = imread('TestImg_CHT_c3.bmp');% fltr4img = [1 1 1 1 1; 1 2 2 2 1; 1 2 4 2 1; 1 2 2 2 1; 1 1 1 1 1];% fltr4img = fltr4img / sum(fltr4img(:));% imgfltrd = filter2( fltr4img , rawimg );% tic;% [accum, circen, cirrad]=...% CircularHough_Grd(imgfltrd, [15 105], 8, 10, 0.7);% toe;% figure(l); imagesc(accum); axis image;% figure(2); imagesc(rawimg); colormap(,gray,); axis image;% hold on;% plot(circen(:,l), circen(:,2), *r+');% for k = 1 : size(circen, 1),% DrawCircle(circen(k, 1), circen(k,2), cirrad(k), 32,,b」);% end% hold off;% title([*Raw Image with Circles Detected% '(center positions and radii marked)*]);%% COMMENTS ON EXAMPLE #3:% Similar to example #2, a filtering before circle detection works for% noisy image too. 'multirad* is set to 0.7 to eliminate the false% detections of the circles* radii.%%%%%%%%%% BUG REPORT:% This is a beta version. Please send your bug reports, comments and% suggestions to pengtao@ . Thanks.%%%%%%%%%%% INTERNAL PARAMETERS:% The INPUT arguments are just part of the parameters that are used by% the circle detection algorithm implemented here. Variables in the code% with a prefix ,prm_, in the name are the parameters that control the% judging criteria and the behavior of the algorithm. Default values for% these parameters can hardly work for all circumstances. Therefore, at% occasions, the values of these INTERNAL PARAMETERS (parameters that% are NOT exposed as input arguments) need to be fine-tuned to make% the circle detection work as expected.% The following example shows how changing an internal parameter could% influence the detection result.% 1. Change the value of the internal parameter 'prm LM LoBndRa* to 0.4% (default is 0.2)% 2. Run the following matlab code:% fltr4accum = [1 2 1; 2 6 2; 1 2 1];% fltr4accum = fltr4accum / sum(fltr4accum(:));% rawimg = imread(,Frame_0_0022jportion.jpg,);% tic;% [accum, circen] = CircularHough_Grd(rawimg,...% [4 14], 10, 4, 0.5, fltr4accum);% toe;% figure(l); imagesc(accum); axis image;% title(*Accumulation Array from Circular Hough Transform*);% figure(2); imagesc(rawimg); colormap(,gray,); axis image;% hold on; plot(circen(:,l), circen(:,2), "); hold off;% title('Raw Image with Circles Detected (center positions marked)*);% 3. See how different values of the parameter 'prm LM LoBndRa* could % influence the result.% Author: Tao Peng% Department of Mechanical Engineering% University of Maryland, College Park, Maryland 20742, USA% pengtao@% Version: Beta Revision: Mar. 07, 2007%%%%%%%% Arguments and parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Validation of argumentsif ndims(img)〜=2 || 〜isnumeric(img),error(*CircularHough_Grd: "img" has to be 2 dimensionaf);endif 〜all(size(img) >= 32),erro^'CircularHough Grd: "img" has to be larger than 32-by-32');endif numel(radrange)〜=2 || -isnumeric(radrange),error([*CircularHough_Grd: "radrange" has to be \ ...'a two-element vector1]);endprm_r_range = sort(max( [0,0;radrange( 1 ),radrange(2)]));% Parameters (default values)prmgrdthres = 10;prmfltrLMR = 8;prmmultirad = 0.5;funccompucen = true;funccompuradii = true;% Validation of argumentsvapgrdthres = 1;if nargin > (1 + vap_grdthres),if isnumeric(varargin{vap grdthres}) && ...varargin(vap grdthres} (1) >= 0,prm_grdthres = varargin {vapgrdthres} (1);elseerror(['CircularHough_Grd: "grdthres" has to be'a non-negative number1]);endendvap_fltr4LM = 2; % filter for the search of local maximaif nargin > (1 + vap_fltr4LM),if isnumeric(varargin{vap_fltr4LM}) && varargin{vap_fltr4LM}(1) >= 3, prmfltrLMR = varargin{vap_fltr4LM} (1);elseerror([,CircularHough_Grd: n fltr4LM_R n has to belarger than or equal to 3']);endendvap_multirad = 3;if nargin > (1 + vap multirad),if isnumeric(varargin{vap_multirad}) && ...varargin{vap multirad}(1) >= 0.1 && ...varargin {vap multirad} (1) <= 1,prmmultirad = varargin {vap_mul tirad} (1);elseerror(['CircularHough_Grd: "multirad" has to be'within the range [0.1, 1]*]);endendvap_fltr4accum = 4; % filter for smoothing the accumulation arrayif nargin > (1 + vap_fltr4accum),if isnumeric(varargin{vap_fltr4accum}) && ...ndims(varargin{vap_fltr4accum}) == 2 && ...all(size(varargin {vap_fltr4accum}) >= 3),fltr4accum = varargin {vap_fltr4accum};elseerror(['CircularHough_Grd: n fltr4accum n has to be \ ...*a 2-D matrix with a minimum size of 3-by-3']);endelse% Default filter (5-by-5)fltr4accum = ones(5,5);fltr4accum(2:4,2:4) = 2;fltr4accum(3,3) = 6;end func_compu_cen = (nargout > 1 );func_compu_radii = (nargout > 2 );% Reserved parametersdbg on = false; % debug information dbgbfigno = 4;if nargout > 3, dbg on = true; end%%%%%%%% Buildingaccumulation array %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Convert the image to single if it is not of% class float (single or double) img_is_double = isa(img, double');if ~(img_is_double || isa(img, 'single')),imgf = single(img);end% Compute the gradient and the magnitude of gradientif img_is_double,[grdx, grdy] = gradient(img);else[grdx, grdy] = gradient(imgf);endgrdmag = sqrt(grdx.A2 + grdy.A2);% Get the linear indices, as well as the subscripts, of the pixels% whose gradient magnitudes are larger than the given threshold grdmasklin = find(grdmag > prm_grdthres);[grdmask_ldxl, grdmask_IdxJ] = ind2sub(size(grdmag), grdmasklin);% Compute the linear indices (as well as the subscripts) of% all the votings to the accumulation array.% The Matlab function 'accumarray* accepts only double variable, % so all indices are forced into double at this point.% A row in matrix ,lin2accum_aJ, contains the J indices (into the % accumulation array) of all the votings that are introduced by a % same pixel in the image. Similarly with matrix linZaccum aP. rr_41inaccum = double( prm_r_range );linaccum_dr = [ (-rr_41inaccum(2) + 0.5) : -rr_41inaccum(l),... (rr_41inaccum(l) + 0.5) : rr_41inaccum(2)];lin2accum_aJ = floor(...double(grdx(grdmasklin)./grdmag(grdmasklin)) * linaccum_dr + ...repmat( double(grdmask_IdxJ)+0.5 , [ 1 ,length(linaccum_dr)])...);lin2accum_al = floor(...double(grdy(grdmasklin)./grdmag(grdmasklin)) * linaccum dr + ...repmat( double(grdmask_IdxI)+0.5 , [1 ,length(linaccum_dr)])...);% Clip the votings that are out of the accumulation arraymask_valid_a J al =...lin2accum_aJ > 0 & lin2accum_aJ < (size(grdmag,2) + 1) & ...Iin2accum_al > 0 & lin2accum_al < (size(grdmag,l) + 1);mask_valid_aJaI_reverse =〜mask_valid_aJaI;lin2accum_aJ = lin2accum_aJ .* maskvalida J al + maskvalidaJ alreverse;lin2accum_al = lin2accum_al .* mask_valid_aJaI + mask_valid_aJaI_reverse;clear mask_valid_aJ alre verse;% Linear indices (of the votings) into the accumulation arraylin2accum = sub2ind( size(grdmag), lin2accum_al, lin2accum_aJ );lin2accum_size = size( lin2accum );lin2accum = reshape( lin2accum, [numel(lin2accum),l]);clear lin2accum_al lin2accum_aJ;% Weights of the votings, currently using the gradient maginitudes% but in fact any scheme can be used (application dependent)weight4accum =...repmat( double(grdmag(grdmasklin)) , [lin2accum_size(2), 1 ]) .* ...mask_valid_aJ al(:);clear mask_valid_aJaI;% Build the accumulation array using Matlab function 'accumarray'accum = accumarray( lin2accum , weight4accum );accum = [ accum ; zeros( numel(grdmag) - numel(accum), 1 )];accum = reshape( accum, size(grdmag));%%%%%%%% Locating local maxima in the accumulation array %%%%%%%%%%%%% Stop if no need to locate the center positions of circlesif ~func_compu_cen,return;endclear lin2accum weight4accum;% Parameters to locate the local maxima in the accumulation array% — Segmentation of 'accum' before locating LM prmuseaoi = true;prm_aoithres_s = 2;prm aoiminsize = floor(min([ min(size(accum)) * 0.25,... prm_r_range(2) * 1.5 ]));% — Filter for searching for local maxima prmfltrLMs = 1.35;prm fltrLM r = ceil( prm fltrLM R * 0.6 );prm fltrLM npix = max([ 6, ceil((prm_fltrLM_R/2)A 1.8)]);% — Lower bound of the intensity of local maximaprm LM LoBndRa = 0.2; % minimum ratio of LM to the max of'accum'% Smooth the accumulation arrayfltr4accum = fltr4accum / sum(fltr4accum(:));accum = filter2( fltr4accum, accum );% Select a number of Areas-Of^Interest from the accumulation array if prmuseaoi, % Threshold value for 'accum1prm_llm_thresl = prm_grdthres * prm_aoithres_s;% Thresholding over the accumulation array accummask = ( accum > prm llm thres 1 );% Segmentation over the mask[accumlabel, accum nRgn] = bwlabel( accummask, 8 );% Select AOIs from segmented regionsaccumAOI = ones(0,4);for k = 1 : accum nRgn,accumrgn lin = find( accumlabel = k);[accumrgn_ldxl, accumrgn_IdxJ]=...ind2sub( size(accumlabel), accumrgn lin);rgn top = min( accumrgn ldxl);rgn bottom = max( accumrgn_ldxl);rgn left = min( accumrgn ldxJ );rgn_right = max( accumrgn ldxJ );% The AOIs selected must satisfy a minimum sizeif ((rgn_right - rgn_left + 1) >= prm_aoiminsize && ...(rgn_bottom - rgn top + 1) >= prm aoiminsize ),accumAOI = [ accumAOI;...rgn top, rgn bottom, rgn left, rgn right ];endendelse% Whole accumulation array as the one AOIaccumAOI = [1, size(accum,l), 1, size(accum,2)];end% Thresholding of 'accum' by a lower boundprm LM LoBnd = max(accum(:)) * prm LM LoBndRa;% Build the filter for searching for local maxima fltr4LM = zeros(2 * prm_fltrLM_R + 1);[mesh4fLM_x, mesh4fLM_y] = meshgrid(-prm_fltrLM_R : prm fltrLM R);mesh4fLM_r = sqrt( mesh4fLM_x.A2 + mesh4fLM_y.A2 );fltr4LM_mask =...(mesh4fLM_r > prm_fltrLM_r & mesh4fLM_r <= prm fltrLM R );fltr4LM = fltr4LMfltr4LM_mask * (prm fltrLM s / sum(fltr4LM_mask(:)));if prm_fltrLM_R >= 4,fltr4LM_mask = ( mesh4fLM_r < (prm_fltrLM_r - 1));elsefltr4LM_mask = ( mesh4fLM_r < prm fltrLM r );endfltr4LM = fltr4LM + fltr4LM mask / sum(fltr4LM_mask(:));% **** Debug code (begin)if dbg_on,dbg_LMmask = zeros(size(accum));end% **** Debug code (end)% For each of the AOIs selected, locate the local maximacircen = zeros(0,2);fbrk = 1 : size(accumAOI, 1),aoi = accumAOI(k,:); % just for referencing convenience% Thresholding of 'accum* by a lower boundaccumaoi_LBMask =...(accum(aoi(l):aoi(2), aoi(3):aoi(4)) > prm LM LoBnd );% Apply the local maxima filtercandLM = conv2( accum(aoi( 1):aoi(2), aoi(3):aoi(4)),...fltr4LM, 'same*);candLM mask = ( candLM > 0 );% Clear the margins of 'candLM mask*candLM_mask([l :prm_fltrLM_R, (end-prm_fltrLM_R+l):end], :) = 0;candLM mask(:, [l:prm_fltrLM_R, (end-prm_fltrLM_R+l):end]) = 0;% **** Debug code (begin)if dbg_on,dbg_LMmask(aoi( 1 ):aoi(2), aoi(3):aoi(4))=...dbg_LMmask(aoi( 1 ):aoi(2), aoi(3):aoi(4)) + ...accumaoi LBMask + 2 * candLM mask;end% **** Debug code (end)% Group the local maxima candidates by adjacency, compute the% centroid position for each group and take that as the center% of one circle detected[candLM label, candLM nRgn] = bwlabel( candLM_mask, 8 );fbr ilabel = 1 : candLM nRgn,% Indices (to current AOI) of the pixels in the groupcandgrp masklin = find( candLM label == ilabel);[candgrp_ldxl, candgrp_IdxJ]=...ind2sub( size(candLM label), candgrp masklin );% Indices (to 'accum') of the pixels in the groupcandgrp_ldxl = candgrp_ldxl + ( aoi(l) - 1 );candgrp IdxJ = candgrp IdxJ + ( aoi(3) - 1 );candgrp_idx2acm =...sub2ind( size(accum) , candgrp ldxl, candgrp IdxJ );% Minimum number of qulified pixels in the groupif sum(accumaoi_LBMask(candgrp_masklin)) < prm_fltrLM_npix, continue;end% Compute the centroid positioncandgrp_acmsum = sum( accum(candgrp_idx2acm));cc_x = sum( candgrp IdxJ .* accum(candgrp_idx2acm) ) / ...candgrpacmsum;cc_y = sum( candgrp_ldxl .* accum(candgrp_idx2acm) ) / ...candgrpacmsum;circen = [circen; cc_x, cc_y];endend% **** Debug code (begin)if dbg_on,figure(dbg bfigno); imagesc(dbg LMmask); axis image;title(*Generated map of local maxima1);if size(accumAOI, 1) == 1,figure(dbg_bfigno+1);surf(candLM, 'EdgeColor1, hone'); axis ij;title(,Accumulation array after local maximum filtering*);endend% **** Debug code (end)%%%%%%%% Estimation of the Radii of Circles %%%%%%%%%%%%% Stop if no need to estimate the radii of circlesif ~func_compu_radii,varargout{l} = circen;return;end% Parameters for the estimation of the radii of circlesfltr4SgnCv=[2 1 1];fltr4SgnCv = fltr4SgnCv / sum(fltr4SgnCv);% Find circle's radius using its signature curve cirrad = zeros( size(circen,l), 1 );for k = 1 : size(circen,l),% Neighborhood region of the circle for building the sgn. curve circen_round = round( circen(k,:));SCvR IO = circen_round(2) - prm_r_range(2) - 1;ifSCvR_IO<l,SCvR_I0= 1;endSCvRIl = circen_round(2) + prm_r_range(2) + 1;if SCvR Il > size(grdx,l),SCvRIl = size(grdx,l);endSCvR JO = circen round(l) - prm_r_range(2) - 1;ifSCvR_JO<l,SCvRJO = 1;endSCvRJ 1 = circenround(l) + prm_r_range(2) + 1;if SCvR Jl > size(grdx,2),SCvRJl = size(grdx,2);end% Build the sgn. curveSgnCvMat_dx = repmat( (SCvR J0:SCvR J 1) - circen(k,l),...[SCvRJl - SCvRJO +1,1]);SgnCvMat_dy = repmat( (SCvR_IO:SCvR_Il)' - circen(k,2),...[1 , SCvRJl - SCvRJO + 1]);SgnCvMat_r = sqrt( SgnCvMat dx .A2 + SgnCvMat_dy .A2 );SgnCvMatrpl = round(SgnCvMatr) + 1;f4SgnCv = abs(...double(grdx(SCvR_IO:SCvR_Il, SCvRJO:SCvRJ 1)) .* SgnCvMat_dx + ...double(grdy(SCvR_IO:SCvR Il, SCvR JO:SCvR J 1)) .* SgnCvMat dy...)./ SgnCvMat r;SgnCv = accumarray( SgnCvMat rp 1(:) , f4SgnCv(:));SgnCv_Cnt = accumarray( SgnCvMat rp 1 (:) , ones(numel(f4SgnCv), 1));SgnCv_Cnt = SgnCv_Cnt + (SgnCv_Cnt == 0);SgnCv = SgnCv ./ SgnCv_Cnt;% Suppress the undesired entries in the sgn. curve% ― Radii that correspond to short arcsSgnCv = SgnCv .* ( SgnCv_Cnt >= (pi/4 * [O:(numel(SgnCv_Cnt)-1 )]*));% ― Radii that are out of the given rangeSgnCv( 1 : (round(prm_r_range( 1))+1) ) = 0;SgnCv( (round(prm_r_range(2))+1) : end ) = 0;% Get rid of the zero radius entry in the arraySgnCv = SgnCv(2:end);% Smooth the sgn. curveSgnCv = filtfilt( fltr4SgnCv , [1] , SgnCv );% Get the maximum value in the sgn. curveSgnCv_max = max(SgnCv);if SgnCv_max <= 0,cirrad(k) = 0;continue;end% Find the local maxima in sgn. curve by 1st order derivatives% ― Mark the ascending edges in the sgn. curve as Is and% ― descending edges as OsSgnCv AscEdg = ( SgnCv(2:end) - SgnCv(l:(end-l)) ) > 0;% ― Mark the transition (ascending to descending) regionsSgnCv LMmask = [ 0; 0; SgnCv_AscEdg(l:(end-2)) ] & (〜SgnCv_AscEdg);SgnCv LMmask = SgnCvLMmask & [ SgnCv_LMmask(2:end); 0 ];% Incorporate the minimum value requirementSgnCvLMmask = SgnCvLMmask & ...(SgnCv(l:(end-l)) >= (prm_multirad * SgnCv_max));% Get the positions of the peaksSgnCv LMPos = sort( find(SgnCv_LMmask));% Save the detected radiiif isempty(SgnCvLMPos),cirrad(k) = 0;elsecirrad(k) = SgnCvLMPos(end);for i radii = (length(SgnCv LMPos) - 1) : -1 : 1,circen = [ circen; circen(k,:)];cirrad = [ cirrad; SgnCv_LMPos(i_radii)];endendend% Outputvarargout{l} = circen;varargout{2} = cirrad;if nargout > 3,varargout{3} = dbg_LMmask;endprograms:programs:2 function DrawCircle (x, y, r, nseg, S)% Draw a circle on the current figure using ploylines%% DrawCircle (x, y, r, nseg, S)% A simple function for drawing a circle on graph.%% INPUT: (x, y, r, nseg, S)% x, y: Center of the circle% r: Radius of the circle% nseg: Number of segments for the circle% S: Colors, plot symbols and line types%% OUTPUT: None%% BUG REPORT:% Please send your bug reports, comments and suggestions to% pengtao@glue. umd. edu . Thanks.% Author: Tao Peng% Department of Mechanical Engineering% University of Maryland, College Park, Maryland 20742, USA % pengtao@glue. umd. edu% Version: alpha Revision: Jan. 10, 2006theta = 0 : (2 * pi / nseg) : (2 * pi);pline_x 二r * cos(theta) + x;pline_y 二r * sin(theta) + y;plot (pline_x, pline_y, S);3function testiml二imread (' image 1. jpg');% rawimg = imread(,TestImg_CHT_c3. bmp J);rawimg=rgb2gray(iml);tic;[accum, circen, cirrad] = CircularHough_Grd(rawimg, [20 30], 5,50);circentoe;figure(1) ; imagesc(accum); axis image;title (J Accumulation Array from Circular Hough Transform,); figure (2) ; imagesc (rawimg) ; colormap (J gray,) ; axis image; hold on;plot (circen(:, 1), circen(:, 2), ' r+');for k = 1 : size (circen, 1),DrawCircle (circen (k, 1), circen (k, 2), cirrad (k), 32, ' b-'); end hold off; title(f Raw Image with Circles Detected ...'(center positions and radii marked)']);figure (3); surf(accum, ' EdgeColor,, ' none5); axis ij; title (J 3-D View of the Accumulation Array');附带图像image 1. jpg直接运行test.m即可得到上方的结果!当然方法是活的,只要合理即可行。
一种正六边形检测方法的研究
一种正六边形检测方法的研究周志峰【摘要】A vision detection method based on geometric characteristics to detect regular hexagon is proposed. Hough transform and the regular hexagon characteristics are briefly introduced, and the detection of regular hexagon is decomposed into the line detection,the circle detection, the calculation of the lengths of line segments and the angles between adjacent lines. Based on the detected line segments, the line equations are constructed in the image plane. The intersection points of adjacent lines and the angles between two adjacent lines are calculated by the constructed line equations. The length of every side of regular hexagon is obtained by computing the distance between the two adjacent intersection points. The circle detection method based on Hough transform is employed to inspect whether all intersection points locate at the same circumference. The detection experiment of hexagon bolt is carried out to illustrate the performance of the presented method. The measurement errors of angles and side lengths of regular hexagon are 0. 38% and 0. 85% respectively. The result shows that the method is valid and can detect regular hexagon in the image precisely.%提出了一种基于几何特征的正六边形检测方法.在简述Hough变换原理和正六边形特点的基础上,把正六边形的检测分解成直线和圆的检测,以及线段长度和直线夹角的计算.利用检测到的直线,在图像平面内建立直线方程,依据直线方程,计算相邻两条直线的夹角和交点,求出每条边的长度,同时检测6个交点是否均匀分布在同一圆周上.在螺栓头部正六边形检测实验中,角度测量误差为0.38%,边长测量误差为0.85%.结果表明,该方法是有效的,能准确地检测出图像中的正六边形.【期刊名称】《应用光学》【年(卷),期】2012(033)001【总页数】5页(P129-133)【关键词】正六边形检测;视觉检测;Hough变换;六角螺栓【作者】周志峰【作者单位】上海工程技术大学机械工程学院,上海201620【正文语种】中文【中图分类】TN911.72引言计算机视觉检测具有非接触、速度快、精度高、抗干扰能力强等优点,在机械加工精度检测[1-2]、工件尺寸测量[3-6]、产品检测[7-8]等方面正得到越来越广泛的应用,为非接触测量提供了一个理想的手段。
翻译原文
Traffic Light Detection with Color and EdgeInformationMasako Omachi Shinichiro OmachiFaculty of Science and Technology Graduate School of Engineering Tohoku Bunka Gakuen University Tohoku UniversitySendai, Japan Sendai, Japan fan@ait.tbgu.ac.jp machi@ecei.tohoku.ac.jpAbstract—The concern of the intelligent transportation systemrises and many driver support systems have been developed. Inthis paper, a fast method of detecting a traffic light in a sceneimage is proposed. By converting the color space from RGB tonormalized RGB, some regions are selected as candidates of a traffic light. Then a method based on the Hough transform isapplied to detect an exact region.Experimental results usingimages including a traffic light verifies the effectiveness of theproposed method.Keywords-image recognition; traffic light; intelligenttransportation system; driver support system; Hough transformI. INTRODUCTIONThe concern of the intelligent transportation system rises and many driver support systems have been developed.Especially, systems that use images are paid attentionrecently. Some systems that recognize lanes or license plateshave been put into practical use. Researches on recognition and understanding of road environments like surrounding cars and road signs are investigated. Forexample,Maldonado-Bascón et al. proposed a road-sign detection and recognition system [8]. In their system, a sign is segmented from a scene image by color information, and its shape is classified by the support vector machine. Fang et al. proposed a framework for detecting and recognizing road signs with a computationalmodel based on the human cognitive processes [2]. Varun et al. proposed a traffic sign recognition system based on the template matching method [10].Recognizing traffic lights are important for safety driving.If it is possible to detect and recognize a traffic light, it will give useful information to a driver to understand the road environment. However, it is not easy to detect a traffic light in a scene image since the traffic light is very small compared to other objects and there are many objects of which colors are similar to one of the traffic lights. Therefore, there are not so many researches on this topic. Lindner et al.proposed a detection and recognition system of traffic lights[6]. Their method uses GPS data and digital maps along withan image taken by a camera in order to enhance the performance of the system. In this paper, we propose a method of detecting a traffic light from a single scene image taken by an in-vehicle camera. For detecting general object from a scene image, a lot of techniques have been proposed. The template matching is one of the most fundamental ones. Given a template and an input image, a region that is the most similar to the template is selected with a criterion such as the normalized cross correlation or the sum of squared differences [1]. However, the major drawback of the template matching is the high computational complexity. Using color histogram is another method for detecting an object [9]. Since Vinod and Murase developed a fast searching method using the color histogram, it is widely used for object detection [11]. However, a lot of objects in a scene image of which colors are similar to the one of the traffic lights. Detecting key points and matching with the features of the key points achieves a robust matching [7]. However, the shape of a traffic light is so simple that it does not have many distinctive key points.Since the shape of a traffic light is a circle, we can find a traffic light from a scene image by detecting a filled circle of which color is the one of the traffic lights. The Hough transform is a traditional method for detecting a shape that can be expressedby a mathematical expression from an image [5]. Although it cannot be used for detecting complicated shapes, it can be used for detecting a circle. Since an expression of a circle has three parameters, in order to detect a circle with the Hough transform, voting into the three-dimensional parameter space is necessary, which is a time-consuming task. In order to reduce the computation time and enhance the stability of detection, we propose a method for modifying the voting process of the Hough transform.In addition, we have to deal with various lighting conditions. If the lighting condition changes, the color of the traffic light will also change. In order to achieve astable detection, we have to convert the color space from RGB to an appropriate one. We chose the normalized RGB color space since it has been reported that the normalized RGB is robust under illumination changes [3]. Experimental results using real scene images including a traffic light verifies the effectiveness of the proposed method.II. PROPOSED METHODFig. 1 shows an example of a scene image including traffic lights. In the proposed method, given a scene image, first the color space is converted from RGB to the normalized RGB. Then, some candidate regions for a trafficlight are detected by remaining the pixels of which colors are the ones of traffic lights. Next, edges are detected from theFigure 2. Flow of the proposed methodremaining pixels. Finally, a circle which represents a traffic light is detected by the method based on the Hough transform. The flowchart of the proposed method is shown in Fig. 2.A. Converting Color SpaceThe colors of traffic lights differ depending on the change in the lighting conditions caused by weather, time and other factors. In order to eliminate the slight change in the color, we convert the color space. It is known that the normalized RGB is robust under the change in the lightingconditions [3]. Therefore, we convert an RGB image into a normalized RGB one. Suppose the red, green and blue values of a pixel be r , g and b , respectively. The values of the normalized RGB R , G and B are defined as:R G B===( if 0s=),,r g bR G Bs s s===(otherwise)wheres = r + g + b .Fig. 3(a) is the normalized RGB image converted from the input image(a)Normalized RGB image. (b) Candidate regions.(c) Edges. (d) Detected traffic light.Figure 3. Intermediate images of the proposed method.B. Extraction of Candidate RegionsFrom the normalized RGB image, some regions are extracted as candidates for a traffic light. The decision whether a pixel belongs to one of the candidate regions or not is done by the values of R , G and B . We observed the images of the traffic lights and determined the condition that a pixel belongs to a candidate region as follows:( R >200 and G<150 and B< 150 )or ( R >200 and G >150 and B< 150 )or ( R < 150 and G>240 andB> 220)Connected regions obtained by the selected pixels are the candidate regions of a traffic light. Fig. 3(b) shows the regions that are the candidates of a traffic light.C. Edge DetectionWe extract only the candidate regions from the image and edges are detected from the image. We used the Sobel filter [4] to detect edges. Fig. 3(c) shows the edges detected from the image of Fig. 3(b).D. Detection of a Traffic LightIn order to detect a traffic light, a filled circle of which color is the one of the trafficlights is detected. In the framework of the Hough transform, edge image is used and circular edges are detected. A simple equation of a circle:(x - a) 2 +( y - b)2 = r2 , (2)can be used to detect a circle from the edge image. For each pixel that is on a detected edge, voting into the threedimensional parameter space ( a , b and r ) is done. The set of parameters that gets the most votes represents the position and the size of the traffic light.However, in this framework, filled circles and open circles are both detected. In order to avoid this shortcoming and speed up the detection, we utilize the candidate regions displayed in Fig. 3(b). Fig. 4 shows an example. Suppose the gray and black pixels in Fig. 4(a) are the ones of a traffic light. In the Hough transform, for each pixel (x, y) , voting is done in the three-dimensional parameter space with (2). Black pixels in Fig. 4(b) show the results of voting for the black pixel in Fig. 4(a) into the ab-plane where the value of r is fixed. Suppose the candidate region corresponding to the edges of Fig. 4(a) is shown in Fig. 4(c). In the proposed framework, voting is done only if the pixel (a,b) and its four-neighbors belong to the candidate regions. The result of voting in the ab -plane by the proposed method is shown as the black pixels in Fig. 4(d). Fig. 3(d) displays the result of detection. The white circle represents the detected region.III. EXPERIMENTIn order to confirm the effect of the proposed method, an experiment of detecting a traffic light from a scene image was carried out.A. DataAs far as the authors know, there is no database of traffic lights. Therefore, we took pictures including traffic lights by a digital camera (Fujifilm FinePix F31) through a windshield of a car. Thirty images were used for evaluation.B. Results and DiscussionsWe compared the proposed method and the method in which the traditional Hough transform was used for detecting a circle. The detection accuracies (number of correctly detected traffic lights) and the averaged processing times are shown in Table I. The processing time for each image is displayed in Fig. 5. The results show that the proposed method can detect a traffic light in a reasonable time and the accuracy is better than the traditional method.The proposed method not only improves the processing time but also the detectionaccuracy. This is because a lot of open circle objects exist in a scene image. Typical ones are traffic signs. An example is shown in Fig. 6. Fig 6(a) displays an image that the traditional method failed to detect a traffic light, while the traffic light was correctly detectedTABLE I. ACCURACY AND AVERAGED PROCESSING TIMEBy the proposed method. The detected traffic sign has large white area in it. In the traditional method, only the circular edges are detected and it does not take into account whether there is a part of which color is not the one of the traffic light. Fig.6(b) is the result by the proposed method. In the proposed method, since filled circles tend to be detected and the traffic light was correctly detected.There was no image that the proposed method failed and the traditional method succeeded. Fig. 7 is an example of the image that both method failed to detect a traffic light. In this image, the traffic light is too small compared to other objects that have a similar shape or the same color. A traffic sign and a tail lamp were detected by the traditional method and the proposed method. Since we can predict the position of a traffic light in the image if the position of the camera is fixed, it will be effective for improving the accuracy to consider the position of the detected area.IV. CONCLUSIONSIn this paper, a method for detecting a traffic light from a scene image was proposed. First a color space is converted from RGB to the normalized RGB in order to eliminate the effect of the change in the lighting condition. Then candidate regions of a traffic light are detected using color information, and edges are detected. Finally, a traffic light is detected by the method based on the Hough transform.Experimental results show that the proposed method can detect a traffic light in a reasonable time and the accuracy is better than the traditional method. In order to improve the accuracy, taking into account the position of the detected area in an image is a future work. Moreover, a large-scale experiment with a lot of images is necessary to evaluate the proposed method. This is another future work.(a) Traditional method. (b) Proposed method.Figure 6. The image that the traditional method failed.(a) Traditional method. (b) Proposed method.Figure 7. The image that both methods failed.ACKNOWLEDGMENTThe authors would like to thank Prof. Hirotomo Aso from Tohoku University and Prof. Tsuneo Saito from Tohoku Bunka Gakuen University for their fruitful comments. This research is partially supported by the Ministry of Education, Science, Sports and Culture, Grantin- Aid for Exploratory Research, 20650024, 2008, and Grant-in-Aid for Scientific Research, 20500150, 2008REFERENCES[1] R. O. Duda and P. E. Hart, Pattern Classification and Scene Analysis, John Wiley & Sons, Inc., New York, 1973.[2] C. Y. Fang, C. S. Fuh, S. W. Chen, and P. S. Yen, “A road ”sign recognition system based on dynamic visual model,” Proceedings of the 2003 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’03), vol.1, pp. 750–755, June 2003.[3] T. Gevers and A.W.M. Smeulders, “Color Based Object Recognition,” Pattern Recognition, vol. 32, no. 3, pp. 453–464, March 1999. [4] R. C. Gonzalez and R. E. Woods, Digital Image Processing, second edition, Prentice-Hall, Inc., 2002.[5] P. V. C. Hough, “Machine analysis of bubble chamber pictures,” Proceedings of the the International Conference on High Energy Accelerators and Instrumentation, pp. 554–556, September 1959.[6] F. Lindner, U. Kressel, and S. Kaelberer, “Robust recognition of traffic signals,” Proceedings of the 2004 IEEE International Vehicle Symposium, pp. 49–53, June 2004.[7] D. G. Lowe, “Distinctive Image Features from Scale-Invariant Keypoints,” International Journal of Computer Vision, vol. 60, no. 2, pp. 91–110, 2004.[8] S. Maldonado-Bascón, S. Lafuente-Arroyo, P. Gil-Jiménez, H. Gómez-Moreno, and F. López-Ferreras, “Road-Sign Detection and Recognition Based on Support Vector Machines,” IEEE Transactions on Intelligent Transportation Systems, vol. 8, no. 2, pp. 264–278, June 2007.[9] M. J. Swain, and D. H. Ballard, “Color Indexing,” International Journal of Computer Vision, vol. 7, no. 9, pp.11–32, 1991.[10] S. Varun, S. Singh, R. S. Kunte, R. D. S. Samuel, and B. Philip, “A Road Traffic Signal Recognition System Based on Template Matching Employing Tree Classifier,” Proceedings of the International Conference on Computational Intelligence and Multimedia Applications (ICCIMA 2007), vol. 3, pp. 360–365, 2007.[11] V. V. Vinod and H. Murase, “Focused color intersection with efficient searching for object extraction,” Pattern Recognition, vol. 30, no. 10, pp. 1787–1797, October 1997.Connected regions obtained by the selected pixels are the candidate regions of a traffic light. Fig. 3(b) shows the regions that are the candidates of a traffic light。
纹理物体缺陷的视觉检测算法研究--优秀毕业论文
摘 要
在竞争激烈的工业自动化生产过程中,机器视觉对产品质量的把关起着举足 轻重的作用,机器视觉在缺陷检测技术方面的应用也逐渐普遍起来。与常规的检 测技术相比,自动化的视觉检测系统更加经济、快捷、高效与 安全。纹理物体在 工业生产中广泛存在,像用于半导体装配和封装底板和发光二极管,现代 化电子 系统中的印制电路板,以及纺织行业中的布匹和织物等都可认为是含有纹理特征 的物体。本论文主要致力于纹理物体的缺陷检测技术研究,为纹理物体的自动化 检测提供高效而可靠的检测算法。 纹理是描述图像内容的重要特征,纹理分析也已经被成功的应用与纹理分割 和纹理分类当中。本研究提出了一种基于纹理分析技术和参考比较方式的缺陷检 测算法。这种算法能容忍物体变形引起的图像配准误差,对纹理的影响也具有鲁 棒性。本算法旨在为检测出的缺陷区域提供丰富而重要的物理意义,如缺陷区域 的大小、形状、亮度对比度及空间分布等。同时,在参考图像可行的情况下,本 算法可用于同质纹理物体和非同质纹理物体的检测,对非纹理物体 的检测也可取 得不错的效果。 在整个检测过程中,我们采用了可调控金字塔的纹理分析和重构技术。与传 统的小波纹理分析技术不同,我们在小波域中加入处理物体变形和纹理影响的容 忍度控制算法,来实现容忍物体变形和对纹理影响鲁棒的目的。最后可调控金字 塔的重构保证了缺陷区域物理意义恢复的准确性。实验阶段,我们检测了一系列 具有实际应用价值的图像。实验结果表明 本文提出的纹理物体缺陷检测算法具有 高效性和易于实现性。 关键字: 缺陷检测;纹理;物体变形;可调控金字塔;重构
Keywords: defect detection, texture, object distortion, steerable pyramid, reconstruction
II
图像处理专业英语词汇
FFT 滤波器FFT filtersVGA 调色板和许多其他参数VGA palette and many others 按名称排序sort by name包括角度和刻度including angle and scale保持目标keep targets保存save保存和装载save and load饱和度saturation饱和加法和减法add and subtract with saturate背景淡化background flatten背景发现find background边缘和条纹测量Edge and Stripe/Measurement边缘和条纹的提取find edge and stripe编辑Edit编辑edit编辑或删除相关区域edit or delete relative region编码Code编码条Coda Bar变换forward or reverse fast Fourier transformation变量和自定义的行为variables and custom actions变量检测examine variables变形warping变形系数warping coefficients标题tile标注和影响区域label and zone of influence标准normal标准偏差standard deviation表面弯曲convex并入图像merge to image采集栏digitizer bar采集类型grab type菜单形式menu item参数Preferences参数轴和角度reference axis and angle测量measurement测量方法提取extract measurements from测量结果显示和统计display measurement results and statistics测量转换transfer to measurement插入Insert插入条件检查Insert condition checks查找最大值find extreme maximum长度length超过50 个不同特征的计算calculate over 50 different features area 撤销次数number of undo levels乘multiply尺寸size处理Processing处理/采集图像到一个新的窗口processed/grabbed image into new window 窗口window窗口监视watch window窗位window leveling创建create垂直边沿vertical edge从表格新建new from grid从工具条按钮from toolbar button从用户窗口融合merge from user form粗糙roughness错误纠正error correction错误匹配fit error打开open打开近期的文件或脚本open recent file or script打印print打印设置print setup打印预览print preview大小和日期size and date带通band pass带有调色板的8- bit带有动态预览的直方图和x, y 线曲线椭圆轮廓histogram and x, y line curve ellipse profiles with dynamic preview带阻band reject代码类型code type单步single step单一simple单帧采集snap shot导入VB等等etc.低通low pass第一帧first点point调色板预览palette viewer调试方式debug mode调用外部的DLL调整大小resize调整轮廓滤波器的平滑度和轮廓的最小域值adjust smoothness of contour filter and minimum threshold for contours定点除fixed point divide定位精度positional accuracy定义一个包含有不相关的不一致的或无特征区域的模板define model including mask for irrelevant inconsistent or featureless areas定制制定-配置菜单Customize - configure menus动态预览with dynamic preview读出或产生一个条形或矩阵码read or generate bar and matrix codes读取和查验特征字符串erify character strings断点break points对比度contrast对比度拉伸contrast stretch对称symmetry对模板应用“不关心的”像素标注apply don't care pixel mask to model 多边形polygon二进制binary二进制分离separate binary二值和灰度binary and grayscale翻转reverse返回return放大或缩小7 个级别zoom in or out 7 levels分类结果sort results分水岭Watershed分析Analysis分组视图view components浮点float腐蚀erode复合视图view composite复合输入combined with input复制duplicate复制duplicateselect all傅立叶变换Fourier transform改变热点值change hotspot values感兴趣区域ROI高级几何学Advanced geometry高通high pass格式栏formatbar更改默认的搜索参数modify default search parameters 工具Utilities工具栏toolbar工具属性tool properties工具条toolbar工作区workspace bar共享轮廓shared contours构件build构造表格construct grid关闭close和/或and/or和逆FFT画图工具drawing tools缓存buffer换算convert灰度grayscale恢复目标restore targets回放playback绘图连结connect map获得/装载标注make/load mask获取选定粒子draw selected blobs或从一个相关区域创建一个ROI or create an ROI from a relative region基线score基于校准映射的畸变校正distortion correction based on calibration mapping 极性polarity极坐标转换polar coordinate transformation几何学Geometry记录record加粗thick加法add间隔spacing间距distance兼容compatible简洁compactness剪切cut减法subtract减小缩进outdent交互式的定义字体参数包括搜索限制ine font parameters including search constraints 脚本栏script bar角度angle角度和缩放范围angle and scale range接收和确定域值acceptance and certainty thresholds结果栏result bar解开目标unlock targets精确度和时间间隔accuracy and timeout interval矩形rectangle矩形rectangular绝对差分absolute difference绝对值absolute value均匀uniform均值average拷贝copy拷贝序列copy sequence可接收的域值acceptance threshold克隆clone控制control控制controls快捷健shortcut key宽度breadth宽度width拉普拉斯Laplacians拉伸elongation蓝blue类型type粒子blob粒子标注label blobs粒子分离segment blobs粒子内的孔数目number of holes in a blob 亮度brightness亮度luminance另存为save as滤波器filters绿green轮廓profile overlay轮廓极性contour polarity逻辑运算logical operations面积area模板编辑edit model模板覆盖model coverage模板和目标覆盖model and target coverage 模板索引model index模板探测器Model Finder模板位置和角度model position and angle 模板中心model center模糊mask模块import VB module模块modules模式匹配Pattern matching默认案例default cases目标Targets目标分离separate objects目标评价target score欧拉数Euler number盆basins膨胀dilate匹配率match scores匹配数目number of matches平方和sum of the squares平滑smooth平均average平均averaged平均值mean平移translation前景色foreground color清除缓冲区为一个恒量clear buffer to a constant清除特定部分delete special区域增长region-growing ROI取反negate全部删除delete all缺省填充和相连粒子分离fill holes and separate touching blobs任意指定位置的中心矩和二阶矩central and ordinary moments of any order location: X, Y 锐化sharpen三维视图view 3D色度hue删除delete删除帧delete frame设置settings设置相机类型enable digitizer camera type设置要点set main示例demos事件发现数量number of occurrences事件数目number of occurrences视图View收藏collectionDICOM手动manually手绘曲线freehand输出选项output options输出选择结果export selected results输入通道input channel属性页properties page数据矩阵DataMatrix数字化设置Digitizer settings双缓存double buffer双域值two-level水平边沿horizontal edge搜索find搜索和其他应用Windows Finder and other applications 搜索角度search angle搜索结果search results搜索区域search area搜索区域search region搜索速度search speed速度speed算法arithmetic缩放scaling缩放和偏移scale and offset锁定目标lock destination锁定实时图像处理效果预览lock live preview of processing effects on images 锁定预览Lock preview锁定源lock source特定角度at specific angle特定匹配操作hit or miss梯度rank替换replace添加噪声add noise条带直径ferret diameter停止stop停止采集halt grab同步synchronize同步通道sync channel统计Statistics图像Image图像大小image size图像拷贝copy image图像属性image properties图形graph退出exit椭圆ellipse椭圆ellipses外形shape伪彩pseudo-color位置position文本查看view as text文件File文件MIL MFO font file文件load and save as MIL MMF files文件load and save models as MIL MMO files OCR文件中的函数make calls to functions in external DLL files文件转换器file converterActiveMIL Builder ActiveMIL Builder 无符号抽取部分Extract band -细化thin下一帧next显示表现字体的灰度级ayscale representations of fonts显示代码show code线line线lines相对起点relative origin像素总数sum of all pixels向前或向后移动Move to front or back向上或向下up or down校准Calibration校准calibrate新的/感兴趣区域粘贴paste into New/ROI新建new信息/ 图形层DICOM information/overlay形态morphology行为actions修改modify修改路径modify paths修改搜索参数modify default search parameters 序列采集sequence旋转rotation旋转模板rotate model选择select选择selector循环loops移动move移动shift应用过滤器和分类器apply filters and classifiers 影响区域zone of influence映射mapping用户定义user defined用基于变化上的控制实时预览分水岭转化结果阻止过分切割live preview of resulting watershed transformations with control over variation to prevent over segmentation用某个值填充fill with value优化和编辑调色板palette optimization/editor有条件的conditional域值threshold预处理模板优化搜索速度循环全部扫描preprocess model to optimize search speed circular over-scan预览previous元件数目和开始(自动或手动)number of cells and threshold auto or manual元件最小/最大尺寸cell size min/max源source允许的匹配错误率和加权fit error and weight运行run在目标中匹配数目number of modelmatches in target暂停pause增大缩进indent整数除integer divide正FFT正常连续continuous normal支持象征学supported symbologies: BC 412直方图均衡histogram equalization执行execute执行外部程序和自动完成VBA only execute external programs and perform Automation VBA only指定specify指数exponential Rayleigh中值median重复repeat重建reconstruct重建和修改字体restore and modify fonts重新操作redo重心center of gravity周长perimeter注释annotations转换Convert转换convert装载load装载和保存模板为MIL MMO装载和另存为MIL MFO装载和另存为MIL MMF状态栏status bar资源管理器拖放图像drag-and-drop images from Windows ExplorerWindows自动或手动automatic or manual自动或手动模板创建automatic or manual model creation字符产大小string size字符串string字体font最大maximum最大化maximum最大数maxima最后一帧last frame最小minimum最小化minimum最小间隔标准minimum separation criteria最小数minima坐标盒的范围bounding box coordinates图像数据操作Image data manipulation内存分配与释放allocation release图像复制copying设定和转换setting and conversion图像/视频的输入输出Image and video I/O支持文件或摄像头的输入file and camera based input图像/视频文件的输出image/video file output矩阵/向量数据操作及线性代数运算Matrix and vector manipulation and linear algebra routines 矩阵乘积products矩阵方程求解solvers特征值eigenvalues奇异值分解SVD支持多种动态数据结构Various dynamic data structures 链表lists队列queues数据集sets树trees图graphs基本图像处理Basic image processing去噪filtering边缘检测edge detection角点检测corner detection采样与插值sampling and interpolation色彩变换color conversion形态学处理morphological operations直方图histograms图像金字塔结构image pyramids结构分析Structural analysis连通域/分支connected components轮廓处理contour processing距离转换distance transform图像矩various moments模板匹配template matching霍夫变换Hough transform多项式逼近polygonal approximation曲线拟合line fitting椭圆拟合ellipse fitting狄劳尼三角化Delaunay triangulation摄像头定标Camera calibration寻找和跟踪定标模式finding and tracking calibration patterns 参数定标calibration,基本矩阵估计fundamental matrix estimation单应矩阵估计homography estimation立体视觉匹配stereo correspondence)运动分析Motion analysis光流optical flow动作分割motion segmentation目标跟踪tracking目标识别Object recognition特征方法eigen-methodsHMM模型HMM基本的GUI Basic GUI显示图像/视频display image/video键盘/鼠标操作keyboard and mouse handling滑动条scroll-bars图像标注Image labeling直线line曲线conic多边形polygon、文本标注text drawing梯度方向gradient directions系数coefficient空间频率spatial frequencies串级过滤cascade filtering卷积运算convolution operation有限差分近似the finite difference approximation 对数刻度logarithmic scale仿射参数affine parameters斑点Blob差距disparityAlgebraic operation 代数运算;一种图像处理运算,包括两幅图像对应像素的和、差、积、商。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
A Circular Hough Transform Hardware for Industrial CircleDetection ApplicationsJau Ruen Jen, Mon Chau Shie, and Charlie ChenDept. of Electronic Engineering,National Taiwan University of Science and Technology School of Electrical and Electronic Engineering,No.43, Sec.4, Keelung Rd., Taipei, Taiwan, R.O.C.AbstractThe Hough Transform (Hough, 1962) has been used to characterize analytic features. It was first applied to the recognition of straight lines, and later extended to circles, ellipses and arbitrary shaped objects. Its main disadvantage is the computational and storage requirements increase as a power of the dimensionality of the curve.It is not difficult to implement Circular Hough Transform (CHT) algorithm on modern personal computer. However, we intend to use FPGA or ASIC to perform CHT in this article. Modern FPGAs are capable of performing high speed operation and have large amount of embedded memory. The whole CHT circuitry with accumulator array excluded can be fitted into Altera® Stratix® 1S25 chip which has more than 1Mb RAM embedded.1IntroductionDetection of round objects is important in many areas of image analysis and is important in industrial application such automatic inspection and assembly. For many components are round shaped. Richard. O. Duda and Peter. E. Hart (1965) extent the Hough straight line detection to circle-finding concept. In their algorithm, the array is indexed by three parameters specifying the location and size of the circle: the circle center (x0,y0) and the circles radius r.Though FPGAs have large size of embedded memory , the embedded memory of FPGAs are not enough for our CHT application. In our design, the embedded memory served as image buffer only and the accumulator memories for storing parameter are off-chip components which can be any ordinary SRAM chip.2Hough Transform (HT) and Circulet Hough Transform (CHT)A straight line in 2 dimensional plane (X-Y plane) can be expressed as y=ax+b. All points satisfying y i=ax i+b determine a straight line. In the contrary, we may also claim that these points satisfy b=-ax i+y i equation. It means all collinear points on the X-Y plane correspond a point on the A-B (parameter) plan. Three dual property of the point-to-straight line transformation can be established :Property 1. A point in the X-Y plane corresponds a straight line in the parameter plane.Property 2. Three points in the X-Y plane correspond three straight lines in the parameter plane.Property 3. Three noncollinear points in the X-Y plane correspond three straight line intersecting at one point in the parameter plane.There is a serious drawback using this method to represent straight lines when lines are perpendicular to X- axis in the X-Y plane. We are not able to describe the lines using equation b=-ax i+y i .R. O. Duda and P. E. Hart used normal parameterization to describe the straight line in parameter space alternatively. The equation of a line corresponding to the geometry shown in Figure 2-1 isρ=xcosθ+ysinθ.A dual property of the point-to-curve transformation can also be established. Suppose we have a set {(ρ1, θ1), . . . , (ρn, θn)} of points in the ρ-θ plane, all lying on the curveρ=xcosθ+ysinθ.It is easy to show that all these points correspond to lines in the x-y plane passing through the point (x0,y0). We have the following four properties:(a)Property 1. A point in the X-Y plane corresponds toa sinusoidal curve in the parameter plane.(b)Property 2. A point in the parameter planecorresponds to a straight line in the picture plane.Y0-7803-9514-X/06/$20.00 ©2006 IEEE ICIEA 2006(c) Property 3. Points lying on the same straight line inthe X-Y plane correspond to curves through a common point in the parameter plane.(d) Property 4. Points lying on the same curve in theparameter plane correspond to lines through the same point in the X-Y plane.To examine all points in the X-Y plane and add one to the corresponding array in ρ-θ accumulator array, we will find a coordinate which has maximum accumulated value. The maximum value k found at coordinate (ρi , θi ) means k curves intersecting at point (ρi , θi ) in the parameter plane, i.e., there are k colinear points in the X-Y plane.Normally, a circle is represented by (x-x 0)2+(y-y 0)2=r 2, where x 0 and y 0 are the center coordinates, and r is the radius. As we mentioned, the three parameter form a 3 dimensional accumulator. We need a 5 dimensional accumulator array if we want to detect a ellipse. Obviously, it’s a bad idea to use FPGA embedded memory as accumulator to implement CHT, we need far more amount of memory than embedded memory.3Proposed Method3.1Gray Level ImageColor images are everywhere in the world. However, they are useless in straight line or circle detection. These colorful image should be transferred to gray level images for further operation. We use 256 gray levels image and adopt the RGB space to YIQ space conversion equation. Hence, we get Y =0.25R+0.57G+0.11B, where R, G, B is the corresponding color component value, and Y is the conversion result. We may simply average the three component values to generate the gray level image. Figure 3-1 shows a 24bit colored picture, and Figure 3-2 shows the corresponding 256 gray levels image.3.2Edge detectionAn edge detection is used to extract boundary from gray level images. It is a high pass filtering often used to enhance images. There are two ways to enhance images. One is done in spatial domain, and the other is done in frequency domain. In spatial domain filtering , we use a sliding mask for data processing. A new pixel value is calculated according the mask and corresponding pixel value. The equation can be expressed as:Where w is the mask , and f (x ,y ) is the image we want to perform operation.We often use Sobel edge detection to extract image boundary. It use discrete calculation to get gradient information. For a function f, the first order gradient over point (x ,y ) is defined asThe magnitude and direction areFor complexity issue, we often use the following equationy x G G f +≈∇to approximate the magnitude. Figure 3-3 shows the Horizontal Sobel mask. Figure 3-4 shows the verticalSobel mask.3.3 Laplace FilteringIn generally, the Sobel edge detection will generate images with good quality. For some gray level images, the extracted boundary appears to be filled with bright pixels as shown in Figure 3-5, and that consume a lot of computation. To further reduce the pixels we have to process, we use Laplace filtering again.The Laplace filtering is a second order gradient operation, which is defined asin the continuous domain. The discrete domain second order gradient is defined as The discrete two dimensional second order gradient is defined asHence the Laplace mask should be the one shown in Figure 3-6.Figure 3-7 shows the result of Laplace filtering. As we see, the image has fewer feature points than Figure 3-5.3.4Detecting center and radius of circle∂∂∂∂= =∇y f x f G G f y x []()yx -yx G G G G f)mag(12122tan =+=∇θ2222y fx ff ∂∂+∂∂=∇)()()(12122x-f x f -x f x f++=∂∂Figure 3-3Figure 3-4Figure 3-1Figure 3-2()()2020-y y -x x r i i +=We have mentioned, In Section 2, three noncollinear points determine a circle. And two of the HTmodification used this method to get center location. We adopt this method for it is easy to implement. A major difference is that we calculate the radiusin the same time, where (x i , y i ) is any of the three edge pixel considered to be on the circle.It is obvious, a digital circle has odd or even diameter. The resolution of radius hence will be 0.5 pixel. If we omit circles with radius smaller than 4 and set the resolution of radius to 1, we only have to calculate integer radius lager or equal to 4. This help reduce the computa tionrequired.Thecalculate d radius and center location are storedforaccumul ation tofind out local maximum. The maximum indicates a circle we detect. A radius histogram is shown in Figure3-8.4Hardware ArchitectureFor efficient coding, the image size is set to 256pixels * 256pixels, which means 16bit address are enough for X-axis and Y-axis arithmetic .We decide not to usetrigonometric function to implement fast and efficient CHT. Not to use trigonometric function means no tangent (gradient information) and no floating point arithmetic. We only need to compute the integer radius and center location and vote from 1D accumulator and 2D accumulator which are located outside the FPGA. An Altera ® Stratix ® 1S25 has more than 1 million bitembedded memory which can be used as our RAMbuffer. Three 256*256*8 bit embedded memory (RAM1, RAM2 and RAM3) are used for edge detection and Laplace filtering. They are arranged as synchronous two port memory having write and read signal independently. Synchronous memory in FPGA has better performance in writing than asynchronous memory. The block diagram of the system is shown in Figure 4-1The following paragraph describe the architecture more detailed4.1 UART InterfaceA UART interface is used to receive gray level image from host and send the drawn circle image to host. The interface supports 5,6,7 and 8 bit format. One-stop or two-stop bit can be adjusted. Even parity or odd parity can be adjusted too. All the features help the interface works fine with any other UART interface.An internal read or write signal is generate if the received signal sequence comply with predefined protocol. To start the read cycle of RAM1, the host must send the high byte address of RAM1 first, the low byte address secondly and a byte of data not equal to 0xff. A internal read cycle will then be initiated automatically and send out the captured data of RAM1 a few clocks later. To write RAM1, the host has to send the high byte address of RAM1 first, the low byte address secondly, command data 0xFF thirdly and the data to be written finally. Once the address 0xFFFF of RAM1 has been written to, the system will start the Sobel edge detection automatically.4.2 Sobel ModuleThe Sobel module performance Sobel edge detection. It read gray level image data from RAM1 and perform the horizontal convolution and vertical convolution. The result of horizontal convolution is stored at RAM2 , and vertical convolution result is stored at RAM3. Figure 4-3 shows the relationship among Sobel module and others. During these convolution, all the results greater than 255 are fixed at 255, and all the results smaller than 0 are fixed at 0. We do this because (1) we use 8bit embedded memory and (2) this will reduce the computation required in the future stage. Further, we decide not to perform the Sobel edge detection on image boundary , i.e., only 254x254 mask operation is enough in vertical and horizontal directions. After the two convolutions are finished, the magnitude of the gradient can be calculated and stored into RAM1. A threshold is again set to examine the magnitude which make the Sobel edge detection generate binary image.A roughly estimation of processing time of this stage is T R (13WH-12W-12H+2) + T W (3WH+2WH+2H-2), where W is the Width of image, H is the height of image, T R is read cycle time of RAM buffer, and T W isIn/OutFigure 3-5 Figure 3-7Figure 5-1Figure 5-2write cycle time of RAM. Both W and H are 256 in the paper.4.3 Laplace FilteringAs we mentioned, some image have better result if we performance the Laplace filtering after Sobel edge detection, and some don’t. We can set bit3 of control register2 to bypass the Laplace filtering.Similarly, only 254*254 convolution is performed to reduce to computation. The result of Laplace filtering is stored at RAM2.An estimated processing time of this stage is T W (WH+W+H-3)+T R (5WH+5W-5H+5).4.4 Compact ModuleThe extracted edge pixels are randomly located in the image buffer RAM1 or RAM2. Like the hard drive disk, we often perform a defragment when the performance of disk reading or writing is getting worse. In this project, we need to rearrange the edge pixels and place them in the RAM buffer in sequence to reduce searching time in the center and radius calculation stage.According to the simulation either RTL level or gate level we have done, we found the effect of compacting edge pixel locations remarkable. No more time is wasted during center and radius calculation stage. This will greatly reduce total detection time. If it is a valid edge pixel, the address of the data will be written into RAM3 and RAM2(RAM1) where RAM3 store the high byte address and RAM2(RAM1). The processing time of this stage is (256*256*T R +N*T W ) , where N is the number of edge pixels.4.5 Circle ModuleThe Circle module calculate radius and center location according to the address stored at RAM3 and RAM2(RAM1). To perform Cramer’s equation where we need some special arithmetic function such as square root and division. More than 20 adder are used, and their input vary from 16bits to 28bits. There are six 17bit by 18bit multipliers, twelve 17bit by 9bit multipliers and fourteen 8bit by 8bit multipliers. Two 28bit by 20bit division modules are used. One 17bit square root function is used.The total processing time of this stage is about T W *WH+ (T C +T W +T R )N 3, where T C is the time required to perform Cramer’s equation and T W *WH is the time we used to clear RAM buffer before writing address into.4.6 Draw ModuleThe Draw module draw circle according to the detected radius and center location. Only the circle with localmaximum radius and center histogram is drawn for demonstration purpose.To calculate the distance between every points of image and candidate circle center, we know if the distance of these two points equal to the detected radius. Mark those points in RAM1 have correct distance will show the circle we detected. The content of RAM1 can be read through UART interface. The time to draw a circle is (T R +T D )WH + 2πR T W . where R is the detected radius and T D is the time to calculate distance of two points.5Fitting and simulation resultThe logic cells used in our design are 3056, which are 11% of all logic cells we can us. 1253 registers are used, which are 4% of all registers we can use.128 M4Ks memory and 2 M-RAMs are used as RAM buffer. The three RAM buffers consume 1,572,864bit and some logic are implemented in embedded memory logic. Hence, the total amount of memory used are 1,769,472bit which are 90% of all embedded memory. The multiplication, addition, division are implemented in DSP block. 42 blocks are used.Some simulation result are presented here to show the functionality of circuit.Figure 5-1 shows the host writing gray level image into RAM buffer1.Figure 5-2 shows the waveforms of horizontal Sobel convolution and store the result into RAM buffer2. Figure 5-3 shows the waveforms of vertical Sobel convolution and store the result into RAM buffer3.Figure 5-3Figure 5-4Figure 5-5 Figure 5-6 Figure 5-7Figure 5-4 shows the waveforms of mearging vertical and horizontal Sobel convolution andstore the result into RAM buffer1Figure 5-5 shows the waveforms of Laplace filtering on RAM bufffer1.Figure 5-6 shows the waveforms of Compact addressed of edge pixels. Figure 5-7 shows the waveforms of centre and radius calculation in CIRCLE module.Figure 5-8 shows the detected radius is15 and detected center location is (0x76, 0x7d).6ConclusionThis paper propose a flexible hardware architecture for CHT using 1D accumulator and2D accumulator outside the FPGA. In the beginning, the gray level image is downloaded into FPGA to extract edge pixels. User may skip Laplace filtering if the image is worse than that after Sobel filtering. The location of edge pixels are then compacted to reduce the searching time. Cramer rule is applied to calculated the candidate radius and centers . Voting the maximum possibility, we get the detected circle.The time for center and radius calculation is the key factor in our design. In the Verilog simulation, if the clock speed is 50MHz and the Cramer equation calculator consume 13 cycles to get the radius and center, the total time detecting a circle with radius 21(decimal value) is 4.3s, however it takes 46 seconds in C language simulation on an AMD Athlon 2000+ system. Currently, a non-pipelined Cramer equation calculator is used. The future works is to design a pipeline one to speedup the performance.Figure 5-8To download or upload image from RAM1 through UART interface take much longer than the time required to detect a circle. We may use the USB interface for faster transmission in the future, too. Modularized design allow users to modify or add new circuitry to get better performance in recognition. References[1] N. Guil and E.L.Zapata “Lower Order Circle and Ellipse Hough Transform,'' Pattern Recognition, vol. 30, no. 10, October 1997, pp. 1729-1744.[2] X. Cao and F. Deravi “An Efficient Method for Multiple-Circle Detection,'' ICCV, 744-747.[3] Chun-Ta Ho and Ling-Hwei Chen “A FAST ELLIPSE/CIRCLE DETECTOR USING GEOMETRIC SYMMETRY,'' Pattern Recognition, Vol. 28, No. 1, pp. 117-124, 1995[4] A. Goneid , S. El-Gindi and A. Sewisy “A methodfor the Hough transform detection of circles and ellipses using a 1-dimensional array,'' 1997 IEEE International Conference on Volume 4, 12-15 Oct. 1997Page(s):3154 - 3157 vol.4[5] Dimitrios Ioannou, Walter Huda and Andrew F. Laine “Circle recognistion through a 2D Hough Transform and radius histogrammig,'' Image and Visoin Computing 17, (1999) 15-26[6] Heung-Soo Kim and Jong-Hwan Kim “A two-step circle detection algorithm from the intersecting chords,'' Pattern Recognition Letters 22, (2001) 787-798[7] Carolyn Kimme, Dana Ballard, and Jack Sklansky “Finding Circles by an Array of Accumulators,'' Communications of the ACM, February 1975, Volume 18, Number 2.[8] The-Chuan Chen and Kuo-Liang Chung “An Efficient Randomized Algorithm for Detecting Circles,'' Computer Vision and Image Understanding 83, 172-191 (2001).[9] R.O. Duda and P.E. Hart “Use of the Hough transform to detect lines and curves in pictures,'' Comm. ACM 15, 11-15.[10] Rafael C. Gonzalez and Richard E. Woods “DigitalImage Processing 2/e.''。