Size measurement method and system based on standard size file
Through the dimensional measurement method based on standard size files, the dimensional measurement process of high-precision instruments is automated, solving the problems of operation complexity and labor costs of high-precision instruments, and improving the efficiency of equipment usage and measurement accuracy.
Patent Information
- Application Number
- CN202411435740.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-14
AI Technical Summary
In the measurement of high-precision instruments, the client factory requires a lot of labor costs to train and operate, and the mobility of workers is high, resulting in low efficiency in equipment use and increased the possibility of measurement errors and collisions.
Using the size measurement method based on standard size files, by obtaining the standard size files of the object to be measured, using the reference points of the annotation entity to be measured, the entity in the image of the object to be measured is searched, and automatic labeling error checking and correction are realized, and the filtering of sample labeling dimensions is achieved. Copy and simplify the operation process.
This greatly reduces the time investment of manual measurement data production, reduces user learning and use costs, and improves the equipment's productivity and measurement accuracy.
Smart Images

Figure CN119313641A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of high-precision instrument measurement, and in particular to a dimension measurement method based on a standard dimension file and a system thereof. Background Art
[0002] In the dimension measurement of high-precision instruments, such as the instantaneous full-size measuring instrument dedicated to PCB (printed circuit board), in the scenario of use at the customer factory, manual learning and operation of this type of measuring instrument is often required. However, this requires a lot of manpower costs. For example, on the one hand, not only the factory as the client, but also the company providing the equipment needs to arrange corresponding personnel to train the customer employees; on the other hand, as the factory of the client, its workers are often more mobile. If the trained specialists leave the factory due to job changes, the factory needs other personnel to continue to learn how to use the above-mentioned measuring instruments. Because the above-mentioned measuring instruments (such as high-precision measuring instruments) themselves are highly professional and have high requirements on the quality of operators, for example, not only the operators are required to be familiar with the measuring products (such as high-precision measuring instruments), but also the operators are required to be familiar with the measuring drawings provided by the customers. Although the use of such measuring instruments themselves is not difficult, that is, only the previously prepared data needs to be imported into the corresponding measuring equipment, and then the position range of the measured products is input, and the number of placed products is input, the measurement results of the product can be obtained. However, when it is necessary to produce measurement data for the above-mentioned measuring instrument (measurement data refers to the specific content that needs to be measured on a high-precision instrument (such as measuring its various dimensions)), this operation has higher requirements for the operator of the above-mentioned measuring instrument. For example, the operator needs to be systematically trained to use the measuring instrument correctly, otherwise there will be measurement errors or even the possibility of collision. Therefore, how to simplify the process of the above-mentioned operators learning and using the above-mentioned measuring instrument, reduce the difficulty of use, and at the same time reduce the labor cost of the factory as the client using the measuring instrument is a problem existing in the dimensional measurement of existing high-precision instruments. Summary of the invention
[0003] The main technical problem solved by the present invention is to provide a dimension measurement method and system based on standard dimension files, including original annotation error checking and automatic correction based on mechanical drawing principles, and validity screening and automatic copying of sample annotation dimensions, which greatly simplifies the time spent on manual production of related measurement data, reduces user learning and use costs, and improves the utilization rate of equipment.
[0004] According to the first aspect, an embodiment provides a size measurement method based on a standard size file, comprising:
[0005] Obtain the standard size file corresponding to the object to be measured; wherein the standard size file is obtained based on the drawing file of the object to be measured; the standard size file includes: annotation content, one or more entities, the one or more entities include unannotated entities and annotated entities corresponding to the annotation content; the annotation content is used to indicate the content to be measured for the object to be measured; the annotated entity is used to indicate the entity to be measured in order to obtain the corresponding annotated content; the unannotated entity is used to indicate the entity that does not need to be measured;
[0006] Searching all the entities in the standard size file using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the reference point is determined in the annotated entity based on the annotated content; the image of the object to be measured is obtained by photographing the object to be measured, and the image of the object to be measured includes one or more entities;
[0007] The entity corresponding to the annotation content in the image of the object to be measured is measured to obtain a corresponding measurement result.
[0008] In one embodiment, the step of searching all the entities in the standard size file using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured includes:
[0009] When the corresponding annotation content involves two annotation entities, the reference point of one of the two annotation entities is used as the primary point, and the reference point of the other of the two annotation entities is used as the secondary point to define an initial closest entity; wherein the closest entity is used to represent the entity closest to the annotation entity corresponding to the primary point;
[0010] Traversal step: obtaining the type of each entity in the image of the object to be measured, taking the entities in the image of the object to be measured as current entities one by one, and performing the following operations on each current entity until all the entities in the image of the object to be measured are traversed to determine the entity to be measured corresponding to the main point:
[0011] If the type of the current entity is a circle, calculate the distance between the center of the current entity and the main point; wherein, if the distance between the center of the circle and the main point is 0 or the radius of the current entity, update the closest entity to the current entity;
[0012] If the type of the current entity is an arc, calculate the distance between the center of the circle corresponding to the current entity and the main point; wherein, if the distance between the corresponding center of the circle and the main point is 0 or is the radius corresponding to the current entity, update the closest entity to the current entity;
[0013] If the type of the current entity is a straight line, determine whether the main point is on the current entity; if the main point is on the current entity, update the closest entity to the current entity, and add the current entity to a predefined straight line list;
[0014] The traversal step is performed again: the coordinates of the main point and the coordinates of the secondary point are exchanged, and the traversal step is performed using the new coordinates of the main point to determine the entity to be measured corresponding to the new main point;
[0015] The entity to be measured obtained before the coordinates are exchanged and the entity to be measured obtained after the coordinates are exchanged are used as the entity to be measured corresponding to the annotation content in the image of the object to be measured.
[0016] In one embodiment, the step of searching all the entities in the standard size file using the reference points of the annotated entities to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured further includes:
[0017] When the corresponding annotation content involves only one annotation entity, the reference point of the annotation entity is used as the main point to define the initial closest entity, and after performing the traversal step using the main point, the number of the straight lines in the straight line list is obtained;
[0018] Wherein, if the number of the straight lines in the straight line list is 0, then the latest closest entity is the entity to be measured corresponding to the annotated content;
[0019] If the number of the straight lines in the straight line list is 1, then the latest closest entity is the entity to be measured corresponding to the marked content;
[0020] If the number of the straight lines in the straight line list is equal to 2, determining whether the main point and the secondary point are both on each of the current entities in the straight line list;
[0021] Among them, if the main point and the secondary point are both on one of the current entities in the straight line list, the current entities corresponding to the main point and the secondary point are removed, and the remaining other current entity is used as the entity to be measured in the image of the object to be measured corresponding to the annotation content.
[0022] In one embodiment, the step of obtaining the standard size file corresponding to the object to be measured includes:
[0023] Determine a manually annotated area and an automatically annotated area in the drawing file; wherein the manually annotated area refers to an area that is pre-annotated on the drawing file, and the automatically annotated area refers to an area in the drawing file that is completely or partially the same as the manually annotated area except the manually annotated area;
[0024] Annotating the manually annotated area to obtain the corresponding annotated content;
[0025] The step of generating the annotation content of the automatic annotation area: using the corresponding annotation content in the manual annotation area to annotate the automatic annotation area to obtain the annotation content corresponding to the automatic annotation area;
[0026] Acquire the annotated entity and the unannotated entity corresponding to the annotated content; wherein the data format of the standard size file is DXF / DWG / ODB++ / IPC2581.
[0027] In one embodiment, the step of using the corresponding annotation content in the manually annotated area to annotate the automatically annotated area to obtain the annotation content corresponding to the automatically annotated area includes:
[0028] Using the corresponding annotated content in the manually annotated area as content to be copied;
[0029] Traversing all the annotated entities corresponding to the content to be copied, putting the entities corresponding to each annotated entity in the content to be copied into a temporary list, taking out one entity from the temporary list in turn as the selected first entity, and performing the following operations using each selected first entity until all the entities in the temporary list are traversed:
[0030] Acquire a preset search direction and a limit value corresponding to the search direction, search the automatic annotation area within the range of the limit value in the search direction to obtain all the entities in the automatic annotation area that are identical to the selected first entity; store all the entities that are identical to the selected first entity in an alignment list corresponding to the selected first entity;
[0031] Perform the following operations on each of the entities in the alignment list corresponding to the selected first entity:
[0032] Taking out one of the entities from the alignment list, naming the entity as entityfirst, and calculating the distance between the corresponding selected first entity and the current entityfirst;
[0033] Searching out entities in the temporary list except the selected first entity;
[0034] Traversing the search direction, putting entities in the alignment list that are identical to the currently selected first entity into the list, and determining whether the distance between each entity in the list and the currently selected first entity is the same as the distance; if the distance between the entity in the list and the currently selected first entity is the same as the distance, then the entity in the list is the annotated entity to be copied;
[0035] The annotation entity to be copied is used to generate a corresponding annotation entity in the automatic annotation area, and the annotation content corresponding to the annotation entity to be copied is copied to the automatic annotation area.
[0036] In one embodiment, the step of annotating the automatic annotated area by using the corresponding annotation content in the manual annotated area to obtain the annotation content corresponding to the automatic annotated area further includes:
[0037] When the automatic annotation area is obtained by rotating the manually annotated area by a preset angle, the annotation entity corresponding to the annotation content of the manually annotated area is rotated by the preset angle around the center of the annotation entity, and the rotated annotation entity is then processed according to the steps of generating the annotation content of the automatic annotation area, so as to annotate the automatic annotation area and obtain the annotation content corresponding to the automatic annotation area.
[0038] In one embodiment, the measuring the entity in the object to be measured corresponding to the annotated content according to the entity to be measured in the image of the object to be measured corresponding to the annotated content to obtain a corresponding measurement result includes:
[0039] Processing the image of the object to be measured to obtain the minimum bounding rectangle of the image of the object to be measured, taking the minimum bounding rectangle of the image of the object to be measured as the current plate, and obtaining the coordinates of the rotation center of the current plate and the angle between the long axis direction of the current plate and the horizontal direction; calculating and obtaining the minimum bounding rectangle of all the entities in the standard size file, taking the minimum bounding rectangle of all the entities in the standard size file as a template, and obtaining the coordinates of the rotation center of the template and the angle between the long axis direction of the template and the horizontal direction;
[0040] Generate a rotation and translation matrix corresponding to the current plate and the template; wherein the rotation and translation matrix is used to use the rotation center of the template as the rotation center of the current plate, and use the angle between the long axis direction of the template and the horizontal direction as the angle between the long axis direction of the current plate and the horizontal direction;
[0041] The world coordinates saved in the standard size file are converted into pixel coordinates, and the pixel coordinates are converted through the rotation and translation matrix to obtain the pixel coordinates of the image of the object to be measured; the entity corresponding to the annotated content is measured according to the pixel coordinates of the entity corresponding to the annotated content in the image of the object to be measured to obtain a corresponding measurement result.
[0042] In one embodiment, the step of processing the image of the object to be measured to obtain a minimum bounding rectangle of the image of the object to be measured includes:
[0043] A point set of all the entities in the image of the object to be measured is obtained; the point set is traversed to obtain the upper left point and the lower right point in the point set, and then the rotation center of the current plate is obtained according to the upper left point and the lower right point, and the upper left point and the lower right point are respectively used as two vertices on the same diagonal line on the current plate.
[0044] According to a first aspect, an embodiment provides a size measurement system based on a standard size file, comprising:
[0045] A preprocessing module is configured to obtain the standard size file corresponding to the object to be measured; wherein the standard size file is obtained based on the drawing file of the object to be measured, and the standard size file includes one or more entities, and the standard size file includes: annotated content, annotated entities corresponding to the annotated content, and unannotated entities; the annotated content is used to indicate the content to be measured for the object to be measured;
[0046] The annotated entity is used to represent the entity that needs to be measured to obtain the corresponding annotated content; the unannotated entity is used to represent the entity that does not need to be measured; the type of the entity includes: a straight line, a circle or an arc;
[0047] A camera module is configured to photograph the object to be measured to obtain an image of the object to be measured, wherein the image of the object to be measured includes one or more entities;
[0048] A conversion module is configured to search all the entities in the image of the object to be measured using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the reference point is determined in the annotated entity based on the annotated content; and the standard size file further includes: coordinates of the reference point;
[0049] The measuring module is configured to measure the entity in the object to be measured corresponding to the annotated content according to the entity to be measured in the image of the object to be measured corresponding to the annotated content, so as to obtain a corresponding measurement result.
[0050] According to a third aspect, an embodiment provides a computer-readable storage medium, wherein the computer-readable storage medium includes a program, wherein the program can be executed by a processor to implement a method as described in any embodiment of the present invention.
[0051] The beneficial effects of this application are:
[0052] The present application provides a dimension measurement method based on a standard dimension file and a system thereof, the method comprising: obtaining a standard dimension file corresponding to an object to be measured; wherein the standard dimension file is obtained based on a drawing file of the object to be measured, the standard dimension file comprises one or more entities, and the standard dimension file comprises: annotated content, annotated entities corresponding to the annotated content, and unannotated entities; searching all entities in the image of the object to be measured using reference points of the annotated entities to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the image of the object to be measured is obtained by photographing the object to be measured, and the image of the object to be measured comprises one or more entities; measuring the entity corresponding to the annotated content in the object to be measured according to the entity to be measured corresponding to the annotated content in the image of the object to be measured, to obtain a corresponding measurement result. The system can implement the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A schematic diagram of a flow chart of a dimension measurement method based on a standard dimension file according to an embodiment;
[0054] Figure 2 A schematic diagram of a drawing file of an object to be measured according to an embodiment;
[0055] Figure 3 A schematic diagram of a process of obtaining a standard size file corresponding to an object to be measured according to an embodiment;
[0056] Figure 4 A schematic diagram of a process of annotating an automatic annotated area to obtain annotated content corresponding to the automatic annotated area according to an embodiment;
[0057] Figure 5 A schematic diagram of the marking content of an embodiment;
[0058] Figure 6 A flowchart of determining an entity to be measured corresponding to the annotation content in an image of an object to be measured according to an embodiment;
[0059] Figure 7 A schematic diagram of the main points and the secondary points of an embodiment;
[0060] Figure 8 A schematic diagram of a flow chart of obtaining corresponding measurement results according to an embodiment;
[0061] Fig. 9 A schematic diagram of a module of a dimension measurement system based on a standard dimension file according to an embodiment;
[0062] Fig.10 A schematic diagram of a manually labeled area and an automatically labeled area in an embodiment. DETAILED DESCRIPTION
[0063] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0064] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0065] The serial numbers of the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0066] The technical solution of the present application will be described in detail below in conjunction with embodiments.
[0067] Please refer to Figure 1 , the present application provides a dimension measurement method based on a standard dimension file, comprising:
[0068] Step S100: obtaining a standard size file corresponding to the object to be measured; wherein the standard size file is obtained based on the drawing file of the object to be measured, and the standard size file includes one or more entities, and the standard size file includes: annotated content, annotated entities corresponding to the annotated content, and unannotated entities; the annotated content is used to indicate the content to be measured for the object to be measured; the annotated entity is used to indicate the entity to be measured in order to obtain the corresponding annotated content; the unannotated entity is used to indicate the entity that does not need to be measured; the type of entity includes: a straight line, a circle, or an arc;
[0069] Step S200: searching all entities in the standard size file using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the reference point is determined in the annotated entity based on the annotated content; the image of the object to be measured is obtained by photographing the object to be measured, and the image of the object to be measured includes one or more entities; the standard size file also includes: the coordinates of the reference point;
[0070] Step S300: measuring the entity in the object to be measured corresponding to the annotated content according to the entity in the image of the object to be measured corresponding to the annotated content, so as to obtain a corresponding measurement result.
[0071] In some embodiments, in the above step S100, the data format of the standard size file is DXF or DWG. It is understandable that the present application does not specifically limit the data format of the above standard size file, that is, as long as the various functions of the standard size file in the present application can be realized. Among them, DXF is an open vector data format and an AutoCAD drawing exchange file. It was launched by Autodesk in 1982. The DXF format file enables AutoCAD's 2D and 3D graphic data to be used interchangeably with other programs. DWG (i.e. dwg) is a proprietary file format used by computer-aided design software AutoCAD and software based on AutoCAD to save design data. The dimension measurement method of the present application supports importing from a variety of commonly used electronic CAD formats such as DXF / DWG / ODB++ / IPC2581, and uses DXF as a universal file storage format for data exchange. ODB++ file is an XML-based open database format used to describe various data in the manufacturing process of wiring harnesses and PCBs. Since the original sample dimension annotations (such as the above-mentioned annotation content) are manually edited, it is almost impossible to completely avoid the situation where the annotation points (such as the above-mentioned annotation entities) are inaccurately selected (such as the starting point of the center distance of the circle does not coincide with the center of the circle, the point on the straight line deviates from the straight line, and the distance annotation line of the parallel line spacing is not perpendicular to the parallel lines). Therefore, the dimension measurement method of the present application can first perform annotation accuracy detection before realizing annotation traversal and copying, prompt possible errors and perform automatic repairs.
[0072] In some embodiments, in the above step S100, the object to be measured may include a metal workpiece, a high-precision instrument (such as a PCB board), etc. Among them, the instantaneous full-size measuring instrument dedicated to PCB is the name of a measuring instrument used to specifically measure the size information, form and position tolerance information, etc. related to the PCB, such as measuring the width, length, diameter of the through hole (hollow circle on the board), position, width of the gold finger, etc. of the PCB.
[0073] In some embodiments, in the above step S100, the object to be measured may also be other instruments, and no specific limitation is imposed on the above object to be measured.
[0074] In some embodiments, in the above step S100, the image of the object to be measured includes one or more entities. The types of entities may include: straight line, circle or arc. Those skilled in the art may also expand the types of entities here according to actual needs, that is, not limited to the above types.
[0075] In some embodiments, in the above step S100, the standard size file includes: annotation content for indicating that the image of the object to be measured needs to be measured, and annotation entities corresponding to the annotation content. The annotation entity is used to indicate the entity to be measured to obtain the corresponding annotation content. The unannotated entity is used to indicate the entity that does not need to be measured. The object to be measured or the image of the object to be measured is composed of the annotation entity and the unannotated entity. For example, please refer to Figure 2 , Figure 2 It represents the drawing file of the object to be measured. For example, the object to be measured is the above-mentioned PCB (printed circuit board). The marked content "211.30±0.05" represents the distance between the center of circle 1 and the center of circle 2, and circle 1 and circle 2 are both marked entities; the unmarked entities are other entities on the PCB that do not need to be measured this time (such as entities other than circle 1 and circle 2).
[0076] In some embodiments, one standard size file corresponds to only one object to be measured.
[0077] In some embodiments, the standard size file may further include: coordinates of a text display point corresponding to the annotated content. The text display point refers to the coordinates of a specific measurement result (such as a number) displayed next to the annotated content. Those skilled in the art may also expand the specific content of the standard size file according to actual needs. The specific content of the standard size file is not limited here.
[0078] It should be noted that when the user uses the high-precision instrument dimension measurement method proposed in this application, it is necessary to use AutoCAD software or other similar software in advance to produce a file drawing (i.e., the above-mentioned drawing file) that meets the specifications of the object to be measured. The file drawing includes units, circles, lines, arcs, etc. Such entities need to use corresponding entities to draw. For example, if a circle is composed of multiple arcs, it often takes more time to correct the defects of the circle composed of multiple arcs. That is, the entity existing in the file drawing needs to use the corresponding and correct entity. For example, if the entity is a circle, the circle is directly used as the entity instead of using two semi-arcs to form a circle. In the factory as the client, since the changes in the technical personnel of the engineering department are often less than those of the production line employees, and the technical personnel of the engineering department are proficient in the skills of making CAD drawings, the drawing file of the object to be measured (such as the above-mentioned PCB) can be produced by the technical personnel of the engineering department.
[0079] Please note that, please refer to Figure 2For the drawing file of the object to be measured (such as the above-mentioned PCB) and the physical object corresponding to the drawing file, the above-mentioned drawing file or physical object is often composed of multiple sub-boards to form a large board (such as a PCB board). Among them, the other multiple sub-boards (or areas) can be obtained by rotating or mirroring on the basis of one sub-board (or area). Therefore, for the object to be measured that needs to be measured, the technicians in this field can automatically copy and generate the annotation content of the remaining areas (that is, the automatic annotation area described below) based on the same area (that is, the manual annotation area described below), thereby improving the annotation of the drawing file of the object to be measured (such as the above-mentioned PCB).
[0080] Therefore, in some embodiments, please refer to Figure 3 Step S100: Obtaining a standard size file corresponding to the object to be measured, including:
[0081] Step S110: determining a manually annotated area and an automatically annotated area in the drawing file; wherein the manually annotated area refers to an area that is pre-annotated in the drawing file, and the automatically annotated area refers to an area in the drawing file that is completely or partially the same as the manually annotated area.
[0082] Step S120: annotating the manually annotated area to obtain corresponding annotated content;
[0083] Step S130: using the corresponding annotation content in the manual annotation area to annotate the automatic annotation area to obtain annotation content corresponding to the automatic annotation area;
[0084] Step S140: Acquire annotated entities and unannotated entities corresponding to the annotated content.
[0085] In some embodiments, in the above step S110, those skilled in the art can determine the manually marked area and the automatically marked area in the drawing file by themselves. The drawing file is usually an electronic document.
[0086] It should be noted that the determination of the manually marked areas and the automatically marked areas in the above-mentioned drawing files belongs to common knowledge in the art, so it will not be elaborated here.
[0087] In some embodiments, in the above step S120, the annotation function in AutoCAD, namely, the DIM command, can be used to annotate the entities to be measured in the manual annotation area to obtain the corresponding annotation content. Figure 2When the object to be measured is the above-mentioned PCB, the annotation content can be the distance between the centers of two circles (such as the above-mentioned circle 1 and circle 2) in the manual annotation area. In addition, the distance obtained by the measurement can be annotated according to the tolerance standard provided by the user, and the tolerance can be set. For another example, you can use the annotation tools in the CAD software, such as alignment annotation, and then click the mouse once on the two circles to be measured to get a corresponding annotation content (such as the distance between the centers of the two circles).
[0088] It should be noted that “marking the entities to be measured in the manually marked area to obtain corresponding marked content” is common knowledge in the art, so it will not be elaborated here.
[0089] In some embodiments, in the above step S140, after the corresponding annotation content (such as the annotation content of the manually annotated area or the annotation content of the automatically annotated area) has been determined, the annotation entity corresponding to the annotation content (such as the coordinates of the annotation entity, etc.) is also determined. Those skilled in the art can obtain the unannotated entity and / or the annotation entity corresponding to the annotation content according to actual needs. For example, please refer to Figure 2 When the annotation content is the distance between the centers of two circles (such as circle 1 and circle 2 mentioned above) in the manual annotation area, the annotation entity corresponding to the annotation content is the two circles (i.e. circle 1 and circle 2) in the manual annotation area.
[0090] It should be noted that the above-mentioned acquisition of unlabeled entities and / or labeled entities corresponding to labeled contents is common knowledge in the art, and thus will not be described in detail.
[0091] It should be noted that, for an object to be measured, after all the annotation contents to be measured are set, AutoCAD can be used to make the above annotation contents and annotation entities into a standard size file corresponding to the object to be measured.
[0092] For some examples, please refer to Figure 4 Step S130: using the corresponding annotation content in the manual annotation area to annotate the automatic annotation area to obtain the annotation content corresponding to the automatic annotation area, including:
[0093] Step S131: taking the corresponding annotated content in the manually annotated area as the content to be copied;
[0094] Step S132: traverse all the annotated entities corresponding to the content to be copied, put the entities corresponding to each annotated entity in the content to be copied into a temporary list temp_all_et_list, take out one entity from the temporary list temp_all_et_list in turn as the selected first entity select_first_entity, and use each selected first entity select_first_entity to perform the following operations until all the entities in the temporary list temp_all_et_list are traversed:
[0095] Obtain a preset search direction and a limit value limitvalue corresponding to the search direction, search the automatic annotation area within the range of the limit value limitvalue in the search direction to obtain all entities in the automatic annotation area that are identical to the selected first entity select_first_entity; store all entities that are identical to the selected first entity select_first_entity in an alignment list align_list corresponding to the selected first entity;
[0096] Step S133: performing the following operations on each entity in the alignment list align_list corresponding to the selected first entity:
[0097] Take an entity from the alignment list align_list, name the entity entityfirst, and calculate the distance distance1 between the corresponding selected first entity select_first_entity and the current entityfirst;
[0098] Step S134: searching for entities in the temporary list temp_all_et_list except the selected first entity select_first_entity;
[0099] Step S135: putting the entities in the alignment list align_list that are the same as the currently selected first entity select_first_entity into the list align_list_temp, and judging whether the distance between each entity in the list align_list_temp and the currently selected first entity select_first_entity is the same as the distance distance1; if the distance between the entity in the list align_list_temp and the currently selected first entity select_first_entity is the same as the distance distance1, then the entity in the list align_list_temp is the annotated entity to be copied;
[0100] Step S136: Generate a corresponding annotation entity in the automatic annotation area using the annotation entity to be copied, and copy the annotation content corresponding to the annotation entity to be copied to the automatic annotation area.
[0101] In some embodiments, in the above step S132, when traversing each annotated entity in the content to be copied, it can be determined whether the position of the entity in the area of the image of the object to be measured other than the manually annotated area exceeds the limit value limitvalue corresponding to the preset search direction.
[0102] Among them, if the position of the entity does not exceed the limit value limitvalue but the entity identical to the selected first entity select_first_entity is still not matched after traversing all entities, it means that there is no entity identical to the selected first entity select_first_entity in the search direction, then the first entity select_first_entity is skipped, and the search for the entity identical to the new selected first entity select_first_entity in the pre-set search direction continues. For example, if select_first_entity is a circle, the entity found is the same entity as select_first_entity only if its radius is the same as select_first_entity and its center's ordinate is the same as select_first_entity. Similarly, if select_first_entity is a line segment, the entity found is the same entity as select_first_entity only if its start and end points have the same ordinates as select_first_entity and its length has the same length as select_first_entity. Similarly, if select_first_entity is an arc, the entity found is the same entity as select_first_entity only if its radius and arc's ordinate are the same as select_first_entity. For example, refer to Fig.10, assuming that numbers 1 to 9 in the figure represent corresponding entities, the square where number 1 is located is the manually marked area, and the squares where numbers 2 to 9 are located are the automatically marked areas; among them, the entity numbered 1 is located in the upper left corner of the figure (i.e., the upper left corner of the content to be copied). If it can be searched along the X direction (i.e., the horizontal direction of the figure), entities numbered 2, 3, 5, 6, 8 and 9 can be searched. This is because the range of coordinates that can be searched in the X direction is limited (i.e., the above-mentioned limit value corresponding to the pre-set search direction), and only X coordinates greater than number 1 are required to be searched; and if the search is performed along the Y direction (i.e., the vertical direction of the figure), entities numbered 4, 5, 6, 7, 8 and 9 can be searched. This is because the range of coordinates that can be searched in the Y direction is limited, and only Y coordinates greater than number 1 are required to be searched. In other words, for the manually marked area in the standard size file (such as Fig.10 Only two search directions (positive X direction and negative Y direction) are needed to ensure that all entities in the automatically labeled area that are identical to the entities in the manually labeled area are searched.
[0103] In some embodiments, in step S136, a corresponding annotation entity can be generated in the automatic annotation area using the annotation entity to be copied, and the annotation content (such as tolerance value, etc.) corresponding to the annotation entity to be copied can be copied to the corresponding annotation entity to be copied in the automatic annotation area.
[0104] In some embodiments, step S130: using the corresponding annotation content in the manual annotation area to annotate the automatic annotation area to obtain annotation content corresponding to the automatic annotation area, further includes:
[0105] Step S137: When the automatic annotation area is obtained by rotating the manually annotated area by a preset angle (such as 90 degrees, 180 degrees, 270 degrees, etc.), the annotation entity corresponding to the annotation content of the manually annotated area is rotated 180 degrees around the center of the annotation entity, and the rotated annotation entity is then processed according to the above step S130 to annotate the automatic annotation area and obtain the annotation content corresponding to the automatic annotation area.
[0106] It should be noted that the above step S137 is used to process: the automatically marked area obtained by mirroring or rotating the manually marked area.
[0107] In some embodiments, the reference point is determined in the annotation entity based on the annotation content; the image of the object to be measured is obtained by photographing the object to be measured, and the image of the object to be measured includes one or more entities; the standard size file also includes: the coordinates of the reference point.
[0108] In some embodiments, after obtaining a clear image of the object to be measured, the standard size file corresponding to the object to be measured obtained in the above step S100 can be imported into the control system of a related measuring instrument (such as the above-mentioned PCB-specific instantaneous full-size measuring instrument).
[0109] It should be noted that the purpose of "importing the standard dimension file corresponding to the object to be measured obtained in the above step S100 into the relevant measuring instrument" is to conveniently and quickly input the relevant measurement data of the object to be measured (i.e., the standard dimension file) into the relevant measuring instrument, and then measure the object to be measured by the relevant measuring instrument to obtain the corresponding measurement result. This is because the above standard dimension file has indicated which specific contents of the object to be measured need to be measured (i.e., the above marked contents and marked entities). When the above standard dimension file is imported into the relevant measuring instrument, the relevant measuring instrument automatically obtains which specific contents of the object to be measured need to be measured.
[0110] It should be noted that the measurement data (i.e., standard dimension file) refers to the specific contents that need to be measured when measuring the object to be measured (such as a PCB board). For example, the specific contents may include: the width and length of the object to be measured need to be measured, so the above measurement data needs to be sent to the relevant measuring instrument in advance through the software on the relevant measuring instrument, that is, let the relevant measuring instrument measure the corresponding entity on the object to be measured and determine the standard value and tolerance. After that, the relevant measuring instrument determines whether the object to be measured corresponding to the standard dimension file meets the corresponding requirements.
[0111] In some embodiments, in the above step S200, a related measuring instrument can be used to photograph the object to be measured to obtain an image of the object to be measured. For example, when the object to be measured is the above-mentioned PCB, the instantaneous inspection full-size measuring instrument dedicated to the PCB can use a line scan camera to photograph the physical object of the above-mentioned PCB to obtain a large image of full-format size (i.e., the image of the object to be measured), and the image of the object to be measured is an image that can reach the level of tens of billions of pixels, and the specific pixel size of the largest format image photographed by an instantaneous inspection full-size measuring instrument can be 18548335040. In this type of image, a physical board of a standard size file is placed, and a measuring instrument (such as the above-mentioned line scan camera) is used to take a picture. After the shooting is completed, it is confirmed that the image of the object to be measured is accurately focused and the details are clear. Those skilled in the art can also select a suitable instrument to photograph the object to be measured according to actual needs to obtain the image of the object to be measured. For example, a planar array camera can be used to move at different positions to take pictures and manually find positioning points.
[0112] It should be noted that the reason for performing the above step S200 is that after the above standard size file is obtained, all entities in the above standard size file can be obtained, but the measurement of the object to be measured does not actually require the measurement of all entities in the above standard size file, but only requires the measurement of the marked entities (i.e., the above marked entities). For example, since the standard size file regards lines, circles, arcs, etc. as an entity, and for an object to be measured (such as a PCB), not all entities (such as straight lines, etc.) of the object to be measured need to be measured, therefore, it is necessary to screen all entities in the object to be measured that correspond to the standard size file, and then only process the marked entities (such as marked circles, lines, arcs, etc.), so that all entities will not be measured and waste time and memory resources.
[0113] It should be noted that the purpose of performing the above step S200 is to convert the above annotation entity into the content that the relevant measuring instrument actually needs to measure. This is because the annotation content and annotation entity in the above standard size file do not save more detailed information about the annotation content. For example, the above annotation content used to represent the "distance between the centers of two circles in the manual annotation area" does not record which two circles are related to the distance between the centers. That is, the annotation content only saves two annotation entities (i.e., two circles) and the coordinates of the reference points of the above two annotation entities (i.e., the centers of the above two circles). Therefore, it is necessary to search for the reference points of the above two annotation entities in the image of the object to be measured, and then find the corresponding annotation entity (i.e., the above two circles).
[0114] In some embodiments, the annotation entity saves the coordinates of the reference point and the coordinates of the text display point in the standard dimension file, but does not save the specific entity information referenced. For example, the specific entity information may refer to the "two circles" referenced by the annotation entity. This is because it is not known which "two circles" the annotation content corresponds to just by looking at the annotation content. Therefore, it is necessary to use the reference point to search, traverse all entities in the image of the object to be measured, and determine which "two circles" in the image of the object to be measured are the referenced "two circles" through the above step S200. For different annotation contents, please refer to Figure 5 , aligned dimensions and linear dimensions (such as Figure 5As shown, alignment annotation refers to the annotation content "11.1724" corresponding to reference point A and reference point C, and corner annotation refers to the annotation content "9.9912" corresponding to reference point A and reference point B) both require two reference points, while radius annotation and diameter annotation only require one reference point. The core idea of the algorithm used to search for the corresponding entity in the image of the object to be measured by the reference point (i.e., the above-mentioned step S200) is as follows: traverse all entities in the image of the object to be measured, find the entity closest to the reference point (i.e., the closest entity closeentity below), and continuously update the closeentity until the most correct entity is found. It is understandable that the basic principle of step S200 is: suppose you need to find a dollar from a pile of banknotes, but you don't know what a dollar looks like, and you only know that the face value of "a dollar" is 1. Therefore, this algorithm starts to search from a pile of banknotes. The first banknote found is 100, so this algorithm records this banknote. The next time it finds a banknote with a face value of 50, the face value is smaller than 100, and 50 is closer to 1 than 100, so the target to be found is updated to this banknote with a face value of 50, and the search continues until the pile of banknotes is searched through, so that the required one-dollar banknote can be found. Among them, the above-mentioned "most correct entity" is that the distance between points is 0. If a point is known, and you want to find a circle with the center at this point, you can find it after traversing all existing circles.
[0115] It should be noted that aligned and linear dimensions are composed of two entities, while radial and diameter dimensions are composed of only one entity.
[0116] For some examples, please refer to Figure 6 Step S200: Searching all entities in the standard size file using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured, including:
[0117] Step S210: when the corresponding annotation content involves two annotation entities, the reference point of one of the two annotation entities is used as the main point main, and the reference point of the other annotation entity of the two annotation entities is used as the secondary point p2, and an initial closest entity closeentity is defined; wherein the closest entity closeentity is used to represent the entity closest to the annotation entity corresponding to the main point main;
[0118] Step S211 of traversal: obtaining the type of each entity in the image of the object to be measured, taking the entities in the image of the object to be measured as the current entity one by one, and performing the following operations on each current entity until all entities in the image of the object to be measured are traversed to determine the entity to be measured corresponding to the main point main:
[0119] If the type of the current entity is a circle, calculate the distance between the center of the current entity and the main point mainp; if the distance between the center of the circle and the main point mainp is 0 or the radius of the current entity, update the closest entity closeentity to the current entity;
[0120] If the type of the current entity is an arc, calculate the distance between the center of the circle corresponding to the current entity and the main point mainp; if the distance between the corresponding center of the circle and the main point mainp is 0 or the radius corresponding to the current entity, update the closest entity closeentity to the current entity;
[0121] If the type of the current entity is a line, determine whether the main point mainp is on the current entity; if the main point mainp is on the current entity, update the closest entity closeentity to the current entity, and add the current entity to the predefined line list linelist;
[0122] Execute the traversal step S212 again: swap the coordinates of the main point mainp and the coordinates of the secondary point p2, and execute the traversal step S211 using the coordinates of the new main point mainp to determine the entity to be measured corresponding to the new main point mainp;
[0123] The entity to be measured obtained before the coordinates are interchanged and the entity to be measured obtained after the coordinates are interchanged are taken as the entity to be measured corresponding to the annotation content in the image of the object to be measured.
[0124] In some embodiments, in the above step S210, the annotation content involving the two annotation entities may be the aforementioned alignment annotation or linear annotation, etc. For example, when the annotation content is the aforementioned alignment annotation, the two annotation entities involved in the alignment annotation may be vertex A and vertex C, and the reference point of one of the two annotation entities (i.e., vertex A itself) is used as the main point main, and the reference point of the other of the two annotation entities (i.e., vertex C itself) is used as the secondary point p2. Among them, the initial closest entity closeentity may be defined as an empty set. Those skilled in the art may also define the initial closest entity closeentity by themselves.
[0125] In some embodiments, in the above traversal step S211, if the type of the current entity is a circle, the distance between the center of the current entity and the main point mainp is calculated; wherein, if the distance between the center of the circle and the main point mainp is 0 or the radius of the current entity, then (that is, it means that the current entity may be the entity corresponding to the annotated entity in the object to be measured) the closest entity closeentity is updated as the current entity;
[0126] If the type of the current entity is an arc, calculate the distance between the center of the circle corresponding to the current entity and the main point mainp; if the distance between the corresponding center of the circle and the main point mainp is 0 or the radius corresponding to the current entity, then (that is, it means that the current entity may be the entity corresponding to the annotated entity in the object to be measured) update the closest entity closeentity as the current entity;
[0127] If the type of the current entity is a line, it is necessary to determine whether the main point mainp is on the current entity. Specifically, for example, the distance from the main point mainp to the current entity and the coordinates of the starting point and the ending point of the current entity can be calculated to determine whether the main point mainp is on the current entity line. If the main point mainp is on the current entity, the closest entity closeentity is updated to the current entity, and the current entity is added to the predefined line list linelist.
[0128] In some embodiments, after executing the above step S211, the annotation entity corresponding to the main point mainp can be found. After executing the above step S212, the two annotation entities involved in any annotation content can be searched and obtained.
[0129] It should be noted that the purpose of "replacing the coordinates of the main point mainp with the coordinates of the secondary point p2, and performing the traversal step S211 using the new coordinates of the main point mainp" in the above step S212 is to find the other of the two annotation entities involved in the annotation content. This is because step S211 has already found the annotation entity corresponding to the main point mainp (i.e., one of the two annotation entities involved in the annotation content), and by "exchanging the coordinates of the main point mainp with the coordinates of the secondary point p2, and performing the traversal step S211 using the new coordinates of the main point mainp", the other of the two annotation entities involved in the annotation content, i.e., the entity to be measured corresponding to the secondary point p2, can be determined.
[0130] In some embodiments, step S200: searching all entities in the standard size file using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured, further includes:
[0131] Step S213: when the corresponding annotation content involves only one annotation entity, the reference point of the annotation entity is used as the main point main, and the initial closest entity closeentity is defined. After the traversal step S211 is performed using the main point main, the number of lines in the line list linelist is obtained;
[0132] If the number of lines in the linelist is 0, the latest closest entity closeentity is the entity to be measured corresponding to the annotation content;
[0133] If the number of lines in linelist is 1, the latest closest entity closeentity is the entity to be measured corresponding to the annotation content;
[0134] If the number of lines in the line list linelist is equal to 2, then determine whether the main point mainp and the secondary point p2 are both on each current entity in the line list linelist;
[0135] Among them, if the main point mainp and the secondary point p2 are both on a current entity in the line list linelist, the current entities corresponding to the main point mainp and the secondary point p2 are removed, and the remaining other current entity is used as the entity to be measured corresponding to the annotation content in the image of the object to be measured.
[0136] In some embodiments, in the above step S213, when the corresponding annotation content (such as the aforementioned radius annotation and diameter annotation, etc.) involves only one annotation entity (such as the corresponding circle), the reference point of the annotation entity (such as the center of the corresponding circle) is used as the main point mainp, and the initial closest entity closeentity is defined. After the traversal step S211 is performed using the main point mainp, the number of lines in the line list linelist is obtained;
[0137] If the number of lines in the line list linelist is 0, the latest closest entity closeentity is the entity to be measured corresponding to the annotation content (that is, the entity to be measured is not a line but another type of entity);
[0138] If the number of lines in the linelist is 1, the latest closest entity closeentity is the entity to be measured corresponding to the annotation content (that is, the entity to be measured is a line);
[0139] Due to the particularity of straight lines, if the main point mainp happens to be the intersection of two straight lines, then the main point mainp is related to both of the above two straight lines, that is, both meet the judgment that the main point mainp is on two straight lines, so additional processing is required: If the number of straight lines in the line list linelist is equal to 2 (that is, the main point mainp is on two straight lines, then it is necessary to combine the secondary point p2 for judgment, for example, please refer to Figure 7The main point mainp of the line list linelist is traversed. After traversing all entities, the line entities L1 and L2 both meet the above requirements, that is, the main point mainp is on two lines. However, in fact, L2 is the annotated entity corresponding to the annotated content "100.00±0.50" in the figure (the other annotated entity corresponding to the annotated content "100.00±0.50" is L3). Then, all current entities in the line list linelist are traversed, and it is determined whether the main point mainp and the secondary point p2 are both on each current entity (i.e., line) in the line list linelist;
[0140] Among them, if the main point mainp and the secondary point p2 are both in a current entity in the line list linelist (such as Figure 7 L1), then remove the current entity corresponding to the main point mainp and the secondary point p2 (such as Figure 7 L1), the remaining current entity (such as Figure 7 L2) as with Figure 7 The entity to be measured corresponding to the annotation content "100.00±0.50". Among them, another annotation entity corresponding to the annotation content "100.00±0.50" is the straight line L3.
[0141] After executing the above step S200, all entities to be measured corresponding to each annotation content in the image of the object to be measured can be determined. What needs to be done next is to transform all entities to be measured corresponding to each annotation content in the image of the object to be measured into specific measurement operations to be performed on the object to be measured or the image of the object to be measured, that is, to generate corresponding measurement items of the measurement program.
[0142] For some examples, please refer to Figure 8 Step S300: measuring the entity corresponding to the annotated content in the object to be measured according to the entity to be measured corresponding to the annotated content in the image of the object to be measured to obtain a corresponding measurement result, including:
[0143] Step S310: Process the image of the object to be measured to obtain the minimum bounding rectangle of all entities in the image of the object to be measured, use the minimum bounding rectangle of all entities in the image of the object to be measured as the current plate, obtain the coordinates of the rotation center of the current plate and the angle between the long axis direction of the current plate and the horizontal direction; calculate and obtain the minimum bounding rectangle of all entities in the standard size file, use the minimum bounding rectangle of all entities in the standard size file as a template, and obtain the coordinates of the rotation center of the template and the angle between the long axis direction of the template and the horizontal direction;
[0144] Step S320: Generate a rotation and translation matrix MatrixA corresponding to the current plate and the template; wherein the rotation and translation matrix MatrixA is used to use the rotation center of the template as the rotation center of the current plate, and use the angle between the long axis direction of the template and the horizontal direction as the angle between the long axis direction of the current plate and the horizontal direction;
[0145] Step S330: convert the world coordinates saved in the standard size file into pixel coordinates, transform the pixel coordinates through the rotation and translation matrix MatrixA to obtain the pixel coordinates of the image of the object to be measured; measure the entity corresponding to the annotated content according to the pixel coordinates of the entity corresponding to the annotated content in the image of the object to be measured to obtain the corresponding measurement result.
[0146] The rotation center mentioned above refers to the center of the minimum circumscribed rectangle.
[0147] In some embodiments, in the above step S320, in the process of converting the world coordinates stored in the standard size file into pixel coordinates, it is necessary to multiply the above world coordinates by a coefficient mmscale, and the coefficient mmscale is related to the parameters of the camera used to obtain the image of the object to be measured. After the world coordinates are converted into pixel coordinates, the pixel coordinates are transformed by the rotation and translation matrix MatrixA to obtain the pixel coordinates of the current board, that is, the pixel coordinates of the current image of the object to be measured. Afterwards, the entity corresponding to the annotated content is measured according to the pixel coordinates of the entity corresponding to the annotated content to obtain the corresponding measurement result.
[0148] It should be noted that the specific process of “measuring the entity corresponding to the annotated content according to the pixel coordinates of the entity corresponding to the annotated content to obtain a corresponding measurement result” is common knowledge in the art and will not be described in detail here.
[0149] It should be noted that the reason for multiplying the above world coordinates by a coefficient mmscale is that the image of the object to be measured stores pixel coordinates, while the world coordinates stored in the standard size file are real coordinates in the real world, and the coefficient mmscale indicates how many pixels a certain distance in the real world (such as 1 cm) corresponds to in the image of the object to be measured. Therefore, multiplying the above world coordinates by a coefficient mmscale will give the corresponding pixel coordinates.
[0150] In some embodiments, after executing step S330, that is, after the pixel coordinates of the image of the object to be measured are determined, a measurement item for the entity corresponding to the annotation content may be generated. The above measurement item refers to the content measured manually or automatically on the image of the object to be measured in the measurement program (such as measuring the diameter of a circle).
[0151] In some embodiments, in the above step S310: processing the image of the object to be measured to obtain the minimum bounding rectangle of all entities in the image of the object to be measured includes:
[0152] Step S311: Obtain a point set of all entities in the image of the object to be measured; traverse the point set to obtain the upper left point and the lower right point in the point set, and then obtain the rotation center of the current plate according to the upper left point and the lower right point, and use the upper left point and the lower right point as two vertices on the same diagonal line on the current plate.
[0153] In some embodiments, the point set in the above step S311 is actually obtained based on the corresponding entity. And "traversing the point set" can be first traversing all entities, and judging whether the point belongs to the entity through the attributes of the entity, and then obtaining the point set. For example, the point corresponding to the circle entity is the center of the circle, the point corresponding to the line segment (or straight line) is two points (i.e., the starting point and the end point), and the point corresponding to the arc is the arc center.
[0154] It should be noted that the point set in the above step S311 refers to the point set corresponding to all entities such as lines, circles, and arcs, while the concept of the reference point mentioned above corresponds to the annotated entity. In other words, although the points referenced by the annotated entity are also points (such as the starting point, the ending point, the center of the circle, and the center of the arc) of the specific entity (such as a line, a circle, and an arc), the concepts of the two (i.e., the points in the point set in step S311 and the reference point) are different.
[0155] In some embodiments, since most CAD drawings (i.e., the drawing files of the objects to be measured) are placed horizontally, by default, the angle of the drawing files corresponding to the standard size files is 0 degrees. The angle rule of the drawing files is: along the positive direction of the X-axis, counterclockwise is positive (e.g., 0 to π); clockwise is negative (e.g., -π to 0). This angle rule is consistent with the angle rule used in image processing.
[0156] In some embodiments, the points in the above point set can be sorted in ascending order according to their horizontal coordinates x. For points with the same horizontal coordinate x, they are sorted in ascending order according to their vertical coordinates y. Then, the points in the point set are mapped to the same plane; wherein the point in the upper left corner of the plane is the first point after sorting, and the point in the lower right corner is the last point after sorting.
[0157] For example, suppose the point set is Among them, x i and i All are real numbers. After sorting the points in the point set in ascending order according to their horizontal coordinates x, the resulting ordered point set is Among them, i' represents the i'th point after sorting. x On the basis of , each point is sorted in ascending order according to its ordinate y, and the obtained ordered point set is Here, i'' represents the i''th point after sorting by the horizontal coordinate x and then by the vertical coordinate y. Therefore, the upper left corner point in the plane is P xy The first point in (x1, y1), the point at the bottom right is P xy The last point (x N ,y N ). Therefore, the coordinates of the upper left corner and the lower right corner are: (x1, y1) and (x N ,y N ).
[0158] In some embodiments, in the above step S311, after determining the rotation center of the current plate and two vertices on the same diagonal line on the current plate, the current plate (ie, the minimum circumscribed rectangle of all entities in the image of the object to be measured) is determined.
[0159] It should be noted that after determining the above-mentioned upper left corner point and lower right corner point, "obtaining the rotation center of the current plate according to the upper left corner point and lower right corner point" is common knowledge in the field, so it will not be repeated here.
[0160] It can be seen that the dimension measurement method based on standard dimension files of the present application greatly simplifies the time spent on manually preparing relevant measurement data (i.e. the above-mentioned DXF files), reduces the user's learning and use costs, and improves the utilization rate of the equipment.
[0161] It can be seen that the dimension measurement method based on the standard dimension file of the present application can simplify manual operations, automatically produce relevant measurement data (i.e. the above-mentioned standard dimension file), and only needs to import the above-mentioned standard dimension file into the relevant measuring instrument (for example, when the object to be measured is the above-mentioned PCB, the relevant measuring instrument can be a PCB-specific instantaneous full-size measuring instrument), and the corresponding measurement result can be obtained by automatically measuring the object to be measured through the measuring instrument.
[0162] The above is some explanation about a dimension measurement method based on standard dimension files. Fig. 9 In some embodiments of the present application, a dimension measurement system based on a standard dimension file is also disclosed, including:
[0163] The preprocessing module 100 is configured to obtain a standard size file corresponding to the object to be measured; wherein the standard size file is obtained based on the drawing file of the object to be measured, and the standard size file includes one or more entities, and the standard size file includes: annotated content, annotated entities corresponding to the annotated content, and unannotated entities; the annotated content is used to indicate the content to be measured for the object to be measured;
[0164] Annotated entities are used to represent entities that need to be measured to obtain the corresponding annotation content; unannotated entities are used to represent entities that do not need to be measured; the types of entities include: straight line, circle or arc;
[0165] The camera module 200 is configured to photograph the object to be measured to obtain an image of the object to be measured, where the image of the object to be measured includes one or more entities;
[0166] The conversion module 300 is configured to search all entities in the image of the object to be measured using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the reference point is determined in the annotated entity based on the annotated content; the standard size file further includes: the coordinates of the reference point;
[0167] The measurement module 400 is configured to measure the entity in the object to be measured corresponding to the annotated content according to the entity in the image of the object to be measured corresponding to the annotated content, so as to obtain a corresponding measurement result.
[0168] In some embodiments, the camera module 200 may be a line scan camera as described above. The camera module 200 may also be a planar array camera as described above. Those skilled in the art may select a suitable camera module 200 according to actual needs, and the specific configuration of the camera module 200 is not limited herein.
[0169] In some embodiments, when the object to be measured is different, different measurement modules 400 may be used. For example, when the object to be measured is the PCB board mentioned above, the measurement module 400 may use a full-size instantaneous inspection measuring instrument dedicated to PCB. Those skilled in the art may select a specific measurement module 400 according to actual needs, and the specific content of the measurement module 400 is not limited here.
[0170] It should be noted that the specific operation process and technical effects of the above-mentioned dimension measurement system based on standard dimension files are basically the same as the dimension measurement method based on standard dimension files mentioned above, so you can directly refer to the dimension measurement method based on standard dimension files mentioned above, and no further details will be given here.
[0171] The above is some description about a dimension measurement system based on standard dimension files. In some embodiments of the present application, a computer-readable storage medium is also disclosed, including a program, which can be executed by a processor to implement a method as in any embodiment of the present application.
[0172] This document is described with reference to various exemplary embodiments. However, those skilled in the art will recognize that changes and modifications may be made to the exemplary embodiments without departing from the scope of this document. For example, various operating steps and components for performing the operating steps may be implemented in different ways (e.g., one or more steps may be deleted, modified, or incorporated into other steps) depending on the specific application or considering any number of cost functions associated with the operation of the system.
[0173] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. In addition, as understood by those skilled in the art, the principles of this article can be reflected in a computer program product on a computer-readable storage medium, which is pre-installed with a computer-readable program code. Any tangible, non-temporary computer-readable storage medium can be used, including magnetic storage devices (hard disks, floppy disks, etc.), optical storage devices (CD to ROM, DVD, Blu Ray disks, etc.), flash memory and / or the like. These computer program instructions can be loaded onto a general-purpose computer, a special-purpose computer or other programmable data processing device to form a machine, so that these instructions executed on a computer or other programmable data processing device can generate a device that implements a specified function. These computer program instructions can also be stored in a computer-readable memory, which can instruct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory can form a manufactured product, including an implementation device that implements a specified function. Computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operating steps are performed on a computer or other programmable device to generate a computer-implemented process, so that the instructions executed on a computer or other programmable device can provide steps for implementing a specified function.
[0174] Although the principles of this invention have been shown in various embodiments, many modifications of structures, arrangements, proportions, elements, materials and components particularly suitable for specific environments and operational requirements can be used without departing from the principles and scope of this invention. The above modifications and other changes or amendments will be included in the scope of this invention.
[0175] The foregoing specific description has been described with reference to various embodiments. However, those skilled in the art will recognize that various modifications and changes can be made without departing from the scope of the present disclosure. Therefore, the consideration of the present disclosure will be illustrative rather than restrictive, and all these modifications will be included in its scope. Similarly, the advantages, other advantages and solutions to the problems of various embodiments have been described above. However, the benefits, advantages, solutions to the problems and any elements that can produce these, or make them more clear, should not be interpreted as critical, necessary or necessary. The term "include" and any other variants used in this article are all non-exclusive inclusions, so that the process, method, article or device including the list of elements not only includes these elements, but also includes other elements that are not explicitly listed or do not belong to the process, method, system, article or device. In addition, the term "coupled" and any other variants used in this article refer to physical connections, electrical connections, magnetic connections, optical connections, communication connections, functional connections and / or any other connections.
[0176] Those skilled in the art will appreciate that many changes may be made to the details of the above-described embodiments without departing from the basic principles of the invention. Therefore, the scope of the present invention should be determined solely by the claims.
Claims
1. A dimension measurement method based on a standard dimension file, characterized in that: include: Obtain the standard size file corresponding to the object to be measured; wherein the standard size file is obtained based on the drawing file of the object to be measured; the standard size file includes: annotation content, one or more entities, the one or more entities include unannotated entities and annotated entities corresponding to the annotation content; the annotation content is used to indicate the content to be measured for the object to be measured; the annotated entity is used to indicate the entity to be measured in order to obtain the corresponding annotated content; the unannotated entity is used to indicate the entity that does not need to be measured; Searching all the entities in the standard size file using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the reference point is determined in the annotated entity based on the annotated content; the image of the object to be measured is obtained by photographing the object to be measured, and the image of the object to be measured includes one or more entities; The entity corresponding to the annotation content in the image of the object to be measured is measured to obtain a corresponding measurement result.
2. The method according to claim 1, characterized in that The step of searching all the entities in the standard size file by using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured includes: When the corresponding annotation content involves two annotation entities, the reference point of one of the two annotation entities is used as the primary point, and the reference point of the other of the two annotation entities is used as the secondary point to define an initial closest entity; wherein the closest entity is used to represent the entity closest to the annotation entity corresponding to the primary point; Traversal step: obtaining the type of each entity in the image of the object to be measured, taking the entities in the image of the object to be measured as current entities one by one, and performing the following operations on each current entity until all the entities in the image of the object to be measured are traversed to determine the entity to be measured corresponding to the main point: If the type of the current entity is a circle, calculate the distance between the center of the current entity and the main point; wherein, if the distance between the center of the circle and the main point is 0 or the radius of the current entity, update the closest entity to the current entity; If the type of the current entity is an arc, calculate the distance between the center of the circle corresponding to the current entity and the main point; wherein, if the distance between the corresponding center of the circle and the main point is 0 or is the radius corresponding to the current entity, update the closest entity to the current entity; If the type of the current entity is a straight line, determine whether the main point is on the current entity; if the main point is on the current entity, update the closest entity to the current entity, and add the current entity to a predefined straight line list; The traversal step is performed again: the coordinates of the main point and the coordinates of the secondary point are exchanged, and the traversal step is performed using the new coordinates of the main point to determine the entity to be measured corresponding to the new main point; The entity to be measured obtained before the coordinates are exchanged and the entity to be measured obtained after the coordinates are exchanged are used as the entity to be measured corresponding to the annotation content in the image of the object to be measured.
3. The method according to claim 2, characterized in that The step of searching all the entities in the standard size file by using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured further includes: When the corresponding annotation content involves only one annotation entity, the reference point of the annotation entity is used as the main point to define the initial closest entity, and after performing the traversal step using the main point, the number of the straight lines in the straight line list is obtained; Wherein, if the number of the straight lines in the straight line list is 0, then the latest closest entity is the entity to be measured corresponding to the annotated content; If the number of the straight lines in the straight line list is 1, then the latest closest entity is the entity to be measured corresponding to the marked content; If the number of the straight lines in the straight line list is equal to 2, determining whether the main point and the secondary point are both on each of the current entities in the straight line list; Among them, if the main point and the secondary point are both on one of the current entities in the straight line list, the current entities corresponding to the main point and the secondary point are removed, and the remaining other current entity is used as the entity to be measured in the image of the object to be measured corresponding to the annotation content.
4. The method according to claim 1, characterized in that The step of obtaining the standard size file corresponding to the object to be measured includes: Determine a manually annotated area and an automatically annotated area in the drawing file; wherein the manually annotated area refers to an area that is pre-annotated on the drawing file, and the automatically annotated area refers to an area in the drawing file that is completely or partially the same as the manually annotated area except the manually annotated area; Annotating the manually annotated area to obtain the corresponding annotated content; The step of generating the annotation content of the automatic annotation area: using the corresponding annotation content in the manual annotation area to annotate the automatic annotation area to obtain the annotation content corresponding to the automatic annotation area; Acquire the annotated entity and the unannotated entity corresponding to the annotated content; The data format of the standard size file is DXF / DWG / ODB++ / IPC2581.
5. The method according to claim 4, characterized in that The step of annotating the automatic annotated area by using the corresponding annotated content in the manual annotated area to obtain the annotated content corresponding to the automatic annotated area includes: Using the corresponding annotated content in the manually annotated area as content to be copied; Traversing all the annotated entities corresponding to the content to be copied, putting the entities corresponding to each annotated entity in the content to be copied into a temporary list, taking out one of the entities from the temporary list in turn as the selected first entity, and performing the following operations using each of the selected first entities until all the entities in the temporary list are traversed: Acquire a preset search direction and a limit value corresponding to the search direction, search the automatic annotation area within the range of the limit value in the search direction to obtain all the entities in the automatic annotation area that are identical to the selected first entity; store all the entities that are identical to the selected first entity in an alignment list corresponding to the selected first entity; Perform the following operations on each of the entities in the alignment list corresponding to the selected first entity: Taking out one of the entities from the alignment list, naming the entity as entityfirst, and calculating the distance between the corresponding selected first entity and the current entityfirst; Searching out entities in the temporary list except the selected first entity; Traversing the search direction, putting entities in the alignment list that are identical to the currently selected first entity into the list, and determining whether the distance between each entity in the list and the currently selected first entity is the same as the distance; if the distance between the entity in the list and the currently selected first entity is the same as the distance, then the entity in the list is the annotated entity to be copied; The annotation entity to be copied is used to generate a corresponding annotation entity in the automatic annotation area, and the annotation content corresponding to the annotation entity to be copied is copied to the automatic annotation area.
6. The method according to claim 5, characterized in that The step of annotating the automatic annotated area by using the corresponding annotated content in the manual annotated area to obtain the annotated content corresponding to the automatic annotated area further includes: When the automatic annotation area is obtained by rotating the manually annotated area by a preset angle, the annotation entity corresponding to the annotation content of the manually annotated area is rotated by the preset angle around the center of the annotation entity, and the rotated annotation entity is then processed according to the steps of generating the annotation content of the automatic annotation area, so as to annotate the automatic annotation area and obtain the annotation content corresponding to the automatic annotation area.
7. The method according to claim 1, characterized in that The measuring the entity in the object to be measured corresponding to the annotated content according to the entity to be measured in the image of the object to be measured corresponding to the annotated content to obtain a corresponding measurement result includes: Processing the image of the object to be measured to obtain the minimum bounding rectangle of the image of the object to be measured, taking the minimum bounding rectangle of the image of the object to be measured as the current plate, and obtaining the coordinates of the rotation center of the current plate and the angle between the long axis direction of the current plate and the horizontal direction; calculating and obtaining the minimum bounding rectangle of all the entities in the standard size file, taking the minimum bounding rectangle of all the entities in the standard size file as a template, and obtaining the coordinates of the rotation center of the template and the angle between the long axis direction of the template and the horizontal direction; Generate a rotation and translation matrix corresponding to the current plate and the template; wherein the rotation and translation matrix is used to use the rotation center of the template as the rotation center of the current plate, and use the angle between the long axis direction of the template and the horizontal direction as the angle between the long axis direction of the current plate and the horizontal direction; The world coordinates saved in the standard size file are converted into pixel coordinates, and the pixel coordinates are converted through the rotation and translation matrix to obtain the pixel coordinates of the image of the object to be measured; the entity corresponding to the annotated content is measured according to the pixel coordinates of the entity corresponding to the annotated content in the image of the object to be measured to obtain a corresponding measurement result.
8. The method according to claim 7, characterized in that The step of processing the image of the object to be measured to obtain a minimum circumscribed rectangle of the image of the object to be measured includes: A point set of all the entities in the image of the object to be measured is obtained; the point set is traversed to obtain the upper left point and the lower right point in the point set, and then the rotation center of the current plate is obtained according to the upper left point and the lower right point, and the upper left point and the lower right point are respectively used as two vertices on the same diagonal line on the current plate.
9. A dimension measurement system based on standard dimension files, characterized in that: include: A preprocessing module is configured to obtain the standard size file corresponding to the object to be measured; wherein the standard size file is obtained based on the drawing file of the object to be measured, and the standard size file includes one or more entities, and the standard size file includes: annotated content, annotated entities corresponding to the annotated content, and unannotated entities; the annotated content is used to indicate the content to be measured for the object to be measured; The annotated entity is used to represent the entity that needs to be measured to obtain the corresponding annotated content; the unannotated entity is used to represent the entity that does not need to be measured; the type of the entity includes: a straight line, a circle or an arc; A camera module is configured to photograph the object to be measured to obtain an image of the object to be measured, wherein the image of the object to be measured includes one or more entities; A conversion module is configured to search all the entities in the image of the object to be measured using the reference point of the annotated entity to determine the entity to be measured corresponding to the annotated content in the image of the object to be measured; wherein the reference point is determined in the annotated entity based on the annotated content; and the standard size file further includes: coordinates of the reference point; The measuring module is configured to measure the entity in the object to be measured corresponding to the annotated content according to the entity to be measured in the image of the object to be measured corresponding to the annotated content, so as to obtain a corresponding measurement result.
10. A computer-readable storage medium, characterized in that: The method comprises a program which can be executed by a processor to implement the method according to any one of claims 1 to 8.