[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN106204542A - Visual identity method and system - Google Patents

Visual identity method and system Download PDF

Info

Publication number
CN106204542A
CN106204542A CN201610498006.5A CN201610498006A CN106204542A CN 106204542 A CN106204542 A CN 106204542A CN 201610498006 A CN201610498006 A CN 201610498006A CN 106204542 A CN106204542 A CN 106204542A
Authority
CN
China
Prior art keywords
radius
circle
center position
center
contour
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610498006.5A
Other languages
Chinese (zh)
Other versions
CN106204542B (en
Inventor
郑勤奋
卢鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Siqin Technology Co ltd
Original Assignee
Shanghai Sunrise Simcom Electronic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Sunrise Simcom Electronic Technology Co Ltd filed Critical Shanghai Sunrise Simcom Electronic Technology Co Ltd
Priority to CN201610498006.5A priority Critical patent/CN106204542B/en
Publication of CN106204542A publication Critical patent/CN106204542A/en
Application granted granted Critical
Publication of CN106204542B publication Critical patent/CN106204542B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/0008Industrial image inspection checking presence/absence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component

Landscapes

  • Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

本发明涉及视觉识别技术领域,公开了一种视觉识别方法及系统。本发明中,视觉识别方法,包括:获取待识别物品的灰度图与目标圆的已知条件;其中已知条件包括第一圆心位置、第一半径、目标圆的极性、第一偏差值与第二偏差值;对灰度图进行边缘检测获取灰度图的图像轮廓;根据已知条件对图像轮廓进行极性筛选,获取第一轮廓;根据第一轮廓确定第二圆心位置与第二半径;其中,第二圆心位置为确定的目标圆的圆心位置,第二半径为确定的目标圆的半径。本发明实施方式还提供了一种视觉识别系统。与现有技术相比,使得在提取待识别物品的图像上的圆时可以提高圆心和半径提取的速度及准确度。

The invention relates to the technical field of visual recognition, and discloses a visual recognition method and system. In the present invention, the visual recognition method includes: obtaining the known conditions of the grayscale image of the object to be recognized and the target circle; wherein the known conditions include the position of the first center of the circle, the first radius, the polarity of the target circle, and the first deviation value and the second deviation value; carry out edge detection on the grayscale image to obtain the image contour of the grayscale image; perform polarity screening on the image contour according to known conditions to obtain the first contour; determine the second circle center position and the second circle center position according to the first contour Radius; wherein, the second center position is the determined center position of the target circle, and the second radius is the determined radius of the target circle. The embodiment of the present invention also provides a visual recognition system. Compared with the prior art, the speed and accuracy of the circle center and radius extraction can be improved when extracting the circle on the image of the object to be recognized.

Description

视觉识别方法及系统Visual recognition method and system

技术领域technical field

本发明涉及视觉识别技术领域,特别涉及一种视觉识别方法及系统。The invention relates to the technical field of visual recognition, in particular to a visual recognition method and system.

背景技术Background technique

在薄膜键盘的上盖板下方设置有一层键盘软膜,在每个按键的位置上设置有一个弹性键帽(一般是橡胶帽),该弹性键帽相对于按键的位置一定不能偏位,否则,可能导致击键无效。A layer of keyboard soft membrane is arranged under the upper cover of the membrane keyboard, and an elastic keycap (usually a rubber cap) is arranged on the position of each key. The position of the elastic keycap relative to the key must not be offset, otherwise , which may result in invalid keystrokes.

在制造薄膜键盘时,需要检测弹性键帽相对于对应的按键是否偏位。在检测时,先对薄膜键盘的正面进行拍照,获取灰度图(是一副二维平面图);其中,在该灰度图中,按键覆盖的区域的轮廓为圆角四边形,弹性键帽覆盖区域的轮廓为圆形;接着,采用视觉识别技术,从灰度图中提取出弹性键帽所对应的圆;最后,检测提取出的圆相对于圆角四边形是否偏位。When manufacturing the membrane keyboard, it is necessary to detect whether the elastic key cap is offset relative to the corresponding key. When testing, first take a photo of the front of the membrane keyboard to obtain a grayscale image (a pair of two-dimensional plan); wherein, in the grayscale image, the outline of the area covered by the key is a rounded quadrilateral, and the elastic keycap covers The outline of the area is a circle; then, using visual recognition technology, the circle corresponding to the elastic keycap is extracted from the grayscale image; finally, whether the extracted circle is offset relative to the rounded quadrilateral is detected.

在实现本发明的过程中,发明人发现现有技术中存在如下问题:一方面,针对键盘软膜检测中按键(key)周围圆的提取方法,目前较少,而且,从圆的提取角度来说,目前可能使用的主要方法包括两种:第一种,基于霍夫(hough)变换圆提取方法,但是该类方法中目前常用的基于梯度的方法,当圆比较小时,误差比较大,提取不精确,会使提取的圆心位置偏位。第二种,通过拟合的方式提取圆,这种方法提取圆计算量大,导致提取速度慢。In the process of realizing the present invention, the inventor found that there are the following problems in the prior art: on the one hand, there are few methods for extracting circles around keys (keys) in keyboard soft membrane detection, and, from the angle of circle extraction, Said that there are two main methods that may be used at present: the first one is based on the Hough transform circle extraction method, but the gradient-based method currently commonly used in this type of method, when the circle is relatively small, the error is relatively large, and the extraction If it is not accurate, the position of the extracted circle center will be offset. The second method is to extract the circle by fitting. This method extracts the circle with a large amount of calculation, resulting in a slow extraction speed.

发明内容Contents of the invention

本发明实施方式的目的在于提供一种视觉识别方法及系统,使得在提取待识别物品的图像上的圆时可以提高圆心和半径提取的效率及准确度。The purpose of the embodiments of the present invention is to provide a visual recognition method and system, so that the efficiency and accuracy of circle center and radius extraction can be improved when extracting the circle on the image of the object to be recognized.

为解决上述技术问题,本发明的实施方式提供了一种视觉识别方法,包括:获取待识别物品的灰度图与目标圆的已知条件;其中,所述已知条件包括第一圆心位置、第一半径、所述目标圆的极性、第一偏差值与第二偏差值,所述目标圆为待提取的圆,所述第一偏差值为所述目标圆的圆心偏差值,所述第二偏差值为所述目标圆的半径偏差值,所述第一圆心位置为所述目标圆的圆心推测位置,所述第一半径为所述目标圆的推测半径;对所述灰度图进行边缘检测获取所述灰度图的图像轮廓;根据所述已知条件对所述图像轮廓进行极性筛选,获取第一轮廓;根据所述第一轮廓确定第二圆心位置与第二半径;其中,所述第二圆心位置为确定的目标圆的圆心位置,所述第二半径为确定的目标圆的半径。In order to solve the above-mentioned technical problems, the embodiment of the present invention provides a visual recognition method, including: acquiring the grayscale image of the item to be recognized and the known conditions of the target circle; wherein the known conditions include the position of the center of the first circle, The first radius, the polarity of the target circle, the first deviation value and the second deviation value, the target circle is a circle to be extracted, the first deviation value is the center deviation value of the target circle, the The second deviation value is the radius deviation value of the target circle, the first center position is the estimated position of the target circle center, and the first radius is the estimated radius of the target circle; for the grayscale image performing edge detection to obtain the image contour of the grayscale image; performing polarity screening on the image contour according to the known conditions to obtain a first contour; determining a second circle center position and a second radius according to the first contour; Wherein, the second center position is the determined center position of the target circle, and the second radius is the determined radius of the target circle.

本发明的实施方式还提供了一种视觉识别系统,包括:获取模块、检测模块、筛选模块与确定模块;所述获取模块,用于获取待识别物品的灰度图与目标圆的已知条件;其中,所述已知条件包括第一圆心位置、第一半径、所述目标圆的极性、第一偏差值与第二偏差值,所述目标圆为待提取的圆,所述第一偏差值为所述目标圆的圆心偏差值,所述第二偏差值为所述目标圆的半径偏差值,所述第一圆心位置为所述目标圆的圆心推测位置,所述第一半径为所述目标圆的推测半径;所述检测模块,用于对所述灰度图进行边缘检测获取所述灰度图的图像轮廓;所述筛选模块,用于根据所述已知条件对所述图像轮廓进行极性筛选,获取第一轮廓;所述确定模块,用于根据所述第一轮廓确定第二圆心位置与第二半径;其中,所述第二圆心位置为确定的目标圆的圆心位置,所述第二半径为确定的目标圆的半径。Embodiments of the present invention also provide a visual recognition system, including: an acquisition module, a detection module, a screening module, and a determination module; the acquisition module is used to acquire the grayscale image of the item to be identified and the known conditions of the target circle ; Wherein, the known conditions include the first center position, the first radius, the polarity of the target circle, the first deviation value and the second deviation value, the target circle is a circle to be extracted, and the first The deviation value is the center deviation value of the target circle, the second deviation value is the radius deviation value of the target circle, the first center position is the estimated position of the target circle center, and the first radius is The estimated radius of the target circle; the detection module is used to perform edge detection on the grayscale image to obtain the image profile of the grayscale image; the screening module is used to perform edge detection on the grayscale image according to the known conditions. Polarity screening is performed on the image contour to obtain the first contour; the determining module is configured to determine a second center position and a second radius according to the first contour; wherein the second center position is the determined center of the target circle position, the second radius is the determined radius of the target circle.

本发明实施方式相对于现有技术而言,通过对待识别物品的灰度图进行边缘检测得到图像轮廓,再根据已知条件对该图像轮廓进行极性筛选,既可以得到待提取圆的轮廓,从而可以确定待提取圆的圆心位置和半径,计算过程中,由于待提取的圆的圆心的推测位置及其偏差、推测半径及其偏差是已知的,利用这些已知条件可以先得到模糊的图像轮廓,然后就可以再进行精确筛选,最后确定待提取圆的准确轮廓,简单、快速、计算量小,而且准确,使得在提取待识别物品的图像上的圆时可以提高圆心和半径提取的效率及准确度。Compared with the prior art, the embodiment of the present invention obtains the image contour by performing edge detection on the grayscale image of the object to be recognized, and then performs polarity screening on the image contour according to known conditions, so that the contour of the circle to be extracted can be obtained, Thus, the position and radius of the center of the circle to be extracted can be determined. In the calculation process, since the estimated position of the center of the circle to be extracted and its deviation, the estimated radius and its deviation are known, using these known conditions can first obtain the fuzzy The outline of the image can then be accurately screened to finally determine the exact outline of the circle to be extracted. It is simple, fast, and the amount of calculation is small, and it is accurate, so that when extracting the circle on the image of the object to be recognized, the center and radius of the circle can be extracted. efficiency and accuracy.

另外,在根据所述第一轮廓确定第二圆心位置与第二半径中,具体包括:以所述第一轮廓上的像素点为圆心,以所述目标圆的半径取值范围内任意一个半径值为半径画圆;所述半径取值范围根据所述第一半径与所述第二偏差值计算得到;在所述目标圆的圆心位置范围内,统计同一半径的圆的交叉次数;其中,所述目标圆的圆心位置范围根据所述第一圆心位置与所述第一偏差值计算得到;将交叉次数最多的圆的半径确定为所述第二半径,将交叉点的位置确定为所述第二圆心位置。这样,仅统计目标圆的圆心位置范围内的所有圆的交叉点,而不考虑该范围之外的圆的交叉次数,可以提高第二圆心位置选取的速度。In addition, determining the second circle center position and the second radius according to the first contour specifically includes: taking the pixel point on the first contour as the center of the circle, and taking any radius within the range of the radius of the target circle The value is to draw a circle with a radius; the value range of the radius is calculated according to the first radius and the second deviation value; within the range of the center position of the target circle, the number of intersections of circles with the same radius is counted; wherein, The center position range of the target circle is calculated according to the first center position and the first deviation value; the radius of the circle with the most number of intersections is determined as the second radius, and the position of the intersection point is determined as the The position of the second circle center. In this way, only the intersections of all circles within the center position range of the target circle are counted, regardless of the number of intersections of circles outside the range, which can increase the speed of selecting the second circle center position.

另外,在以所述第一轮廓上的像素点为圆心,以所述目标圆的半径取值范围内任意一个半径值为半径画圆中,具体包括:仅画出位于所述目标圆的圆心位置范围内的圆弧;在所述目标圆的圆心位置范围内,统计同一半径的圆的交叉次数中,具体包括:统计同一半径的圆的圆弧的交叉次数;在所述将交叉次数最多的圆的半径确定为所述第二半径,将交叉点的位置确定为所述第二圆心位置中,具体包括:将交叉次数最多的圆弧所对应的圆的半径确定为所述第二半径。仅画出在目标圆的圆心位置范围内的圆弧,在统计时就自动避免统计该范围之外的圆的交叉次数,可以提高第二圆心位置选取的速度。In addition, in drawing a circle with a pixel point on the first contour as the center and using any radius value within the radius value range of the target circle as a radius, it specifically includes: only drawing the center of the target circle Arcs within the position range; within the center position range of the target circle, counting the number of intersections of circles with the same radius specifically includes: counting the number of intersections of arcs of circles with the same radius; The radius of the circle is determined as the second radius, and the position of the intersection point is determined as the position of the second center of the circle, which specifically includes: determining the radius of the circle corresponding to the arc with the largest number of intersections as the second radius . Only draw the arc within the range of the center position of the target circle, and automatically avoid counting the number of intersections of circles outside the range when counting, which can improve the speed of selecting the second center position.

另外,在获取待识别物品的灰度图与目标圆的已知条件之前,还包括:以所述第一圆心位置为原点建立第一坐标系,以所述灰度图中预设点为原点建立第二坐标系;在根据所述第一轮廓确定第二圆心位置与第二半径中,具体包括:在所述第一坐标系中,确定所述第二圆心位置与所述第二半径;在根据所述第一轮廓确定第二圆心位置与第二半径之后,还包括:根据所述第一坐标系与所述第二坐标系之间的变换关系,获取所述第二圆心位置在所述第二坐标系中的坐标。通过建立以目标圆的圆心推测位置为原点的坐标系,降低了计算的复杂度,简单、容易实现,同时使得在计算目标圆的圆心位置时更准确。In addition, before obtaining the known conditions of the grayscale image of the item to be identified and the target circle, it also includes: establishing a first coordinate system with the first center position as the origin, and taking the preset point in the grayscale image as the origin Establishing a second coordinate system; determining the second center position and the second radius according to the first contour specifically includes: determining the second center position and the second radius in the first coordinate system; After determining the second circle center position and the second radius according to the first contour, it also includes: according to the transformation relationship between the first coordinate system and the second coordinate system, obtaining the second circle center position at the Coordinates in the second coordinate system described above. By establishing a coordinate system with the estimated position of the center of the target circle as the origin, the complexity of calculation is reduced, simple and easy to implement, and at the same time, the calculation of the center position of the target circle is more accurate.

另外,在对所述灰度图进行边缘检测获取所述灰度图的图像轮廓中,具体包括:采用坎尼算子对所述灰度图进行边缘检测。坎尼算子去噪能力强,具有更好的边缘检测效果。In addition, performing edge detection on the grayscale image to obtain the image profile of the grayscale image specifically includes: performing edge detection on the grayscale image by using a Canny operator. Canny operator has strong denoising ability and better edge detection effect.

附图说明Description of drawings

图1是根据本发明第一实施方式的视觉识别方法流程图;Fig. 1 is a flow chart of a visual recognition method according to a first embodiment of the present invention;

图2是根据本发明第二实施方式的视觉识别方法流程图;Fig. 2 is a flow chart of a visual recognition method according to a second embodiment of the present invention;

图3是根据本发明第二实施方式中的键盘软膜的灰度图;Fig. 3 is a gray scale image of the soft membrane of the keyboard according to the second embodiment of the present invention;

图4是根据本发明第二实施方式中从灰度图中提取出的单个按键的轮廓图;Fig. 4 is a contour diagram of a single button extracted from a grayscale image according to a second embodiment of the present invention;

图5是根据本发明第二实施方式中的第二轮廓图;Fig. 5 is a second outline diagram according to the second embodiment of the present invention;

图6是根据本发明第二实施方式中的在第二轮廓图上选取一个像素点及其对应的内、外点的示意图;Fig. 6 is a schematic diagram of selecting a pixel point and its corresponding inner and outer points on the second contour map according to the second embodiment of the present invention;

图7是根据本发明第二实施方式中的第一轮廓图;FIG. 7 is a first outline diagram according to a second embodiment of the present invention;

图8是根据本发明第二实施方式中的以第一轮廓上的像素点为圆心,以待提取的圆的半径取值范围内任意一个半径值为半径画圆的示意图;Fig. 8 is a schematic diagram of drawing a circle with the pixel point on the first contour as the center and any radius value within the radius value range of the circle to be extracted according to the second embodiment of the present invention;

图9是根据本发明第三实施方式中计算每个像素点的有效角度的示意图;9 is a schematic diagram of calculating the effective angle of each pixel according to the third embodiment of the present invention;

图10是根据本发明第四实施方式的视觉识别方法流程图;FIG. 10 is a flowchart of a visual recognition method according to a fourth embodiment of the present invention;

图11是根据本发明第五实施方式的视觉识别系统结构示意图;Fig. 11 is a schematic structural diagram of a visual recognition system according to a fifth embodiment of the present invention;

图12是根据本发明第六实施方式的视觉识别系统结构示意图。Fig. 12 is a schematic structural diagram of a visual recognition system according to a sixth embodiment of the present invention.

具体实施方式detailed description

为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本发明各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the object, technical solution and advantages of the present invention clearer, various embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, those of ordinary skill in the art can understand that, in each implementation manner of the present invention, many technical details are provided for readers to better understand the present application. However, even without these technical details and various changes and modifications based on the following implementation modes, the technical solution claimed in this application can also be realized.

本发明的第一实施方式涉及一种视觉识别方法,本实施方式中的视觉识别方法适用于提取待识别物品中的圆,其流程如图1所示,具体如下:The first embodiment of the present invention relates to a visual recognition method. The visual recognition method in this embodiment is suitable for extracting circles in objects to be recognized. The process is shown in FIG. 1 , and the details are as follows:

在步骤101中:获取待识别物品的灰度图与目标圆的已知条件。在键盘制造领域,待识别物品可以是键盘软膜。具体的说,本实施方式中的已知条件包括第一圆心位置、第一半径、目标圆的极性、第一偏差值与第二偏差值。其中,目标圆为待提取的圆,第一偏差值为目标圆的圆心偏差值,第二偏差值为目标圆的半径偏差值,第一圆心位置为目标圆的圆心推测位置,第一半径为目标圆的推测半径。In step 101: Acquiring the grayscale image of the object to be identified and the known conditions of the target circle. In the field of keyboard manufacturing, the item to be identified can be the soft membrane of the keyboard. Specifically, the known conditions in this embodiment include the position of the first center of the circle, the first radius, the polarity of the target circle, the first deviation value and the second deviation value. Wherein, the target circle is the circle to be extracted, the first deviation value is the center deviation value of the target circle, the second deviation value is the radius deviation value of the target circle, the first center position is the estimated position of the center of the target circle, and the first radius is Inferred radius of the target circle.

在步骤102中:对灰度图进行边缘检测获取灰度图的图像轮廓。In step 102: performing edge detection on the grayscale image to obtain an image profile of the grayscale image.

在步骤103中:根据已知条件对图像轮廓进行极性筛选,获取第一轮廓。In step 103: performing polarity screening on image contours according to known conditions to obtain a first contour.

在步骤104中:根据第一轮廓确定第二圆心位置与第二半径;其中,第二圆心位置为确定的待提取的圆的圆心位置,第二半径为确定的待提取的圆的半径。In step 104: a second center position and a second radius are determined according to the first contour; wherein, the second center position is the determined center position of the circle to be extracted, and the second radius is the determined radius of the circle to be extracted.

本实施方式相对于现有技术而言,通过对待识别物品的灰度图进行边缘检测得到图像轮廓,再根据已知条件对该图像轮廓进行极性筛选,既可以得到待提取圆的轮廓,从而可以确定待提取圆的圆心位置和半径,计算过程中,由于待提取的圆的圆心的推测位置及其偏差、推测半径及其偏差是已知的,利用这些已知条件可以先得到模糊的图像轮廓,然后就可以再进行精确筛选,最后确定待提取圆的准确轮廓,简单、快速、计算量小,而且准确,使得在提取待识别物品的图像上的圆时可以提高圆心和半径提取的效率及准确度。Compared with the prior art, this embodiment obtains the image contour by performing edge detection on the grayscale image of the object to be recognized, and then performs polarity screening on the image contour according to known conditions, so that the contour of the circle to be extracted can be obtained, so that The position and radius of the center of the circle to be extracted can be determined. In the calculation process, since the estimated position and deviation, estimated radius and deviation of the center of the circle to be extracted are known, a blurred image can be obtained first by using these known conditions Contour, and then you can carry out precise screening, and finally determine the accurate contour of the circle to be extracted, which is simple, fast, with a small amount of calculation, and accurate, so that the efficiency of center and radius extraction can be improved when extracting the circle on the image of the object to be recognized and accuracy.

本发明的第二实施方式涉及一种视觉识别方法,其流程如图2所示,具体如下:The second embodiment of the present invention relates to a visual recognition method, the process of which is shown in Figure 2, specifically as follows:

在步骤201中,获取待识别物品的灰度图与目标圆的已知条件。在本实施方式中,以待识别物品为键盘软膜为例进行说明。具体的说,本实施方式中的已知条件包括第一圆心位置、第一半径、目标圆的极性、第一偏差值与第二偏差值。其中,目标圆为待提取的圆,第一偏差值为目标圆的圆心偏差值,第二偏差值为目标圆的半径偏差值,第一圆心位置为目标圆的圆心推测位置,第一半径为目标圆的推测半径。在实际应用中,可以通过拍照或者实物扫描获取待识别物品的图像,并对图像进行灰度处理得到待识别物品的灰度图,如图3所示,其中,31为一个按键所对应的区域。In step 201, the grayscale image of the object to be identified and the known conditions of the target circle are acquired. In this implementation manner, an example is described in which the item to be identified is a soft membrane of a keyboard. Specifically, the known conditions in this embodiment include the position of the first center of the circle, the first radius, the polarity of the target circle, the first deviation value and the second deviation value. Wherein, the target circle is the circle to be extracted, the first deviation value is the center deviation value of the target circle, the second deviation value is the radius deviation value of the target circle, the first center position is the estimated position of the center of the target circle, and the first radius is Inferred radius of the target circle. In practical applications, the image of the item to be identified can be obtained by taking pictures or scanning the actual object, and the grayscale processing is performed on the image to obtain the grayscale image of the item to be identified, as shown in Figure 3, where 31 is the area corresponding to a button .

在步骤202中,对灰度图进行边缘检测获取灰度图的图像轮廓。具体的说,本实施方式中可以通过边缘检测算子—坎尼(canny)算子检测图3中的轮廓,为提取按键(key)上的圆做准备,其中,图3中31部分的轮廓放大图如图4所示。In step 202, an edge detection is performed on the grayscale image to obtain an image profile of the grayscale image. Specifically, in this embodiment, the contour in Fig. 3 can be detected by the edge detection operator-Canny (canny) operator, in preparation for extracting the circle on the key (key), wherein, the contour of part 31 in Fig. 3 The enlarged view is shown in Figure 4.

在步骤203中,根据已知条件获取第二轮廓。具体的说,第二轮廓为目标区域内的轮廓,且目标区域为环形区域,环形区域的内圆半径等于第一半径减去第一固定值(该第一固定值可以根据第一偏差值和第二偏差值确定,具体地,该第一固定值大于第一偏差值和第二偏差值的和),环形区域的外圆半径等于第一半径加上第二固定值(该第二固定值可以根据第一偏差值和第二偏差值确定,具体地,该第二固定值大于第一偏差值和第二偏差值的和);第一固定值与第二固定值可以相同。比如说,可以在图4中假定圆心为(x,y),半径为r,本实施方式中第一偏差值假设为5,第二偏差值假设为2,第一固定值与第二固定值可以均为10,则第二轮廓的内圆半径为r-10,第二轮廓的外圆半径为r+10,将这部分轮廓单独显示出来,如图5中所示。In step 203, a second profile is obtained according to known conditions. Specifically, the second contour is the contour in the target area, and the target area is an annular area, and the radius of the inner circle of the annular area is equal to the first radius minus the first fixed value (the first fixed value can be based on the first deviation value and The second deviation value is determined, specifically, the first fixed value is greater than the sum of the first deviation value and the second deviation value), and the outer circle radius of the annular area is equal to the first radius plus the second fixed value (the second fixed value It may be determined according to the first deviation value and the second deviation value, specifically, the second fixed value is greater than the sum of the first deviation value and the second deviation value); the first fixed value and the second fixed value may be the same. For example, it can be assumed in Figure 4 that the center of the circle is (x, y) and the radius is r. In this embodiment, the first deviation value is assumed to be 5, the second deviation value is assumed to be 2, and the first fixed value and the second fixed value Both can be 10, then the radius of the inner circle of the second contour is r-10, and the radius of the outer circle of the second contour is r+10, and this part of the contour is displayed separately, as shown in FIG. 5 .

在步骤204中,选取第二轮廓上的一个像素点,获取一个内点与一个外点。具体的说,该内点与外点均位于第二轮廓上的像素点与第一圆心位置的像素点的连线上,更具体地说,该内点、外点分别位于以第一圆心位置的像素点为圆心、以第二轮廓上的像素点到第一圆心位置的像素点的距离为半径的圆的内侧、外侧,如图6中所示(图中O点为圆心,A点为内点,B点为外点,C点为第二轮廓上的像素点)。In step 204, a pixel point on the second contour is selected to obtain an inner point and an outer point. Specifically, both the inner point and the outer point are located on the line connecting the pixel point on the second contour and the pixel point at the first circle center position, more specifically, the inner point and the outer point are respectively located at the first circle center position The pixel point is the center of the circle, and the distance from the pixel point on the second contour to the pixel point of the first center position is the inside and outside of the circle of the radius, as shown in Figure 6 (the O point is the center of the circle among the figure, and the A point is The inner point, the B point is the outer point, and the C point is the pixel point on the second contour).

在步骤205中,判断内点的灰度值是否小于外点的灰度值。若是则进入步骤206,否则进入步骤207。具体的说,本步骤中若判断结果为是,说明A点的灰度值小于B点的灰度值,则进入步骤206,否则说明A点的灰度值大于B点的灰度值,则进入步骤207。In step 205, it is judged whether the gray value of the inner point is smaller than the gray value of the outer point. If yes, go to step 206, otherwise go to step 207. Specifically, if the judgment result in this step is yes, indicating that the gray value of point A is smaller than the gray value of point B, then enter step 206; otherwise, it means that the gray value of point A is greater than the gray value of point B, then Go to step 207.

在步骤206中,从第二轮廓上清除该内点、外点对应的像素点。具体的说,当A点的灰度值小于B点的灰度值时,清除C像素点。In step 206, the pixels corresponding to the inner point and the outer point are removed from the second contour. Specifically, when the gray value of point A is smaller than the gray value of point B, pixel C is cleared.

在步骤207中,保留第二轮廓上该内点、外点对应的像素点。体的说,当A点的灰度值大于B点的灰度值时,保留C像素点。In step 207, the pixel points corresponding to the inner point and the outer point on the second contour are reserved. Generally speaking, when the gray value of point A is greater than the gray value of point B, keep C pixel.

在步骤208中,判断第二轮廓上是否还有未选取的像素点。若是则返回步骤204,否则进入步骤209。具体的说,本步骤中若判断结果为是,说明第二轮廓上还有为选取的像素点,则返回步骤204继续选取第二轮廓上的像素点进行判断,否则说明第二轮廓上所有像素点都已经选取过,则进入步骤209。In step 208, it is determined whether there are unselected pixel points on the second contour. If so, return to step 204, otherwise enter step 209. Specifically, if the judgment result in this step is yes, it means that there are unselected pixels on the second contour, then return to step 204 and continue to select pixels on the second contour for judgment, otherwise, it means that all pixels on the second contour If all the points have been selected, go to step 209.

在步骤209中,将所有保留的像素点组成第一轮廓。本实施方式中的第一轮廓即为通过极性筛选后最终剩下的轮廓(像素点组成),如图7所示。In step 209, all the retained pixel points form the first contour. The first contour in this embodiment is the final remaining contour (composed of pixels) after passing the polarity screening, as shown in FIG. 7 .

在步骤210中,以第一轮廓上的像素点为圆心,以待提取的圆的半径取值范围内任意一个半径值为半径画圆。这样以第一轮廓上的像素点为圆心,以待提取的圆的半径取值范围内任意一个半径值为半径不断画圆,得到如图8所示的效果图。In step 210, a circle is drawn with the pixel point on the first contour as the center and any radius value within the radius value range of the circle to be extracted. In this way, the pixel point on the first contour is used as the center of the circle, and a circle is continuously drawn with any radius value within the radius value range of the circle to be extracted, and the effect diagram shown in FIG. 8 is obtained.

在步骤211中,在待提取的圆的圆心位置范围内,统计同一半径的圆的交叉次数。其中,待提取的圆的圆心位置范围可以根据第一圆心位置与第一偏差值计算得到,比如说,第一偏差值可以为5个像素,圆心的位置记为s[x,y],比如,若目标圆的圆心推测位置为[0,0],则x的取值范围为[-5,5]、y的取值范围为[-5,5](精度为1个像素)。In step 211 , count the number of intersections of circles with the same radius within the range of the center position of the circle to be extracted. Wherein, the range of the center position of the circle to be extracted can be calculated according to the first center position and the first deviation value, for example, the first deviation value can be 5 pixels, and the position of the circle center is recorded as s[x,y], for example , if the estimated position of the center of the target circle is [0,0], then the value range of x is [-5,5], and the value range of y is [-5,5] (the precision is 1 pixel).

在步骤212中,将交叉次数最多的圆的半径确定为第二半径,将交叉点的位置确定为第二圆心位置。In step 212, the radius of the circle with the most number of intersections is determined as the second radius, and the position of the intersection point is determined as the second circle center position.

本实施方式中,仅统计目标圆的圆心位置范围内的所有圆的交叉点,而不考虑该范围之外的圆的交叉次数,可以提高第二圆心位置选取的速度。In this embodiment, only the intersections of all circles within the center position range of the target circle are counted, and the number of intersections of circles outside the range is not considered, so that the speed of selecting the second circle center position can be improved.

本发明的第三实施方式涉及一种视觉识别方法。第三实施方式在第二实施方式的基础上做了改进,改进之处在于:在本实施方式中,以第一轮廓上的像素点为圆心,以待提取的圆的半径取值范围内任意一个半径值为半径画圆时,仅画出位于待提取的圆的圆心位置范围内的圆弧即可。A third embodiment of the present invention relates to a visual recognition method. The third embodiment has been improved on the basis of the second embodiment. The improvement is that: in this embodiment, the pixel point on the first contour is used as the center of the circle, and the radius of the circle to be extracted is arbitrary within the value range. When a radius value is used to draw a circle, only draw the arc within the range of the center of the circle to be extracted.

具体的说,在本实施方式中,统计同一半径的圆的交叉次数时,可以只统计同一半径的圆的圆弧的交叉次数。将交叉次数最多的圆弧所对应的圆的半径确定为第二半径,将交叉点的位置确定为第二圆心位置。Specifically, in this embodiment, when counting the number of intersections of circles with the same radius, only the number of intersections of arcs of circles with the same radius may be counted. The radius of the circle corresponding to the arc with the most number of intersections is determined as the second radius, and the position of the intersection point is determined as the second center position.

在本实施方式中,如图9所示,先计算图7中轮廓上的每个像素点的有效角度a2、a1(从轮廓点出发的两条射线L1、L2之间的区域恰好包含矩形区域,L1与坐标轴x正方向之间的夹角为a1,L2与坐标轴x正方向之间的夹角为a2);图中黑色的圆点即为目标圆的圆心推测位置(已知条件),矩形即为目标圆的圆心位置范围(实际求得的圆心有可能是该区域中的任何一个点,根据上文±5的偏差,该矩形长度为11像素)。In this embodiment, as shown in Figure 9, the effective angles a2 and a1 of each pixel point on the outline in Figure 7 are first calculated (the area between the two rays L1 and L2 starting from the outline point just includes a rectangular area , the angle between L1 and the positive direction of the coordinate axis x is a1, and the angle between L2 and the positive direction of the coordinate axis x is a2); the black dot in the figure is the estimated position of the center of the target circle (known conditions ), the rectangle is the range of the center of the target circle (the actual center of the circle may be any point in the area, according to the deviation of ±5 above, the length of the rectangle is 11 pixels).

在实际应用中,在统计同一半径的圆的圆弧的交叉次数时,可以根据目标圆的圆心的偏差和半径的偏差,产生一个初始值为0的三维数组,本实施方式中目标圆的圆心偏差可以为5像素,半径偏差可以为2像素,假设三维数组为s[x,y,r],则x,y,r各自的取值范围为[x-5,x+5],[y-5,y+5],[r-2,r+2],其中,目标圆的圆心推测位置的坐标为(x,y),推测半径为r。In practical applications, when counting the number of intersections of arcs of circles with the same radius, a three-dimensional array with an initial value of 0 can be generated according to the deviation of the center of the target circle and the deviation of the radius. In this embodiment, the center of the target circle The deviation can be 5 pixels, and the radius deviation can be 2 pixels. Assuming that the three-dimensional array is s[x,y,r], the respective value ranges of x, y, and r are [x-5, x+5], [y -5, y+5], [r-2, r+2], where the coordinates of the estimated position of the center of the target circle are (x, y), and the estimated radius is r.

根据所要提取的圆心和半径的精度,设定如下量:角度步长stepa、x的步长stepx、y的步长stepy、r的步长stepr;x、y、r的步长分别stepx、stepy、stepr,本实施方式中假设stepx、stepy、stepr均为1。r的偏差记为△R,x的偏差记为△X,y的偏差记为△Y;遍历图7所示的每个像素点(假设坐标为x0,y0),统计同一半径的圆的圆弧的交叉次数,具体计算代码如下:According to the accuracy of the center and radius to be extracted, set the following quantities: angle step stepa, x step size stepx, y step size stepy, r step size stepr; x, y, r step size stepx, stepy respectively , stepr, it is assumed that stepx, stepy, and stepr are all 1 in this embodiment. The deviation of r is recorded as △R, the deviation of x is recorded as △X, and the deviation of y is recorded as △Y; traverse each pixel shown in Figure 7 (assuming the coordinates are x0, y0), and count the circles of the circles with the same radius The number of arc intersections, the specific calculation code is as follows:

其中,图9中L1和L2之间的夹角被分割为Indexa份,ceil为返回大于或者等于指定表达式的最小整数,inDxa为自变量,取值范围为从0到indexa,inDxr为自变量,取值范围为从0到2*△R。Among them, the angle between L1 and L2 in Figure 9 is divided into Indexa parts, ceil is the smallest integer that returns greater than or equal to the specified expression, inDxa is the independent variable, and the value range is from 0 to indexa, and inDxr is the independent variable , the value range is from 0 to 2*△R.

根据上述统计的结果,将交叉次数最多的圆弧所对应的圆的半径确定为第二半径,将交叉点的位置确定为第二圆心位置。According to the above statistical results, the radius of the circle corresponding to the arc with the most number of intersections is determined as the second radius, and the position of the intersection point is determined as the second center position.

本实施方式可以仅画出在目标圆的圆心位置范围内的圆弧,在统计时就自动避免统计该范围之外的圆的交叉次数,可以提高第二圆心位置选取的速度。This embodiment can only draw the arc within the range of the center position of the target circle, and automatically avoid counting the number of intersections of the circles outside the range during statistics, which can increase the speed of selecting the second center position.

本发明的第四实施方式涉及一种视觉识别方法。第四实施方式在第一实施方式的基础上做了改进,改进之处在于:在本实施方式中,可以以不同的待提取的圆的圆心位置建立坐标系,降低了计算的复杂度,简单、容易实现,同时使得在计算目标圆的圆心位置时更准确。本实施方式中的视觉识别方法流程如图10所示,具体如下。A fourth embodiment of the present invention relates to a visual recognition method. The fourth embodiment has been improved on the basis of the first embodiment. The improvement is that in this embodiment, the coordinate system can be established with different center positions of the circles to be extracted, which reduces the complexity of calculation and is simple. , easy to implement, and at the same time make the calculation of the center position of the target circle more accurate. The process flow of the visual recognition method in this embodiment is shown in FIG. 10 , and the details are as follows.

在步骤1001中:以第一圆心位置为原点建立第一坐标系。具体的说,本实施方式中的第一圆心位置为目标圆的圆心推测位置。In step 1001: a first coordinate system is established with the first circle center position as the origin. Specifically, the first center position in this embodiment is the estimated position of the center of the target circle.

在步骤1002中:以灰度图中预设点为原点建立第二坐标系。具体的说,本实施方式中的预设点可以为灰度图图3中任意一个按键(key)上的圆心,也可以是根据键盘软膜的中心位置,或者键盘软膜的顶角位置。In step 1002: a second coordinate system is established with the preset point in the grayscale image as the origin. Specifically, the preset point in this embodiment can be the center of a circle on any key (key) in the grayscale image in FIG.

在步骤1003中:获取待识别物品的灰度图与目标圆的已知条件。具体的说,本实施方式中的已知条件包括第一圆心位置、第一半径、目标圆的极性、第一偏差值与第二偏差值。其中,目标圆为待提取的圆,第一偏差值为目标圆的圆心偏差值,第二偏差值为目标圆的半径偏差值,第一圆心位置为目标圆的圆心推测位置,第一半径为目标圆的推测半径。在实际应用中,可以通过拍照或者实物扫描获取待识别物品的图像,并对图像进行灰度处理得到待识别物品的灰度图,如图3所示。In step 1003: Acquiring the grayscale image of the object to be identified and the known conditions of the target circle. Specifically, the known conditions in this embodiment include the position of the first center of the circle, the first radius, the polarity of the target circle, the first deviation value and the second deviation value. Wherein, the target circle is the circle to be extracted, the first deviation value is the center deviation value of the target circle, the second deviation value is the radius deviation value of the target circle, the first center position is the estimated position of the center of the target circle, and the first radius is Inferred radius of the target circle. In practical applications, the image of the item to be identified can be obtained by taking a photo or scanning the object, and the image is processed in grayscale to obtain a grayscale image of the item to be identified, as shown in FIG. 3 .

在步骤1004中:对灰度图进行边缘检测获取灰度图的图像轮廓。具体的说,本实施方式中可以通过边缘检测算子—canny算子检测图3中的轮廓,为提取按键(key)上的圆做准备,提取后的按键的轮廓图如图4所示。In step 1004: performing edge detection on the grayscale image to obtain the image contour of the grayscale image. Specifically, in this embodiment, the contour in FIG. 3 can be detected by the edge detection operator—canny operator, in preparation for extracting the circle on the key. The contour of the key after extraction is shown in FIG. 4 .

在步骤1005中:根据已知条件对图像轮廓进行极性筛选,获取第一轮廓。具体的说,可以根据第二实施方式中的步骤203至步骤209获取第一轮廓,获取取后的第一轮廓如图7所示。In step 1005: performing polarity screening on the image contour according to known conditions to obtain the first contour. Specifically, the first contour can be obtained according to steps 203 to 209 in the second embodiment, and the obtained first contour is shown in FIG. 7 .

在步骤1006中:在第一坐标系中,确定第二圆心位置与第二半径。具体的说,本实施方式中第二圆心位置与第二半径的值可以根据第二实施方式中的步骤210至212获得。In step 1006: in the first coordinate system, determine the position of the second circle center and the second radius. Specifically, the values of the second circle center position and the second radius in this embodiment can be obtained according to steps 210 to 212 in the second embodiment.

在步骤1007中:根据第一坐标系与第二坐标系之间的变换关系,获取第二圆心位置在第二坐标系中的坐标。具体的说,可以根据第二坐标系的原点与第一坐标系的原点的位置关系,将第二圆心位置在第一坐标系中的坐标值换算成在第二坐标系中的坐标值。In step 1007: According to the transformation relationship between the first coordinate system and the second coordinate system, the coordinates of the second circle center position in the second coordinate system are acquired. Specifically, according to the positional relationship between the origin of the second coordinate system and the origin of the first coordinate system, the coordinate value of the second circle center position in the first coordinate system can be converted into the coordinate value in the second coordinate system.

本实施方式通过建立以目标圆的圆心推测位置为原点的坐标系,降低了计算的复杂度,简单、容易实现,同时使得在计算目标圆的圆心位置时更准确。In this embodiment, by establishing a coordinate system with the estimated position of the center of the target circle as the origin, the complexity of calculation is reduced, which is simple and easy to implement, and at the same time makes the calculation of the center position of the target circle more accurate.

上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包含相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。The division of steps in the above methods is only for the sake of clarity of description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this patent. ; Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but not changing the core design of the algorithm and process are all within the scope of protection of this patent.

本发明第五实施方式涉及一种视觉识别系统,如图11所示,包括:获取模块1、检测模块2、筛选模块3与确定模块4。The fifth embodiment of the present invention relates to a visual recognition system, as shown in FIG. 11 , including: an acquisition module 1 , a detection module 2 , a screening module 3 and a determination module 4 .

获取模块1,用于获取待识别物品的灰度图与目标圆的已知条件;其中,已知条件包括第一圆心位置、第一半径、目标圆的极性、第一偏差值与第二偏差值,目标圆为待提取的圆,第一偏差值为目标圆的圆心偏差值,第二偏差值为目标圆的半径偏差值,第一圆心位置为目标圆的圆心推测位置,第一半径为目标圆的推测半径。The acquisition module 1 is used to acquire the grayscale image of the item to be identified and the known conditions of the target circle; where the known conditions include the first circle center position, the first radius, the polarity of the target circle, the first deviation value and the second Deviation value, the target circle is the circle to be extracted, the first deviation value is the deviation value of the center of the target circle, the second deviation value is the radius deviation value of the target circle, the first center position is the estimated position of the center of the target circle, and the first radius is the estimated radius of the target circle.

检测模块2,用于对灰度图进行边缘检测获取灰度图的图像轮廓。The detection module 2 is configured to perform edge detection on the grayscale image to obtain an image profile of the grayscale image.

筛选模块3,用于根据已知条件对图像轮廓进行极性筛选,获取第一轮廓。The screening module 3 is configured to perform polarity screening on image contours according to known conditions to obtain the first contour.

确定模块4,用于根据第一轮廓确定第二圆心位置与第二半径;其中,第二圆心位置为确定的目标圆的圆心位置,第二半径为确定的目标圆的半径。The determining module 4 is configured to determine a second center position and a second radius according to the first contour; wherein, the second center position is the determined center position of the target circle, and the second radius is the determined radius of the target circle.

不难发现,本实施方式为与第一实施方式相对应的系统实施例,本实施方式可与第一实施方式互相配合实施。第一实施方式中提到的相关技术细节在本实施方式中依然有效,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第一实施方式中。It is not difficult to find that this embodiment is a system embodiment corresponding to the first embodiment, and this embodiment can be implemented in cooperation with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and will not be repeated here in order to reduce repetition. Correspondingly, the relevant technical details mentioned in this implementation manner can also be applied in the first implementation manner.

值得一提的是,本实施方式中所涉及到的各模块均为逻辑模块,在实际应用中,一个逻辑单元可以是一个物理单元,也可以是一个物理单元的一部分,还可以以多个物理单元的组合实现。此外,为了突出本发明的创新部分,本实施方式中并没有将与解决本发明所提出的技术问题关系不太密切的单元引入,但这并不表明本实施方式中不存在其它的单元。It is worth mentioning that all the modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, or a part of a physical unit, or multiple physical units. Combination of units. In addition, in order to highlight the innovative part of the present invention, units that are not closely related to solving the technical problems proposed by the present invention are not introduced in this embodiment, but this does not mean that there are no other units in this embodiment.

本发明第六实施方式涉及一种视觉识别系统。本实施方式中的确定模块4具体包括:画圆子模块41、统计子模块42与比较子模块43,如图12所示。The sixth embodiment of the present invention relates to a visual recognition system. The determination module 4 in this embodiment specifically includes: a circle drawing sub-module 41 , a statistics sub-module 42 and a comparison sub-module 43 , as shown in FIG. 12 .

画圆子模块41,用于以第一轮廓上的像素点为圆心,以目标圆的半径取值范围内任意一个半径值为半径画圆;半径取值范围根据第一半径与第二偏差值计算得到。The circle drawing sub-module 41 is used to draw a circle with the pixel point on the first contour as the center and any radius value within the radius value range of the target circle; the radius value range is calculated according to the first radius and the second deviation value get.

统计子模块42,用于在目标圆的圆心位置范围内,统计同一半径的圆的交叉次数;其中,目标圆的圆心位置范围根据第一圆心位置与第一偏差值计算得到。The statistics sub-module 42 is used to count the number of intersections of circles with the same radius within the center position range of the target circle; wherein, the center position range of the target circle is calculated according to the first center position and the first deviation value.

比较子模块43,用于比较统计子模块42的统计结果中各不同半径的圆的交叉次数,将交叉次数最多的圆的半径确定为第二半径,将交叉点的位置确定为第二圆心位置。Comparison sub-module 43 is used to compare the number of intersections of circles with different radii in the statistical results of the statistical sub-module 42, determine the radius of the circle with the largest number of intersections as the second radius, and determine the position of the intersection point as the second center position .

由于第二实施方式与本实施方式相互对应,因此本实施方式可与第二实施方式互相配合实施。第二实施方式中提到的相关技术细节在本实施方式中依然有效,在第二实施方式中所能达到的技术效果在本实施方式中也同样可以实现,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第二实施方式中。Since the second embodiment corresponds to the present embodiment, the present embodiment can be implemented in cooperation with the second embodiment. The relevant technical details mentioned in the second embodiment are still valid in this embodiment, and the technical effects that can be achieved in the second embodiment can also be achieved in this embodiment, and in order to reduce repetition, details are not repeated here. Correspondingly, the relevant technical details mentioned in this embodiment mode can also be applied in the second embodiment mode.

本发明第七实施方式涉及一种视觉识别系统。本实施方式在第六实施方式的基础上做了改进,改进之处在于:The seventh embodiment of the present invention relates to a visual recognition system. This embodiment has been improved on the basis of the sixth embodiment, and the improvements are as follows:

在本实施方式中,画圆子模块41,可以仅画出位于目标圆的圆心位置范围内的圆弧。In this embodiment, the circle drawing sub-module 41 can only draw arcs within the range of the center position of the target circle.

统计子模块42,还可以用于统计同一半径的圆的圆弧的交叉次数。The statistical sub-module 42 can also be used to count the number of intersections of arcs of circles with the same radius.

比较子模块43,还可以用于比较统计子模块42的统计结果中各不同半径的圆的圆弧的交叉次数,将交叉次数最多的圆弧所对应的圆的半径确定为第二半径。The comparison sub-module 43 can also be used to compare the number of intersections of arcs of circles with different radii in the statistical results of the statistics sub-module 42, and determine the radius of the circle corresponding to the arc with the most number of intersections as the second radius.

本实施方式为与第三实施方式相对应的系统实施例,本实施方式可与第三实施方式互相配合实施。第三实施方式中提到的相关技术细节在本实施方式中依然有效,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第三实施方式中。This embodiment is a system embodiment corresponding to the third embodiment, and this embodiment can be implemented in cooperation with the third embodiment. The relevant technical details mentioned in the third embodiment are still valid in this embodiment, and will not be repeated here in order to reduce repetition. Correspondingly, the relevant technical details mentioned in this embodiment mode can also be applied in the third embodiment mode.

本领域技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Those skilled in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing related hardware through a program. The program is stored in a storage medium and includes several instructions to make a device (which can be a single-chip , chip, etc.) or a processor (processor) executes all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-OnlyMemory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.

本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes can be made to it in form and details without departing from the spirit and spirit of the present invention. scope.

Claims (10)

1.一种视觉识别方法,其特征在于,包括:1. A visual recognition method, characterized in that, comprising: 获取待识别物品的灰度图与目标圆的已知条件;其中,所述已知条件包括第一圆心位置、第一半径、所述目标圆的极性、第一偏差值与第二偏差值,所述目标圆为待提取的圆,所述第一偏差值为所述目标圆的圆心偏差值,所述第二偏差值为所述目标圆的半径偏差值,所述第一圆心位置为所述目标圆的圆心推测位置,所述第一半径为所述目标圆的推测半径;Acquiring the grayscale image of the item to be identified and the known conditions of the target circle; wherein the known conditions include the position of the first center of the circle, the first radius, the polarity of the target circle, the first deviation value and the second deviation value , the target circle is a circle to be extracted, the first deviation value is the center deviation value of the target circle, the second deviation value is the radius deviation value of the target circle, and the first center position is The estimated position of the center of the target circle, the first radius being the estimated radius of the target circle; 对所述灰度图进行边缘检测获取所述灰度图的图像轮廓;performing edge detection on the grayscale image to obtain the image profile of the grayscale image; 根据所述已知条件对所述图像轮廓进行极性筛选,获取第一轮廓;performing polarity screening on the image profile according to the known conditions to obtain a first profile; 根据所述第一轮廓确定第二圆心位置与第二半径;其中,所述第二圆心位置为确定的目标圆的圆心位置,所述第二半径为确定的目标圆的半径。A second center position and a second radius are determined according to the first profile; wherein, the second center position is the determined center position of the target circle, and the second radius is the determined radius of the target circle. 2.根据权利要求1所述的视觉识别方法,其特征在于,在根据所述第一轮廓确定第二圆心位置与第二半径中,具体包括:2. The visual recognition method according to claim 1, wherein determining the second center position and the second radius according to the first outline specifically includes: 以所述第一轮廓上的像素点为圆心,以所述目标圆的半径取值范围内任意一个半径值为半径画圆;所述半径取值范围根据所述第一半径与所述第二偏差值计算得到;Taking the pixel point on the first contour as the center, draw a circle with any radius value in the radius value range of the target circle; the radius value range is based on the first radius and the second radius value. The deviation value is calculated; 在所述目标圆的圆心位置范围内,统计同一半径的圆的交叉次数;其中,所述目标圆的圆心位置范围根据所述第一圆心位置与所述第一偏差值计算得到;Within the center position range of the target circle, count the number of intersections of circles with the same radius; wherein, the center position range of the target circle is calculated according to the first center position and the first deviation value; 将交叉次数最多的圆的半径确定为所述第二半径,将交叉点的位置确定为所述第二圆心位置。The radius of the circle with the most number of intersections is determined as the second radius, and the position of the intersection point is determined as the second center position. 3.根据权利要求2所述的视觉识别方法,其特征在于,在以所述第一轮廓上的像素点为圆心,以所述目标圆的半径取值范围内任意一个半径值为半径画圆中,具体包括:3. The visual recognition method according to claim 2, wherein, taking the pixel point on the first contour as the center, drawing a circle with any radius value within the radius value range of the target circle , including: 仅画出位于所述目标圆的圆心位置范围内的圆弧;Only draw the arcs within the range of the center position of the target circle; 在所述目标圆的圆心位置范围内,统计同一半径的圆的交叉次数中,具体包括:Within the range of the center position of the target circle, counting the number of intersections of circles with the same radius specifically includes: 统计同一半径的圆的圆弧的交叉次数;Count the number of intersections of arcs of circles with the same radius; 在所述将交叉次数最多的圆的半径确定为所述第二半径,将交叉点的位置确定为所述第二圆心位置中,具体包括:In said determining the radius of the circle with the most number of intersections as the second radius, and determining the position of the intersection point as the position of the second center of the circle, it specifically includes: 将交叉次数最多的圆弧所对应的圆的半径确定为所述第二半径。The radius of the circle corresponding to the arc with the largest number of intersections is determined as the second radius. 4.根据权利要求1所述的视觉识别方法,其特征在于,在获取待识别物品的灰度图与目标圆的已知条件之前,还包括:4. The visual recognition method according to claim 1, characterized in that, before obtaining the grayscale image of the item to be recognized and the known conditions of the target circle, it also includes: 以所述第一圆心位置为原点建立第一坐标系,以所述灰度图中预设点为原点建立第二坐标系;Establishing a first coordinate system with the first center position as the origin, and establishing a second coordinate system with the preset point in the grayscale image as the origin; 在根据所述第一轮廓确定第二圆心位置与第二半径中,具体包括:In determining the position of the second circle center and the second radius according to the first contour, it specifically includes: 在所述第一坐标系中,确定所述第二圆心位置与所述第二半径;In the first coordinate system, determine the second center position and the second radius; 在根据所述第一轮廓确定第二圆心位置与第二半径之后,还包括:After determining the second circle center position and the second radius according to the first contour, it also includes: 根据所述第一坐标系与所述第二坐标系之间的变换关系,获取所述第二圆心位置在所述第二坐标系中的坐标。According to the transformation relationship between the first coordinate system and the second coordinate system, the coordinates of the second circle center position in the second coordinate system are acquired. 5.根据权利要求1所述的视觉识别方法,其特征在于,在根据所述已知条件对所述图像轮廓进行极性筛选,获取第一轮廓中,具体包括:5. The visual recognition method according to claim 1, characterized in that, performing polarity screening on the image contour according to the known conditions to obtain the first contour, specifically includes: 根据所述已知条件获取第二轮廓;其中,所述第二轮廓为目标区域内的轮廓,所述目标区域为环形区域,所述环形区域的内圆半径等于所述第一半径减去第一固定值;所述第一固定值大于所述第一偏差值与所述第二偏差值之和,所述环形区域的外圆半径等于所述第一半径加上第二固定值;所述第二固定值大于所述第一偏差值与所述第二偏差值之和;The second contour is obtained according to the known conditions; wherein, the second contour is a contour in the target area, the target area is an annular area, and the radius of the inner circle of the annular area is equal to the first radius minus the first radius A fixed value; the first fixed value is greater than the sum of the first deviation value and the second deviation value, and the outer circle radius of the annular area is equal to the first radius plus the second fixed value; the The second fixed value is greater than the sum of the first deviation value and the second deviation value; 对于所述第二轮廓上的每一个像素点,获取一个内点与一个外点;其中,所述内点与所述外点均位于所述第二轮廓上的像素点与所述第一圆心位置的像素点的连线上,所述内点、外点分别位于以所述第一圆心位置的像素点为圆心、以所述第二轮廓上的像素点到所述第一圆心位置的像素点的距离为半径的圆的内侧、外侧;For each pixel point on the second contour, obtain an inner point and an outer point; wherein, the inner point and the outer point are both located at the pixel point on the second contour and the first circle center On the connection line of the pixel points at the position, the inner point and the outer point are respectively located with the pixel point at the first center position as the center of the circle, and the pixel point on the second contour to the pixel at the first center position The distance between the points is the inside and outside of the circle of radius; 若所述内点的灰度值小于所述外点的灰度值,则从所述第二轮廓上清除所述内点、所述外点对应的像素点;若所述内点的灰度值大于所述外点的灰度值,则保留所述第二轮廓上所述内点、所述外点对应的像素点,其中,所有保留的像素点组成所述第一轮廓。If the gray value of the inner point is smaller than the gray value of the outer point, then remove the inner point and the pixel corresponding to the outer point from the second contour; if the gray value of the inner point If the value is greater than the gray value of the outer point, the pixel points corresponding to the inner point and the outer point on the second contour are retained, wherein all the retained pixel points form the first contour. 6.根据权利要求1所述的视觉识别方法,其特征在于,在对所述灰度图进行边缘检测获取所述灰度图的图像轮廓中,具体包括:6. The visual recognition method according to claim 1, wherein, in performing edge detection on the grayscale image to obtain the image profile of the grayscale image, specifically comprising: 采用坎尼算子对所述灰度图进行边缘检测。Edge detection is performed on the grayscale image using the Canny operator. 7.根据权利要求1所述的视觉识别方法,其特征在于,所述第一偏差值为5个像素,所述第二偏差值为2个像素。7. The visual recognition method according to claim 1, wherein the first deviation value is 5 pixels, and the second deviation value is 2 pixels. 8.一种视觉识别系统,其特征在于,包括:获取模块、检测模块、筛选模块与确定模块;8. A visual recognition system, comprising: an acquisition module, a detection module, a screening module and a determination module; 所述获取模块,用于获取待识别物品的灰度图与目标圆的已知条件;其中,所述已知条件包括第一圆心位置、第一半径、所述目标圆的极性、第一偏差值与第二偏差值,所述目标圆为待提取的圆,所述第一偏差值为所述目标圆的圆心偏差值,所述第二偏差值为所述目标圆的半径偏差值,所述第一圆心位置为所述目标圆的圆心推测位置,所述第一半径为所述目标圆的推测半径;The acquisition module is used to acquire the grayscale image of the item to be identified and the known conditions of the target circle; wherein the known conditions include the first circle center position, the first radius, the polarity of the target circle, the first A deviation value and a second deviation value, the target circle is a circle to be extracted, the first deviation value is a center deviation value of the target circle, and the second deviation value is a radius deviation value of the target circle, The first center position is the estimated position of the center of the target circle, and the first radius is the estimated radius of the target circle; 所述检测模块,用于对所述灰度图进行边缘检测获取所述灰度图的图像轮廓;The detection module is configured to perform edge detection on the grayscale image to obtain an image profile of the grayscale image; 所述筛选模块,用于根据所述已知条件对所述图像轮廓进行极性筛选,获取第一轮廓;The screening module is configured to perform polarity screening on the image profile according to the known conditions to obtain a first profile; 所述确定模块,用于根据所述第一轮廓确定第二圆心位置与第二半径;其中,所述第二圆心位置为确定的目标圆的圆心位置,所述第二半径为确定的目标圆的半径。The determining module is configured to determine a second center position and a second radius according to the first profile; wherein, the second center position is the center position of the determined target circle, and the second radius is the determined target circle of the radius. 9.根据权利要求8所述的视觉识别系统,其特征在于,所述确定模块具体包括:画圆子模块、统计子模块与比较子模块;9. The visual recognition system according to claim 8, wherein the determination module specifically comprises: a circle drawing submodule, a statistics submodule and a comparison submodule; 所述画圆子模块,用于以所述第一轮廓上的像素点为圆心,以所述目标圆的半径取值范围内任意一个半径值为半径画圆;所述半径取值范围根据所述第一半径与所述第二偏差值计算得到;The circle drawing sub-module is used to draw a circle with the pixel point on the first contour as the center and any radius value within the radius value range of the target circle; the radius value range is based on the The first radius and the second deviation value are calculated; 所述统计子模块,用于在所述目标圆的圆心位置范围内,统计同一半径的圆的交叉次数;其中,所述目标圆的圆心位置范围根据所述第一圆心位置与所述第一偏差值计算得到;The statistical sub-module is used to count the number of intersections of circles with the same radius within the center position range of the target circle; wherein, the center position range of the target circle is based on the first circle center position and the first The deviation value is calculated; 所述比较子模块,用于比较所述统计子模块的统计结果中各不同半径的圆的交叉次数,将交叉次数最多的圆的半径确定为所述第二半径,将交叉点的位置确定为所述第二圆心位置。The comparison submodule is used to compare the number of intersections of circles with different radii in the statistical results of the statistical submodule, determine the radius of the circle with the largest number of intersections as the second radius, and determine the position of the intersection as The second center position. 10.根据权利要求9所述的视觉识别系统,其特征在于,所述画圆子模块,仅画出位于所述目标圆的圆心位置范围内的圆弧;10. The visual recognition system according to claim 9, wherein the circle drawing sub-module only draws an arc within the range of the center position of the target circle; 所述统计子模块,用于统计同一半径的圆的圆弧的交叉次数;The statistical submodule is used to count the number of times of intersections of circular arcs of circles with the same radius; 所述比较子模块,用于比较所述统计子模块的统计结果中各不同半径的圆的圆弧的交叉次数,将交叉次数最多的圆弧所对应的圆的半径确定为所述第二半径。The comparison submodule is used to compare the number of intersections of arcs of circles with different radii in the statistical results of the statistical submodule, and determine the radius of the circle corresponding to the arc with the largest number of intersections as the second radius .
CN201610498006.5A 2016-06-29 2016-06-29 Visual recognition method and system Expired - Fee Related CN106204542B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610498006.5A CN106204542B (en) 2016-06-29 2016-06-29 Visual recognition method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610498006.5A CN106204542B (en) 2016-06-29 2016-06-29 Visual recognition method and system

Publications (2)

Publication Number Publication Date
CN106204542A true CN106204542A (en) 2016-12-07
CN106204542B CN106204542B (en) 2019-04-19

Family

ID=57462654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610498006.5A Expired - Fee Related CN106204542B (en) 2016-06-29 2016-06-29 Visual recognition method and system

Country Status (1)

Country Link
CN (1) CN106204542B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106846342A (en) * 2017-02-23 2017-06-13 东莞市旭海机械有限公司 A kind of Full-automatic tobacco bag cutting machine
CN108230388A (en) * 2018-02-06 2018-06-29 广西艾盛创制科技有限公司 A kind of recognition positioning method of white body weld point image
WO2020133538A1 (en) * 2018-12-29 2020-07-02 深圳配天智能技术研究院有限公司 Circular feature detection method, processing system and apparatus having storage function
EP4336449A4 (en) * 2022-07-25 2024-10-23 Honor Device Co., Ltd. METHOD AND APPARATUS FOR POSITIONING MARKER HOLE, ASSEMBLY DEVICE AND STORAGE MEDIUM

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885312A (en) * 2006-07-11 2006-12-27 电子科技大学 Iris positioning method based on morphology and probability statistic
CN101311963A (en) * 2008-06-17 2008-11-26 东南大学 Round mark point center picture projection point position acquiring method for positioning video camera
US20090169130A1 (en) * 2007-12-31 2009-07-02 Intel Corporation Accelerating the hough transform
JP2010128616A (en) * 2008-11-25 2010-06-10 Panasonic Electric Works Co Ltd Circle detection apparatus
CN103093222A (en) * 2011-11-07 2013-05-08 鸿富锦精密工业(深圳)有限公司 Main board circular hole locating method and system
CN103606167A (en) * 2013-12-04 2014-02-26 天津普达软件技术有限公司 Outer bottle cap profile determining method for defect detection
CN103854279A (en) * 2012-12-03 2014-06-11 美国亚德诺半导体公司 Hough transform for circles
CN104123728A (en) * 2014-07-29 2014-10-29 国家电网公司 Hough transform based round pipe detection method
CN104537650A (en) * 2014-12-16 2015-04-22 广州视源电子科技股份有限公司 Polarity direction determination method and device for aluminum electrolytic capacitor
CN105405122A (en) * 2015-10-26 2016-03-16 东南大学 Circle detection method based on data stationarity

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885312A (en) * 2006-07-11 2006-12-27 电子科技大学 Iris positioning method based on morphology and probability statistic
US20090169130A1 (en) * 2007-12-31 2009-07-02 Intel Corporation Accelerating the hough transform
CN101311963A (en) * 2008-06-17 2008-11-26 东南大学 Round mark point center picture projection point position acquiring method for positioning video camera
JP2010128616A (en) * 2008-11-25 2010-06-10 Panasonic Electric Works Co Ltd Circle detection apparatus
CN103093222A (en) * 2011-11-07 2013-05-08 鸿富锦精密工业(深圳)有限公司 Main board circular hole locating method and system
CN103854279A (en) * 2012-12-03 2014-06-11 美国亚德诺半导体公司 Hough transform for circles
CN103606167A (en) * 2013-12-04 2014-02-26 天津普达软件技术有限公司 Outer bottle cap profile determining method for defect detection
CN104123728A (en) * 2014-07-29 2014-10-29 国家电网公司 Hough transform based round pipe detection method
CN104537650A (en) * 2014-12-16 2015-04-22 广州视源电子科技股份有限公司 Polarity direction determination method and device for aluminum electrolytic capacitor
CN105405122A (en) * 2015-10-26 2016-03-16 东南大学 Circle detection method based on data stationarity

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106846342A (en) * 2017-02-23 2017-06-13 东莞市旭海机械有限公司 A kind of Full-automatic tobacco bag cutting machine
CN108230388A (en) * 2018-02-06 2018-06-29 广西艾盛创制科技有限公司 A kind of recognition positioning method of white body weld point image
WO2020133538A1 (en) * 2018-12-29 2020-07-02 深圳配天智能技术研究院有限公司 Circular feature detection method, processing system and apparatus having storage function
CN111801709A (en) * 2018-12-29 2020-10-20 深圳配天智能技术研究院有限公司 Circular feature detection method, processing system and device with storage function
CN111801709B (en) * 2018-12-29 2023-12-22 深圳配天机器人技术有限公司 Circular feature detection method, processing system and device with storage function
EP4336449A4 (en) * 2022-07-25 2024-10-23 Honor Device Co., Ltd. METHOD AND APPARATUS FOR POSITIONING MARKER HOLE, ASSEMBLY DEVICE AND STORAGE MEDIUM

Also Published As

Publication number Publication date
CN106204542B (en) 2019-04-19

Similar Documents

Publication Publication Date Title
EP3537375B1 (en) Image segmentation methods, image segmentation system and device comprising same, and storage medium
CN104978012B (en) One kind points to exchange method, apparatus and system
CN108986152B (en) A foreign object detection method and device based on differential image
CN103218605B (en) A kind of fast human-eye positioning method based on integral projection and rim detection
US11281897B2 (en) Gesture shaking recognition method and apparatus, and gesture recognition method
EP2339507B1 (en) Head detection and localisation method
JP2016513320A (en) Method and apparatus for image enhancement and edge verification using at least one additional image
CN107464252A (en) A kind of visible ray based on composite character and infrared heterologous image-recognizing method
CN115131363A (en) Semantic information-based positioning method, device and terminal device
CN106204542A (en) Visual identity method and system
CN106204540A (en) Visible detection method
CN104102347A (en) Fingertip positioning method and fingertip positioning terminal
US20180158203A1 (en) Object detection device and object detection method
CN104966047A (en) Method and device for identifying vehicle license
CN112950650A (en) Deep learning distorted light spot center extraction method suitable for high-precision morphology measurement
CN109670447B (en) Recognition methods, device and the readable storage medium storing program for executing of seal ballot paper full-filling block diagram picture
KR20150053438A (en) Stereo matching system and method for generating disparity map using the same
EP3955207A1 (en) Object detection device
CN106663317B (en) Morphological processing method and digital image processing device for digital image
CN111489384B (en) Method, device, system and medium for evaluating shielding based on mutual viewing angle
CN106909874A (en) A kind of nose localization method and device
CN108205641B (en) Gesture image processing method and device
CN113033256B (en) Training method and device for fingertip detection model
US10115195B2 (en) Method and apparatus for processing block to be processed of urine sediment image
Wang et al. An accurate iris location method for low quality iris images

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220411

Address after: 518126 No. 1, floor 2, unit 1, kangtuochang 1, Difu road section, Gushu community, Xixiang street, Bao'an District, Shenzhen, Guangdong

Patentee after: Shenzhen Siqin Technology Co.,Ltd.

Address before: No.888 Shengli Road, industrial park, Qingpu District, Shanghai, 201700 (no.10055, Songze Avenue)

Patentee before: SHANGHAI SUNRISE SIMCOM ELECTRONIC TECHNOLOGY Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190419