[go: up one dir, main page]

CN114638911A - Method for splitting polygon, automatic optical detection equipment and storage medium - Google Patents

Method for splitting polygon, automatic optical detection equipment and storage medium Download PDF

Info

Publication number
CN114638911A
CN114638911A CN202210153376.0A CN202210153376A CN114638911A CN 114638911 A CN114638911 A CN 114638911A CN 202210153376 A CN202210153376 A CN 202210153376A CN 114638911 A CN114638911 A CN 114638911A
Authority
CN
China
Prior art keywords
polygon
preset
split
rectangle
rectangles
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.)
Pending
Application number
CN202210153376.0A
Other languages
Chinese (zh)
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.)
Guangzhou Luchen Intelligent Equipment Technology Co ltd
Original Assignee
Guangzhou Luchen Intelligent Equipment 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 Guangzhou Luchen Intelligent Equipment Technology Co ltd filed Critical Guangzhou Luchen Intelligent Equipment Technology Co ltd
Priority to CN202210153376.0A priority Critical patent/CN114638911A/en
Publication of CN114638911A publication Critical patent/CN114638911A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/956Inspecting patterns on the surface of objects
    • 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
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8887Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
    • 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/30141Printed circuit board [PCB]
    • 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/30152Solder

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a polygon splitting method, automatic optical detection equipment and a storage medium, and relates to the field of automatic optical detection. The method comprises the following steps: dividing a polygon to be split into a plurality of preset rectangles to form a preset rectangular matrix; the preset rectangular matrix cuts the edge of the polygon to be split into a plurality of line segments; binding each line segment with a corresponding preset rectangle according to the direction of the polygon to be split to form a plurality of small polygons; and combining the small polygons into a group of small polygons. Thereby only need confirm to treat the outermost region of split polygon, just can be automatically with a big polygon split of treating the split into a plurality of little polygons that accurately accord with field angle size requirement, the split polygon is fast, easy operation for the camera of AOI equipment can shoot the circuit board of irregular polygon appearance according to the little polygon that the split was come out, eliminates AOI equipment and has the hidden danger that detects the omission when detecting circuit board defect.

Description

一种多边形拆分的方法、自动光学检测设备及存储介质A polygon splitting method, automatic optical detection device and storage medium

技术领域technical field

本申请涉及自动光学检测领域,尤其涉及一种多边形拆分的方法、自动光学检测设备及存储介质。The present application relates to the field of automatic optical detection, and in particular, to a method for splitting polygons, an automatic optical detection device and a storage medium.

背景技术Background technique

自动光学检测(Automated Optical Inspection,AOI)设备,是基于光学原理来对电路板板卡焊接生产中遇到的常见缺陷进行检测的设备。Automatic optical inspection (Automated Optical Inspection, AOI) equipment is a device based on optical principles to detect common defects encountered in the production of circuit board and board welding.

对于电路板,为保证电路板的性能,一般会在电路板上会涂覆一层三防漆,其中,涂覆的三防漆一般呈不规则形状,如图1所示。For the circuit board, in order to ensure the performance of the circuit board, a layer of conformal paint is generally applied on the circuit board, and the coated conformal paint is generally irregular in shape, as shown in Figure 1.

由于电路板一般是比较大,所以AOI设备需要移动相机分别对多个检测区域进行多次拍照,分别进行检测。当单个的检测区域过大,超过一个FOV(Field of View,视场角)(即相机单次可拍摄的电路板尺寸)时(如图2所示的虚线框),就无法使用相机一次性将电路板全部拍照完成,所以,需要将电路板的不规则的多边形外形拆分成多个符合要求的小多边形进行检测,如图3所示。Since the circuit board is generally relatively large, the AOI device needs to move the camera to take multiple pictures of multiple detection areas, and perform detection separately. When a single detection area is too large and exceeds one FOV (Field of View, field of view) (that is, the size of the circuit board that the camera can shoot at a single time) (the dotted line box shown in Figure 2), the camera cannot be used at one time. All the circuit boards are photographed. Therefore, the irregular polygonal shape of the circuit board needs to be divided into multiple small polygons that meet the requirements for detection, as shown in Figure 3.

目前,对于如图3所示的多个小多边形,一般是采用手动方式去绘制,以便AOI设备的相机可以按照绘制出的小多边形进行拍照。由于手动绘制多个多边形比较耗时,且在手动绘制小多边形的过程中无法准确判断是否超出了FOV的大小,无法准确判断手动绘制小多边形是否满足FOV的大小,使得AOI设备的相机按照手动绘制出的小多边形进行拍照时,存在使AOI设备的相机无法拍全电路板的风险,造成AOI设备在检测电路板缺陷时存在检测遗漏的隐患。At present, for a plurality of small polygons as shown in FIG. 3 , a manual method is generally used to draw, so that the camera of the AOI device can take pictures according to the drawn small polygons. Since it is time-consuming to draw multiple polygons manually, and in the process of manually drawing small polygons, it is impossible to accurately determine whether the size of the FOV is exceeded, and it is impossible to accurately determine whether the manually drawn small polygons meet the size of the FOV, so that the camera of the AOI device is drawn manually. When taking pictures of small polygons, there is a risk that the camera of the AOI equipment cannot take pictures of the entire circuit board, resulting in the hidden danger of omission of detection when the AOI equipment detects circuit board defects.

发明内容SUMMARY OF THE INVENTION

本申请实施例旨在提供一种多边形拆分的方法、自动光学检测设备及存储介质,可以解决现有的手动绘制多个小多边形比较耗时,且手动绘制小多边形无法满足视场角的大小,造成AOI设备在检测电路板缺陷时存在检测遗漏的问题。The embodiments of the present application aim to provide a polygon splitting method, an automatic optical detection device, and a storage medium, which can solve the problem that the existing manual drawing of multiple small polygons is time-consuming, and the manual drawing of small polygons cannot meet the size of the field of view. , resulting in the problem of omission of detection when AOI equipment detects circuit board defects.

为解决上述技术问题,本申请实施例提供以下技术方案:一种多边形拆分的方法,所述方法包括:In order to solve the above-mentioned technical problems, the embodiments of the present application provide the following technical solutions: a method for dividing a polygon, the method comprising:

将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵;Divide the polygon to be split into a plurality of preset rectangles to form a preset rectangle matrix;

所述预设矩形矩阵将待拆分多边形的边截断成多条线段;The preset rectangular matrix truncates the edges of the polygon to be split into a plurality of line segments;

按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形;According to the direction of the polygon to be split, bind each line segment to its corresponding preset rectangle to form several small polygons;

将上述若干个小多边形合并成一组小多边形。Combine the above several small polygons into a group of small polygons.

可选地,所述将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵;包括:Optionally, dividing the polygon to be split into a plurality of preset rectangles to form a preset rectangle matrix; including:

确定待拆分多边形;Determine the polygon to be split;

确定待拆分多边形的外接矩形的宽度和高度;Determine the width and height of the circumscribed rectangle of the polygon to be split;

确定预设矩形的宽度高度;Determine the width and height of the preset rectangle;

根据外接矩形的宽度和高度与预设矩形的宽度和高度,将所述外接矩形分割成多个预设矩形,形成预设矩形矩阵。According to the width and height of the circumscribed rectangle and the width and height of the preset rectangle, the circumscribed rectangle is divided into a plurality of preset rectangles to form a preset rectangle matrix.

可选地,所述预设矩形的宽度为视场角的宽度,所述预设矩形的高度为视场角的高度。Optionally, the width of the preset rectangle is the width of the angle of view, and the height of the preset rectangle is the height of the angle of view.

可选地,所述根据外接矩形的宽度和高度与预设矩形的宽度和高度,将所述外接矩形分割成多个预设矩形,形成预设矩形矩阵;包括:Optionally, according to the width and height of the circumscribed rectangle and the width and height of the preset rectangle, the circumscribed rectangle is divided into a plurality of preset rectangles to form a preset rectangle matrix; including:

确定横向分割的预设矩形个数和纵向分割的预设矩形个数;Determine the number of preset rectangles for horizontal division and the number of preset rectangles for vertical division;

将横向分割的预设矩形和纵向分割的预设矩形构成预设矩形矩阵。A preset rectangle matrix is formed by a preset rectangle divided horizontally and a preset rectangle divided vertically.

可选地,所述按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形;包括:Optionally, according to the direction of the polygon to be split, each line segment is bound to its corresponding preset rectangle to form several small polygons; including:

按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定;Bind each line segment to its corresponding preset rectangle according to the direction of the polygon to be split;

判断是否存在有与线段交叉的预设矩形,根据判断结果决定是否组成小多边形。It is judged whether there is a preset rectangle intersecting with the line segment, and whether to form a small polygon is determined according to the judgment result.

可选地,所述判断是否存在有与线段交叉的预设矩形,根据判断结果决定是否组成小多边形,包括:Optionally, the judging whether there is a preset rectangle intersecting with the line segment, and whether to form a small polygon according to the judging result, including:

如果存在有与线段交叉的预设矩形,则将该预设矩形的边缘与其交叉的线段组成一个小多边形。If there is a preset rectangle intersecting with the line segment, the edge of the preset rectangle and the line segment intersecting with it form a small polygon.

可选地,所述判断是否存在有与线段交叉的预设矩形,根据判断结果决定是否组成小多边形,包括:Optionally, the judging whether there is a preset rectangle intersecting with the line segment, and whether to form a small polygon according to the judging result, including:

如果存在有不与线段交叉的预设矩形,则进一步判断该预设矩形是否在该待拆分多边形内部,根据判断结果决定是否组成小多边形。If there is a preset rectangle that does not intersect the line segment, it is further judged whether the preset rectangle is inside the polygon to be split, and whether to form a small polygon is determined according to the judgment result.

可选地,所述判断该预设矩形是否在该待拆分多边形内部,根据判断结果决定是否组成小多边形,包括:Optionally, judging whether the preset rectangle is inside the polygon to be split, and determining whether to form a small polygon according to the judgment result, including:

如果该预设矩形是在该待拆分多边形内部,则该预设矩形本身组成一个小多边形;If the preset rectangle is inside the polygon to be split, the preset rectangle itself constitutes a small polygon;

如果该预设矩形不是在该待拆分多边形内部,则直接丢弃该预设矩形。If the preset rectangle is not inside the polygon to be split, the preset rectangle is directly discarded.

为解决上述技术问题,本申请实施例还提供以下技术方案:一种自动光学检测设备,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现本申请任一实施例所述的一种多边形拆分的方法的步骤。In order to solve the above technical problems, the embodiments of the present application also provide the following technical solutions: an automatic optical detection device, comprising: a memory, a processor, and a computer program stored on the memory and running on the processor, When the computer program is executed by the processor, the method for implementing a polygon splitting method described in any embodiment of the present application is implemented.

为解决上述技术问题,本申请实施例还提供以下技术方案:一种存储介质,所述存储介质上存储有一种多边形拆分的方法的程序,所述一种多边形拆分的方法的程序被处理器执行时实现本申请任一实施例所述的一种多边形拆分的方法的步骤。In order to solve the above technical problems, the embodiments of the present application also provide the following technical solutions: a storage medium, on which a program of a method for splitting polygons is stored, and the program of the method for splitting polygons is processed The steps of implementing the method for splitting a polygon described in any embodiment of the present application when the processor is executed.

与现有技术相比较,本申请实施例提供的一种多边形拆分的方法、自动光学检测设备及存储介质,通过将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵,所述预设矩形矩阵将待拆分多边形的边截断成多条线段;按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形,再将上述若干个小多边形合并成一组小多边形。从而只需确定待拆分多边形的最外层区域,就可以自动将一个大的待拆分大多边形自动拆分成多个准确地符合视场角大小要求的小多边形,拆分多边形速度快,操作简单,使得AOI设备的相机可以将不规则多边形外形的电路板按照拆分出来的小多边形进行拍照,可以将电路板进行全部拍照,消除AOI设备在检测电路板缺陷时存在检测遗漏的隐患。从而解决现有的手动绘制多个小多边形比较耗时,且手动绘制小多边形无法满足视场角的大小,造成AOI设备在检测电路板缺陷时存在检测遗漏的问题。Compared with the prior art, a polygon splitting method, an automatic optical detection device and a storage medium provided by the embodiments of the present application form a preset rectangle matrix by splitting a polygon to be split into a plurality of preset rectangles. The preset rectangular matrix truncates the sides of the polygon to be split into a plurality of line segments; according to the direction of the polygon to be split, each line segment is bound to its corresponding preset rectangle to form several small polygons, and then several of the above Small polygons are merged into a group of small polygons. Therefore, only by determining the outermost area of the polygon to be split, a large polygon to be split can be automatically split into multiple small polygons that accurately meet the requirements of the angle of view, and the polygon splitting speed is fast. The operation is simple, so that the camera of the AOI equipment can take pictures of the circuit boards with irregular polygonal shapes according to the small polygons that are split out, and can take pictures of all the circuit boards, eliminating the hidden danger of omission of detection when the AOI equipment detects circuit board defects. Therefore, the existing manual drawing of multiple small polygons is time-consuming, and the manual drawing of small polygons cannot meet the size of the field of view, resulting in the problem of omission of detection when the AOI device detects circuit board defects.

附图说明Description of drawings

一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplifications do not constitute limitations of the embodiments, and elements with the same reference numerals in the drawings are denoted as similar elements, Unless otherwise stated, the figures in the accompanying drawings do not constitute a scale limitation.

图1是一种不规则形状电路板的示意图;Fig. 1 is a schematic diagram of an irregularly shaped circuit board;

图2是在不规则形状电路板中制作多边形框去作为检测区域的示意图;2 is a schematic diagram of making a polygonal frame as a detection area in an irregular-shaped circuit board;

图3是现有的通过手动方式制作多个多边形框去作为检测区域的示意图;Fig. 3 is the existing schematic diagram of making a plurality of polygon frames as detection area by manual mode;

图4是本申请提供的一种多边形拆分的方法的流程示意图;4 is a schematic flowchart of a method for polygon splitting provided by the present application;

图5是本申请提供的一种多边形拆分的方法中的将待拆分多边形分割成多个预设矩形的流程示意图;5 is a schematic flowchart of dividing a polygon to be divided into a plurality of preset rectangles in a method for dividing a polygon provided by the present application;

图6是本申请提供的一种多边形拆分的方法中的确定待拆分多边形的示意图;6 is a schematic diagram of determining a polygon to be split in a method for polygon splitting provided by the present application;

图7是本申请提供的一种多边形拆分的方法中的确定待拆分多边形的外接矩形的宽度和高度与确定预设矩形的宽度和高度的示意图;7 is a schematic diagram of determining the width and height of a circumscribed rectangle of a polygon to be split and determining the width and height of a preset rectangle in a method for polygon splitting provided by the present application;

图8是本申请提供的一种多边形拆分成的方法中的预设矩形矩阵将待拆分多边形的边截断成多个线段组的示意图;8 is a schematic diagram of truncating the sides of the polygon to be split into multiple line segment groups by a preset rectangular matrix in a method for splitting polygons provided by the present application;

图9是本申请提供的一种多边形拆分的方法中的预设矩形矩阵将待拆分多边形的边截断成多个线段组的另一示意图;9 is another schematic diagram of truncating the sides of the polygon to be split into multiple line segment groups by a preset rectangular matrix in a method for splitting a polygon provided by the present application;

图10是本申请提供的一种多边形拆分的方法中的按照待拆分多边形的方向,将每个线段组与其对应的预设矩形绑定,组成若干个小多边形的示意图;10 is a schematic diagram of binding each line segment group to its corresponding preset rectangle to form several small polygons according to the direction of the polygon to be split in a method for splitting a polygon provided by the present application;

图11是本申请提供的一种多边形拆分的方法中的按照待拆分多边形的方向,将每个线段组与其对应的预设矩形绑定,组成若干个小多边形另一示意图;11 is another schematic diagram of binding each line segment group to its corresponding preset rectangle according to the direction of the polygon to be split in a method for splitting a polygon provided by the present application to form several small polygons;

图12是本申请提供的一种多边形拆分的方法中的将若干个小多边形合并成一组小多边形的示意图;12 is a schematic diagram of merging several small polygons into a group of small polygons in a method for polygon splitting provided by the present application;

图13是本申请提供的一种多边形拆分的方法中的具体流程示意图;Fig. 13 is a specific flow diagram in a method for polygon splitting provided by the present application;

图14是本申请提供的一种多边形拆分的方法在不规则形状电路板中自动拆分成多个小多边形的示意图;14 is a schematic diagram of automatically splitting into a plurality of small polygons in an irregular-shaped circuit board by a method of polygon splitting provided by the present application;

图15是本申请提供的一种自动光学检测设备的结构示意图。FIG. 15 is a schematic structural diagram of an automatic optical inspection device provided by the present application.

具体实施方式Detailed ways

为了便于理解本申请,下面结合附图和具体实施例,对本申请进行更详细的说明。需要说明的是,当元件被表述“固定于”另一个元件,它可以直接在另一个元件上、或者其间可以存在一个或多个居中的元件。当一个元件被表述“连接”另一个元件,它可以是直接连接到另一个元件、或者其间可以存在一个或多个居中的元件。本说明书所使用的术语“上”、“下”、“内”、“外”、“底部”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本申请和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本申请的限制。此外,术语“第一”、“第二”“第三”等仅用于描述目的,而不能理解为指示或暗示相对重要性。In order to facilitate the understanding of the present application, the present application will be described in more detail below with reference to the accompanying drawings and specific embodiments. It should be noted that when an element is referred to as being "fixed to" another element, it can be directly on the other element, or one or more intervening elements may be present therebetween. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or one or more intervening elements may be present therebetween. The terms "upper", "lower", "inner", "outer", "bottom" and other terms used in this specification indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention. The application and simplified description are not intended to indicate or imply that the device or element referred to must have a particular orientation, be constructed and operate in a particular orientation, and therefore should not be construed as limiting the application. Furthermore, the terms "first," "second," "third," etc. are used for descriptive purposes only and should not be construed to indicate or imply relative importance.

除非另有定义,本说明书所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本说明书中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是用于限制本申请。本说明书所使用的术语“和/或”包括一个或多个相关的所列项目的任意的和所有的组合。Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the technical field belonging to this application. The terms used in the specification of the present application in this specification are for the purpose of describing specific embodiments only, and are not intended to limit the present application. As used in this specification, the term "and/or" includes any and all combinations of one or more of the associated listed items.

此外,下面所描述的本申请不同实施例中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。In addition, the technical features involved in the different embodiments of the present application described below can be combined with each other as long as there is no conflict with each other.

在一个实施例中,如图4所示,本申请提供一种多边形拆分的方法,所述方法包括:In one embodiment, as shown in FIG. 4 , the present application provides a method for polygon splitting, the method comprising:

S1、将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵;S1. Divide the polygon to be split into a plurality of preset rectangles to form a preset rectangle matrix;

S2、所述预设矩形矩阵将待拆分多边形的边截断成多条线段;S2, the preset rectangular matrix truncates the edge of the polygon to be split into a plurality of line segments;

S3、按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形;S3. According to the direction of the polygon to be split, bind each line segment to its corresponding preset rectangle to form several small polygons;

S4、将上述若干个小多边形合并成一组小多边形。S4. Combine the above-mentioned several small polygons into a group of small polygons.

在本实施例中,通过将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵,所述预设矩形矩阵将待拆分多边形的边截断成多条线段;按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形,再将上述若干个小多边形合并成一组小多边形。从而只需确定待拆分多边形的最外层区域,就可以自动将一个大的待拆分大多边形自动拆分成多个准确地符合视场角大小要求的小多边形,拆分多边形速度快,操作简单,使得AOI设备的相机可以将不规则多边形外形的电路板按照拆分出来的小多边形进行拍照,可以将电路板进行全部拍照,消除AOI设备在检测电路板缺陷时存在检测遗漏的隐患。从而解决现有的手动绘制多个小多边形比较耗时,且手动绘制小多边形无法满足视场角的大小,造成AOI设备在检测电路板缺陷时存在检测遗漏的问题。In this embodiment, a preset rectangle matrix is formed by dividing the polygon to be split into a plurality of preset rectangles, and the preset rectangular matrix truncates the sides of the polygon to be split into a plurality of line segments; according to the polygon to be split , bind each line segment to its corresponding preset rectangle to form several small polygons, and then combine the above several small polygons into a group of small polygons. Therefore, only by determining the outermost area of the polygon to be split, a large polygon to be split can be automatically split into multiple small polygons that accurately meet the requirements of the angle of view, and the polygon splitting speed is fast. The operation is simple, so that the camera of the AOI equipment can take pictures of the circuit boards with irregular polygonal shapes according to the small polygons that are split out, and can take pictures of all the circuit boards, eliminating the hidden danger of omission of detection when the AOI equipment detects circuit board defects. Therefore, the existing manual drawing of multiple small polygons is time-consuming, and the manual drawing of small polygons cannot meet the size of the field of view, resulting in the problem of omission of detection when the AOI device detects circuit board defects.

在一个实施例中,如图5所示,所述步骤S1中,所述将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵;包括:In one embodiment, as shown in FIG. 5 , in step S1, the polygon to be split is divided into a plurality of preset rectangles to form a preset rectangle matrix; including:

S11、确定待拆分多边形。S11. Determine the polygon to be split.

具体地,如图6所示,为一个待拆分多边形的示意图。该待拆分多边形中为不规则形状的多边形。Specifically, as shown in FIG. 6 , it is a schematic diagram of a polygon to be split. The polygons to be split are irregular-shaped polygons.

S12、确定待拆分多边形的外接矩形的宽度W和高度H,所述外接矩形可以涵盖待拆分多边形。S12. Determine the width W and the height H of the circumscribed rectangle of the polygon to be split, where the circumscribed rectangle may cover the polygon to be split.

具体地,如图7所示,为该待拆分多边形的外接矩形,该外接矩形的宽度为W,高度为H。Specifically, as shown in FIG. 7 , it is the circumscribed rectangle of the polygon to be split, and the width of the circumscribed rectangle is W and the height is H.

S13、确定预设矩形的宽度w_max和高度h_max。S13. Determine the width w_max and height h_max of the preset rectangle.

具体地,如图7所示,所述预设矩形如图7中的虚线框形成的矩形所示。所述预设矩形的大小根据FOV(Field of View,视场角)大小来设置,其中,所述预设矩形的宽度w_max为FOV的宽度,高度h_max为FOV的高度。Specifically, as shown in FIG. 7 , the preset rectangle is as shown in the rectangle formed by the dotted frame in FIG. 7 . The size of the preset rectangle is set according to the size of the FOV (Field of View, field of view), wherein the width w_max of the preset rectangle is the width of the FOV, and the height h_max is the height of the FOV.

S14、根据外接矩形的宽度W和高度H与预设矩形的宽度w_max和高度h_max,将所述外接矩形分割成多个预设矩形,形成预设矩形矩阵。S14. According to the width W and height H of the circumscribed rectangle and the width w_max and height h_max of the preset rectangle, divide the circumscribed rectangle into a plurality of preset rectangles to form a preset rectangle matrix.

具体地,包括:Specifically, including:

S141、确定横向分割的预设矩形个数和纵向分割的预设矩形个数,其中:S141. Determine the number of preset rectangles for horizontal division and the number of preset rectangles for vertical division, wherein:

横向分割的预设矩形个数为w_num:w_num=W/w_maxThe preset number of rectangles for horizontal division is w_num: w_num=W/w_max

纵向分割的预设矩形个数为h_num:h_num=H/h_maxThe preset number of rectangles for vertical division is h_num: h_num=H/h_max

S142、将横向分割的预设矩形和纵向分割的预设矩形构成预设矩形矩阵,确定将外接矩形分割成预设矩形的总个数。S142. A preset rectangle matrix is formed by the preset rectangles divided horizontally and the preset rectangles divided vertically, and the total number of the preset rectangles divided into the circumscribed rectangles is determined.

将外接矩形分割成预设矩形的总个数为T:T=w_num*h_num。The total number of dividing the circumscribed rectangle into preset rectangles is T: T=w_num*h_num.

如图7所示,将所述外接矩形分割成横向4个预设矩形,纵向4个预设矩形,共分割成16个预设矩形,形成4x4预设矩形矩阵。As shown in FIG. 7 , the circumscribing rectangle is divided into 4 preset rectangles in the horizontal direction and 4 preset rectangles in the longitudinal direction, which are divided into 16 preset rectangles in total to form a 4×4 preset rectangle matrix.

在本实施例中,通过将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵,可以使根据预设矩形拆分出来的小多边形准确地符合视场角大小的要求,且不会超出视场角的大小,使得AOI设备的相机可以将不规则多边形外形的电路板按照拆分出来的小多边形进行拍照,可以将电路板进行全部拍照,消除AOI设备在检测电路板缺陷时存在检测遗漏的隐患。In this embodiment, by dividing the polygon to be split into a plurality of preset rectangles to form a preset rectangle matrix, the small polygons split according to the preset rectangles can accurately meet the requirements of the size of the field of view, and do not It will exceed the size of the field of view, so that the camera of the AOI device can take pictures of the circuit board with irregular polygon shape according to the small polygons that are split out, and can take pictures of all the circuit boards, eliminating the existence of AOI equipment when detecting circuit board defects. Detect hidden hazards.

在一个实施例中,所述步骤中S2,所述预设矩形矩阵将待拆分多边形的边截断成多条线段。In one embodiment, in step S2, the preset rectangular matrix truncates the edges of the polygon to be split into a plurality of line segments.

作为示例性,如图7和图8所示,在所述预设矩形矩阵中,第2个预设矩形将待拆分多边形的边截断成2条线段。As an example, as shown in FIG. 7 and FIG. 8 , in the preset rectangle matrix, the second preset rectangle truncates the sides of the polygon to be split into two line segments.

在另一个示例性中,如图7和图9所示,在所述预设矩形矩阵中,第6个预设矩形将待拆分多边形的边截断成2条线段。In another example, as shown in FIG. 7 and FIG. 9 , in the preset rectangle matrix, the sixth preset rectangle truncates the sides of the polygon to be split into two line segments.

在一个实施例中,所述步骤中S3,所述按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形;包括:In one embodiment, in step S3, according to the direction of the polygon to be split, each line segment is bound to its corresponding preset rectangle to form several small polygons; including:

S31、按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定。S31. Bind each line segment to its corresponding preset rectangle according to the direction of the polygon to be split.

具体地,待拆分多边形的方向一般包括顺时针方向和逆时针方向。Specifically, the direction of the polygon to be split generally includes a clockwise direction and a counterclockwise direction.

作为示例性,如图6和图7所示,待拆分多边形的方向为顺时针方向。As an example, as shown in FIG. 6 and FIG. 7 , the direction of the polygon to be split is clockwise.

S32、判断是否存在有与线段交叉的预设矩形,根据判断结果决定是否组成小多边形;包括:S32, determine whether there is a preset rectangle intersecting with the line segment, and determine whether to form a small polygon according to the judgment result; including:

S321、如果存在有与线段交叉的预设矩形,则将该预设矩形的边缘与其交叉的线段组成一个小多边形;S321, if there is a preset rectangle that intersects with the line segment, form a small polygon with the edge of the preset rectangle and the line segment that intersects it;

作为示例性,如图6和图7所示,待拆分多边形的方向为顺时针方向。As an example, as shown in FIG. 6 and FIG. 7 , the direction of the polygon to be split is clockwise.

如图7和图10所示,第2个预设矩形将待拆分多边形的边截断成2条线段,按照待拆分多边形的顺时针方向,该第2个预设矩形与该2条线段存在有交叉,则将该第2个预设矩形的边缘与该2条线段组成一个小多边形,组成的小多边形如图10中的实线图形所示。As shown in Figure 7 and Figure 10, the second preset rectangle truncates the sides of the polygon to be split into two line segments. According to the clockwise direction of the polygon to be split, the second preset rectangle and the two line segments If there is an intersection, the edge of the second preset rectangle and the two line segments form a small polygon, and the formed small polygon is shown as the solid line graph in FIG. 10 .

如图7和图11所示,第6个预设矩形将待拆分多边形的边截断成2条线段,按照待拆分多边形的顺时针方向,该第6个预设矩形与该2条线段存在有交叉,则将该第6个预设矩形的边缘与该2条线段组成一个小多边形,组成的小多边形如图11中的实线图形所示。As shown in Figures 7 and 11, the sixth preset rectangle truncates the sides of the polygon to be split into two line segments, and according to the clockwise direction of the polygon to be split, the sixth preset rectangle and the two line segments If there is an intersection, the edge of the sixth preset rectangle and the two line segments form a small polygon, and the formed small polygon is shown as the solid line graph in Figure 11 .

S322、如果存在有不与线段交叉的预设矩形,则进一步判断该预设矩形是否在该待拆分多边形内部,根据判断结果决定是否组成小多边形,包括:S322, if there is a preset rectangle that does not intersect the line segment, further determine whether the preset rectangle is inside the polygon to be split, and determine whether to form a small polygon according to the judgment result, including:

如果该预设矩形是在该待拆分多边形内部,则该预设矩形本身组成一个小多边形;If the preset rectangle is inside the polygon to be split, the preset rectangle itself constitutes a small polygon;

如果该预设矩形不是在该待拆分多边形内部,则直接丢弃该预设矩形,不再组成小多边形。If the preset rectangle is not inside the polygon to be split, the preset rectangle is directly discarded, and no small polygons are formed.

作为示例性,如图7所示,第10个预设矩形不与待拆分多边形的线段存在有交叉,且该第10个预设矩形位于该待拆分多边形的内部,则将该第10个预设矩形本身组成一个小多边形。As an example, as shown in FIG. 7 , if the 10th preset rectangle does not intersect with the line segment of the polygon to be split, and the 10th preset rectangle is located inside the polygon to be split, then the 10th preset rectangle is located inside the polygon to be split. The preset rectangles themselves form a small polygon.

同样的,第11个预设矩形不与待拆分多边形的线段存在有交叉,且该第11个预设矩形位于该待拆分多边形的内部,则将该第11个预设矩形本身组成一个小多边形。Similarly, if the 11th preset rectangle does not intersect with the line segments of the polygon to be split, and the 11th preset rectangle is located inside the to-be-split polygon, then the 11th preset rectangle itself forms a small polygon.

又如图7所示,第4个预设矩形不与待拆分多边形的线段存在有交叉,但该第4个预设矩形在该待拆分多边形的外部,则将该第4个预设矩形丢弃,不再组成小多边形。同样的,第1个预设矩形也不与待拆分多边形的线段存在有交叉,且该第1个预设矩形在该待拆分多边形的外部,同样也需要将该第1个预设矩形丢弃。Also as shown in FIG. 7 , the fourth preset rectangle does not intersect with the line segment of the polygon to be split, but the fourth preset rectangle is outside the polygon to be split, then the fourth preset rectangle is The rectangles are discarded and no longer form small polygons. Similarly, the first preset rectangle does not intersect with the line segment of the polygon to be split, and the first preset rectangle is outside the polygon to be split, so the first preset rectangle also needs to be throw away.

在本实施例中,通过使用预设矩形矩阵将待拆分多边形的边截断成多条线段,再将每条线段与其对应的预设矩形绑定,按照待拆分多边形的方向,将预设矩形的边缘与其交叉的线段重新组成若干个小多边形,从而可以自动地将一个大的待拆分大多边形拆分成多个准确地符合视场角大小要求的小多边形,拆分多边形速度块,操作简单,解决现有的手动绘制多个小多边形比较耗时,且手动绘制小多边形无法满足视场角的大小,造成AOI设备在检测电路板缺陷时存在检测遗漏的问题。In this embodiment, the sides of the polygon to be split are truncated into multiple line segments by using a preset rectangular matrix, and then each line segment is bound to its corresponding preset rectangle. According to the direction of the polygon to be split, the preset The edge of the rectangle and the line segment it intersects are reconstituted into several small polygons, so that a large large polygon to be split can be automatically split into multiple small polygons that accurately meet the requirements of the angle of view, and the polygon speed blocks can be split. The operation is simple, the existing manual drawing of multiple small polygons is time-consuming, and the manual drawing of small polygons cannot meet the size of the field of view, resulting in the problem of omission of detection when the AOI equipment detects circuit board defects.

在一个实施例中,所述步骤中S4,所述将上述若干个小多边形合并成一组小多边形。In an embodiment, in step S4, the above-mentioned several small polygons are combined into a group of small polygons.

作为示例性,如图12所示,经过上述步骤S1-S3后,将确定的若干个小多边形合并成一组小多边形,如图12中的实线图形所示。As an example, as shown in FIG. 12 , after the above steps S1 - S3 , the determined small polygons are combined into a group of small polygons, as shown by the solid line graph in FIG. 12 .

为了便于理解本申请的以上发明构思,下面结合附图和具体实施例,对本申请的以上发明构思进行更详细的说明。In order to facilitate the understanding of the above inventive concept of the present application, the above inventive concept of the present application will be described in more detail below with reference to the accompanying drawings and specific embodiments.

在一个实施例中,如图13和图14所示,本申请提供一种多边形拆分的方法。In one embodiment, as shown in FIG. 13 and FIG. 14 , the present application provides a method for polygon splitting.

在本实施例中,该待拆分多边形是由不规则的多边形形状的电路板的最外层区域形成的。AOI设备的相机需要对该不规则多边形外形的电路板进行行拍照检测,检测电路板是否存在有缺陷。In this embodiment, the polygon to be split is formed by the outermost area of the circuit board in the shape of an irregular polygon. The camera of the AOI equipment needs to perform line photo inspection on the circuit board with the irregular polygonal shape to detect whether the circuit board is defective.

一种多边形拆分的方法,所述方法包括:A method for splitting a polygon, the method comprising:

S501、确定待拆分多边形。S501. Determine the polygon to be split.

在本实施例中,该待拆分多边形是由不规则的多边形形状的电路板的最外层区域形成的。In this embodiment, the polygon to be split is formed by the outermost area of the circuit board in the shape of an irregular polygon.

S502、确定待拆分多边形的外接矩形的宽度W和高度H,所述外接矩形可以涵盖待拆分多边形。S502. Determine the width W and height H of the circumscribed rectangle of the polygon to be split, where the circumscribed rectangle may cover the polygon to be split.

S503、确定预设矩形的宽度w_max和高度h_max。S503. Determine the width w_max and height h_max of the preset rectangle.

具体地,所述预设矩形的大小根据FOV(Field of View,视场角)大小来设置,其中,所述预设矩形的宽度w_max为FOV的宽度,高度h_max为FOV的高度。Specifically, the size of the preset rectangle is set according to the size of FOV (Field of View, field of view), wherein the width w_max of the preset rectangle is the width of the FOV, and the height h_max is the height of the FOV.

S504、确定横向分割的预设矩形个数和纵向分割的预设矩形个数,其中:S504. Determine the preset number of rectangles for horizontal division and the preset number of rectangles for vertical division, wherein:

横向分割的预设矩形个数为w_num:w_num=W/w_maxThe preset number of rectangles for horizontal division is w_num: w_num=W/w_max

纵向分割的预设矩形个数为h_num:h_num=H/h_maxThe preset number of rectangles for vertical division is h_num: h_num=H/h_max

S505、将横向分割的预设矩形和纵向分割的预设矩形构成预设矩形矩阵,确定将外接矩形分割成预设矩形的总个数。S505. A preset rectangle matrix is formed by the preset rectangles divided horizontally and the preset rectangles divided vertically, and the total number of the preset rectangles divided into the circumscribed rectangles is determined.

将外接矩形分割成预设矩形的总个数为T:T=w_num*h_num。The total number of dividing the circumscribed rectangle into preset rectangles is T: T=w_num*h_num.

S506、所述预设矩形矩阵将待拆分多边形的边截断成多条线段。S506. The preset rectangular matrix truncates the edges of the polygon to be split into a plurality of line segments.

S507、按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定。S507. Bind each line segment to its corresponding preset rectangle according to the direction of the polygon to be split.

S508、判断是否存在有与线段交叉的预设矩形,如果存在有与线段交叉的预设矩形,转入步骤S509;否则转入步骤S510。S508: Determine whether there is a preset rectangle intersecting the line segment, if there is a preset rectangle intersecting the line segment, go to step S509; otherwise, go to step S510.

S509、如果存在有与线段交叉的预设矩形,则将该预设矩形的边缘与其交叉的线段组成一个小多边形;转入步骤S513。S509 , if there is a preset rectangle intersecting with the line segment, form a small polygon with the edge of the preset rectangle and the line segment intersecting it; go to step S513 .

S510、如果存在有不与线段交叉的预设矩形,则进一步判断该预设矩形是否在该待拆分多边形内部,如果该预设矩形是在该待拆分多边形内部,转入步骤S511;否则,转入步骤S512。S510. If there is a preset rectangle that does not intersect the line segment, further determine whether the preset rectangle is inside the polygon to be split, and if the preset rectangle is inside the polygon to be split, go to step S511; otherwise , go to step S512.

S511、如果该预设矩形是在该待拆分多边形内部,则该预设矩形本身组成一个小多边形;转入步骤S513。S511. If the preset rectangle is inside the polygon to be split, the preset rectangle itself constitutes a small polygon; go to step S513.

S512、如果该预设矩形不是在该待拆分多边形内部,则直接丢弃该预设矩形,不再组成小多边形;转入步骤S514。S512. If the preset rectangle is not inside the polygon to be split, the preset rectangle is directly discarded, and no small polygons are formed; go to step S514.

S513、将上述若干个小多边形合并成一组小多边形。S513. Combine the above-mentioned several small polygons into a group of small polygons.

S514、拆分结束。S514, the split ends.

在本实施例中,通过确定由不规则的多边形形状的电路板的最外层区域形成的待拆分多边形,并对该待拆分多边形分割成多个预设矩形,形成预设矩形矩阵,所述预设矩形矩阵将待拆分多边形的边截断成多条线段;按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形,再将上述若干个小多边形合并成一组小多边形,从而只需要确定待拆分多边形的最外层区域,就可以自动地将一个大的待拆分大多边形拆分成多个准确地符合视场角大小要求的小多边形,拆分多边形速度块,操作简单,使得AOI设备的相机可以将不规则多边形外形的电路板按照拆分出来的小多边形进行拍照,可以将电路板进行全部拍照,消除AOI设备在检测电路板缺陷时存在检测遗漏的隐患。从而解决现有的手动绘制多个小多边形比较耗时,且手动绘制小多边形无法满足视场角的大小,造成AOI设备在检测电路板缺陷时存在检测遗漏的问题。In this embodiment, a preset rectangle matrix is formed by determining the polygon to be split formed by the outermost area of the circuit board with the irregular polygon shape, and dividing the polygon to be split into a plurality of preset rectangles, The preset rectangular matrix truncates the sides of the polygon to be split into a plurality of line segments; according to the direction of the polygon to be split, each line segment is bound to its corresponding preset rectangle to form several small polygons, and then the above-mentioned several Combine several small polygons into a group of small polygons, so that only the outermost area of the polygon to be split needs to be determined, and a large large polygon to be split can be automatically split into a plurality of polygons that accurately meet the requirements of the angle of view. Small polygons, split polygon speed blocks, easy to operate, so that the camera of the AOI device can take pictures of the circuit boards with irregular polygon shapes according to the split small polygons, and all the circuit boards can be photographed, eliminating the detection circuit of the AOI device. There is a hidden danger of missing detection when the board is defective. Therefore, the existing manual drawing of multiple small polygons is time-consuming, and the manual drawing of small polygons cannot meet the size of the field of view, resulting in the problem of omission of detection when the AOI device detects circuit board defects.

基于同一构思,在一个实施例中,如图15所示,本申请提供一种自动光学检测设备,所述自动光学检测设备900包括:存储器902、处理器901及存储在所述存储器902中并可在所述处理器901上运行的一个或者多个计算机程序,所述存储器902和所述处理器901通过总线系统903耦合在一起,所述一个或者多个计算机程序被所述处理器901执行时以实现本申请实施例提供的一种多边形拆分的方法的以下步骤:Based on the same concept, in one embodiment, as shown in FIG. 15 , the present application provides an automatic optical inspection device. The automatic optical inspection device 900 includes: a memory 902 , a processor 901 , and an automatic optical inspection device stored in the memory 902 and One or more computer programs executable on the processor 901, the memory 902 and the processor 901 are coupled together through a bus system 903, the one or more computer programs are executed by the processor 901 to realize the following steps of a method for splitting a polygon provided by an embodiment of the present application:

S1、将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵;S1. Divide the polygon to be split into a plurality of preset rectangles to form a preset rectangle matrix;

S2、所述预设矩形矩阵将待拆分多边形的边截断成多条线段;S2, the preset rectangular matrix truncates the edge of the polygon to be split into a plurality of line segments;

S3、按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形;S3. According to the direction of the polygon to be split, bind each line segment to its corresponding preset rectangle to form several small polygons;

S4、将上述若干个小多边形合并成一组小多边形。S4. Combine the above-mentioned several small polygons into a group of small polygons.

上述本申请实施例揭示的方法可以应用于所述处理器901中,或者由所述处理器901实现。所述处理器901可能是一种集成电路芯片,具有信号处理能力。在实现过程中,上述方法的各步骤可以通过所述处理器901中的硬件的集成逻辑电路或软件形式的指令完成。所述处理器901可以是通用处理器、DSP、或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。所述处理器901可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器902,所述处理器901读取存储器902中的信息,结合其硬件完成前述方法的步骤。The methods disclosed in the above embodiments of the present application may be applied to the processor 901 or implemented by the processor 901 . The processor 901 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above-mentioned method can be completed by an integrated logic circuit of hardware in the processor 901 or an instruction in the form of software. The processor 901 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. The processor 901 may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of this application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, and the storage medium is located in the memory 902, and the processor 901 reads the information in the memory 902, and completes the steps of the foregoing method in combination with its hardware.

可以理解,本申请实施例的存储器902可以是易失性存储器或者非易失性存储器,也可以包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(ROM,Read-Only Memory)、可编程只读存储器(PROM,Programmable Read-Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Read-Only Memory)、电可擦除只读存储器(EEPROM,Electrically Erasable Programmable Read-Only Memory)、磁性随机存取存储器(FRAM,Ferromagnetic Random Access Memory)、闪存(Flash Memory)或其他存储器技术、光盘只读存储器(CD-ROM,Compact Disk Read-Only Memory)、数字多功能盘(DVD,Digital VideoDisk)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置;易失性存储器可以是随机存取存储器(RAM,Random Access Memory),通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(SRAM,Static Random Access Memory)、静态随机存取存储器(SSRAM,Synchronous Static Random Access Memory)、动态随机存取存储器(DRAM,Dynamic Random Access Memory)、同步动态随机存取存储器(SDRAM,SynchronousDynamic Random Access Memory)、双倍数据速率同步动态随机存取存储器(DDRSDRAM,Double Data Rate Synchronous Dynamic Random Access Memory)、增强型同步动态随机存取存储器(ESDRAM,Enhanced Synchronous Dynamic Random Access Memory)、同步连接动态随机存取存储器(SLDRAM,SyncLink Dynamic Random Access Memory)、直接内存总线随机存取存储器(DRRAM,Direct Rambus Random Access Memory)。本申请实施例描述的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory 902 in this embodiment of the present application may be a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. Wherein, the non-volatile memory may be a read-only memory (ROM, Read-Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), an erasable programmable read-only memory (EPROM, Erasable Read-Only Memory) Only Memory), Electrically Erasable Programmable Read-Only Memory (EEPROM, Electrically Erasable Programmable Read-Only Memory), Magnetic Random Access Memory (FRAM, Ferromagnetic Random Access Memory), Flash Memory (Flash Memory) or other memory technologies, CD-ROM Read-Only Memory (CD-ROM, Compact Disk Read-Only Memory), Digital Versatile Disk (DVD, Digital VideoDisk) or other optical disk storage, magnetic cartridge, magnetic tape, magnetic disk storage or other magnetic storage device; volatile memory may be random access memory Access memory (RAM, Random Access Memory), by way of example but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM, Static Random Access Memory), Static Random Access Memory (SSRAM, Synchronous Static Random Access Memory), Dynamic Random Access Memory (DRAM, Dynamic Random Access Memory), Synchronous Dynamic Random Access Memory (SDRAM, SynchronousDynamic Random Access Memory), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM, Double Data Rate Synchronous Dynamic Random Access Memory), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM, Enhanced Synchronous Dynamic Random Access Memory), Synchronous Link Dynamic Random Access Memory (SLDRAM, SyncLink Dynamic Random Access Memory), Direct Memory Bus Random Access Memory (DRRAM, Direct Rambus Random Access Memory). The memories described in the embodiments of the present application are intended to include, but not be limited to, these and any other suitable types of memories.

需要说明的是,上述检测设备实施例与方法实施例属于同一构思,其具体实现过程详见方法实施例,且方法实施例中的技术特征在所述检测设备实施例中均对应适用,这里不再赘述。It should be noted that the above-mentioned embodiments of the detection device and the embodiments of the method belong to the same concept, and the specific implementation process is detailed in the embodiments of the method, and the technical features in the embodiments of the method are all applicable in the embodiments of the detection device, which are not used here. Repeat.

另外,在示例性实施例中,本申请实施例还提供一种计算机存储介质,具体为计算机可读存储介质,例如包括存储计算机程序的存储器902,所述计算机存储介质上存储有一种多边形拆分的方法的一个或者多个程序,所述一种多边形拆分的方法的一个或者多个程序被处理器901执行时以实现本申请实施例提供的一种多边形拆分的方法的以下步骤:In addition, in an exemplary embodiment, an embodiment of the present application further provides a computer storage medium, specifically a computer-readable storage medium, for example, including a memory 902 for storing a computer program, and the computer storage medium stores a polygon split One or more programs of the method for splitting a polygon, when the one or more programs of the method for splitting a polygon are executed by the processor 901 to implement the following steps of a method for splitting a polygon provided by the embodiment of the present application:

S1、将待拆分多边形分割成多个预设矩形,形成预设矩形矩阵;S1. Divide the polygon to be split into a plurality of preset rectangles to form a preset rectangle matrix;

S2、所述预设矩形矩阵将待拆分多边形的边截断成多条线段;S2, the preset rectangular matrix truncates the edge of the polygon to be split into a plurality of line segments;

S3、按照待拆分多边形的方向,将每条线段与其对应的预设矩形绑定,组成若干个小多边形;S3. According to the direction of the polygon to be split, bind each line segment to its corresponding preset rectangle to form several small polygons;

S4、将上述若干个小多边形合并成一组小多边形。S4. Combine the above-mentioned several small polygons into a group of small polygons.

需要说明的是,上述计算机可读存储介质上的一种多边形拆分的方法程序实施例与方法实施例属于同一构思,其具体实现过程详见方法实施例,且方法实施例中的技术特征在上述计算机可读存储介质的实施例中均对应适用,这里不再赘述。It should be noted that the program embodiment of a method for splitting polygons on the computer-readable storage medium and the method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are as follows: The above-mentioned embodiments of the computer-readable storage medium are all applicable, and will not be repeated here.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;在本申请的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,步骤可以以任意顺序实现,并存在如上所述的本申请的不同方面的许多其它变化,为了简明,它们没有在细节中提供;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; under the thinking of the present application, the technical features in the above embodiments or different embodiments can also be combined, The steps may be carried out in any order, and there are many other variations of the different aspects of the present application as described above, which are not provided in detail for the sake of brevity; although the present application has been The skilled person should understand that it is still possible to modify the technical solutions recorded in the foregoing embodiments, or to perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the implementation of the application. scope of technical solutions.

Claims (10)

1. A method of polygon splitting, the method comprising:
dividing a polygon to be split into a plurality of preset rectangles to form a preset rectangular matrix;
the preset rectangular matrix cuts the edge of the polygon to be split into a plurality of line segments;
binding each line segment with a corresponding preset rectangle according to the direction of the polygon to be split to form a plurality of small polygons;
and combining the small polygons into a group of small polygons.
2. The method according to claim 1, wherein the polygon to be split is divided into a plurality of preset rectangles, so as to form a preset rectangular matrix; the method comprises the following steps:
determining a polygon to be split;
determining the width and height of a circumscribed rectangle of a polygon to be split;
determining the width and height of a preset rectangle;
and dividing the external rectangle into a plurality of preset rectangles according to the width and the height of the external rectangle and the width and the height of the preset rectangles to form a preset rectangular matrix.
3. The method of claim 2, wherein the width of the preset rectangle is a width of a field angle, and the height of the preset rectangle is a height of the field angle.
4. The method according to claim 2, wherein the circumscribed rectangle is divided into a plurality of preset rectangles according to the width and height of the circumscribed rectangle and the width and height of the preset rectangles to form a preset rectangle matrix; the method comprises the following steps:
determining the number of preset rectangles for transverse division and the number of preset rectangles for longitudinal division;
and forming a preset rectangular matrix by the transversely divided preset rectangle and the longitudinally divided preset rectangle.
5. The method according to claim 1, wherein each line segment is bound with a corresponding preset rectangle according to the direction of the polygon to be split to form a plurality of small polygons; the method comprises the following steps:
binding each line segment with a corresponding preset rectangle according to the direction of the polygon to be split;
and judging whether a preset rectangle crossed with the line segment exists or not, and determining whether a small polygon is formed or not according to a judgment result.
6. The method of claim 5, wherein the determining whether there is a predetermined rectangle crossing the line segments and determining whether to form a small polygon according to the determination result comprises:
and if the preset rectangle intersected with the line segment exists, forming a small polygon by the edge of the preset rectangle and the intersected line segment.
7. The method of claim 5, wherein the determining whether there is a predetermined rectangle crossing the line segments and determining whether to form a small polygon according to the determination result comprises:
and if the preset rectangle which does not intersect with the line segment exists, further judging whether the preset rectangle is in the polygon to be split or not, and determining whether a small polygon is formed or not according to a judgment result.
8. The method of claim 7, wherein the determining whether the predetermined rectangle is inside the polygon to be split and determining whether to form a small polygon according to the determination result comprises:
if the preset rectangle is in the polygon to be split, the preset rectangle forms a small polygon;
and if the preset rectangle is not in the polygon to be split, directly discarding the preset rectangle.
9. An automatic optical inspection apparatus, comprising: memory, processor and computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing the steps of a method of polygon splitting as claimed in any one of claims 1 to 8.
10. A storage medium having stored thereon a program of a method of polygon splitting, which when executed by a processor implements the steps of a method of polygon splitting as claimed in any one of claims 1 to 8.
CN202210153376.0A 2022-02-18 2022-02-18 Method for splitting polygon, automatic optical detection equipment and storage medium Pending CN114638911A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210153376.0A CN114638911A (en) 2022-02-18 2022-02-18 Method for splitting polygon, automatic optical detection equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210153376.0A CN114638911A (en) 2022-02-18 2022-02-18 Method for splitting polygon, automatic optical detection equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114638911A true CN114638911A (en) 2022-06-17

Family

ID=81946266

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210153376.0A Pending CN114638911A (en) 2022-02-18 2022-02-18 Method for splitting polygon, automatic optical detection equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114638911A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07182501A (en) * 1993-12-24 1995-07-21 Casio Comput Co Ltd Image transforming method and apparatus thereof
US5943487A (en) * 1996-07-12 1999-08-24 Intel Corporation Method for extracting a resistor network from an integrated circuit polygon layout
JP2007067339A (en) * 2005-09-02 2007-03-15 Dainippon Screen Mfg Co Ltd Region dividing device, pattern drawing device, region dividing method, and program
CN105606622A (en) * 2016-03-21 2016-05-25 广州视源电子科技股份有限公司 AOI image acquisition method and device
CN110134882A (en) * 2019-03-22 2019-08-16 徐书诚 A kind of realization matrix-scanning electronic map extraction panoramic picture computer system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07182501A (en) * 1993-12-24 1995-07-21 Casio Comput Co Ltd Image transforming method and apparatus thereof
US5943487A (en) * 1996-07-12 1999-08-24 Intel Corporation Method for extracting a resistor network from an integrated circuit polygon layout
JP2007067339A (en) * 2005-09-02 2007-03-15 Dainippon Screen Mfg Co Ltd Region dividing device, pattern drawing device, region dividing method, and program
CN105606622A (en) * 2016-03-21 2016-05-25 广州视源电子科技股份有限公司 AOI image acquisition method and device
CN110134882A (en) * 2019-03-22 2019-08-16 徐书诚 A kind of realization matrix-scanning electronic map extraction panoramic picture computer system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐炜君等: "分区域图像匹配在PCB缺陷光学检测中的应用", 北京信息科技大学学报(自然科学版), vol. 26, no. 02, 15 April 2011 (2011-04-15), pages 1 *

Similar Documents

Publication Publication Date Title
US11308710B2 (en) Polygonal region detection
JP2020525871A (en) Vehicle insurance image processing method, device, server, and system
CN112634286B (en) Image clipping method and device
CN113808131B (en) Method, system, device and medium for identifying connector defects
WO2017045482A1 (en) Parent task progress update method and apparatus
US9046496B2 (en) Capturing method for images with different view-angles and capturing system using the same
US20120008826A1 (en) Method, device and computer program product for detecting objects in digital images
JP2008035173A5 (en)
CN116503382B (en) Method and system for detecting scratch defects of display screen
CN114638911A (en) Method for splitting polygon, automatic optical detection equipment and storage medium
CN114528632A (en) Beam identification method, computer device and readable storage medium
CN114708253A (en) Method and system for visual detection of defects in tablet packaging aluminum foil
CN113886970A (en) Ship body opening design method, device, storage medium and system
CN109785343A (en) Face based on clarity scratches the preferred method and device of figure picture
JP5730616B2 (en) End face inspection method and end face inspection apparatus
CN117115391B (en) Model updating method, device, computer equipment and computer readable storage medium
CN113902742B (en) TFT-LCD detection-based defect true and false judgment method and system
TW202213170A (en) Carton recycling method, electronic device and storage medium
US20230028335A1 (en) Abnormality inspection system, abnormality inspection method and program
CN114022723B (en) A method and device for generating data set for neural network training
CN116309583A (en) Method and system for detecting display screen dent defect
CN114266700A (en) A Fast Scaling Method for Irregular Contours
CN113658096B (en) Plate abnormality detection method and device
WO2021093756A1 (en) Neural network-based target background noise suppression method and device
CN111104707B (en) Method, system and medium for constructing middle and outer scaffold of digital building

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination