A dispensing defect recognition method and system based on machine vision
By judging the image processing of the dispensing object and judging the degree of line segment deviation, the difficulty of dispensing defect identification caused by scale changes is solved, and a more efficient defect identification effect is achieved.
Patent Information
- Application Number
- CN202510705246.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-05-29
AI Technical Summary
In the prior art, there is a scale change between the original image and the template image, resulting in an algorithm based on image matching that cannot effectively identify dispensing defects.
By obtaining the workpiece image of the dispensing object, positioning and cutting the rubber strip area, performing binarization processing and association, fitting the rubber point outline point set, and determining the degree of line segment deviation to identify defects.
It improves the accuracy and speed of dispensing defect recognition, can detect small local distortions, and enhances the coverage of defect recognition results.
Smart Images

Figure CN120219755B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of automatic dispensing, and in particular relates to a dispensing defect recognition method and system based on machine vision. Background Art
[0002] Automatic dispensing machines are widely used in industrial production, playing a vital role in product connection, coating, and sealing in industries ranging from microcircuits and electronics to LEDs, and in general industry. The use of automatic dispensing machines not only significantly improves product quality but also increases production efficiency, enabling complex dispensing processes. Consequently, dispensing quality has become a growing concern. In actual production, various factors, such as the dispensing process level of the automatic dispensing machine and the temperature of the glue, can lead to defects in the produced glue, such as bubbles, broken glue strips, and excessively thick or thin glue strips. Therefore, failure to promptly detect dispensing defects during production can significantly impact product quality. For example, during the assembly of electronic products like computers and mobile phones, the camera base must adhere to surrounding components. If dispensing defects result in a substandard product, the resulting costs can be substantial. Therefore, strict dispensing quality control is crucial in various applications where dispensing is required to achieve connections. It is obviously unreasonable to rely on manpower to detect dispensing defects. Due to its heavy workload, low efficiency, and low detection accuracy, it can no longer meet actual production needs.
[0003] In the prior art, the original image and the template image are matched through an image recognition model, and the dispensing defects in the original image can be identified. However, there is a scale difference between the original image and the template image, and the above-mentioned image matching-based algorithm cannot perform matching. Summary of the Invention
[0004] The present invention provides a method and system for identifying dispensing defects based on machine vision, which is used to solve the technical problem that there is a scale change between the original image and the template image, and the existing image matching algorithm cannot match them, making dispensing defects difficult to identify.
[0005] In a first aspect, the present invention provides a method for identifying dispensing defects based on machine vision, comprising:
[0006] Acquire a workpiece image of at least one dispensing object;
[0007] Positioning the glue strip area in each workpiece image, and cutting the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object;
[0008] Preprocessing each dispensing image to obtain each binary dispensing image, and correlating each binary dispensing image according to a preset correlation strategy to obtain at least one binary dispensing image set;
[0009] Selecting a first binary glue spotting image and a second binary glue spotting image from a set of binary glue spotting images, and determining a first glue spot contour point set in the first binary glue spotting image and a second glue spot contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are two binary glue spotting images with the smallest similarity in the set of binary glue spotting images;
[0010] A first line segment and a second line segment are obtained by fitting each first glue dot contour point in the first glue dot contour point set, and a third line segment and a fourth line segment are obtained by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of a glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center;
[0011] determining whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold;
[0012] If the first deviation degree and the second deviation degree are both not greater than the preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are used as the defect recognition results of other binary dispensing images in the certain binary dispensing image set.
[0013] In a second aspect, the present invention provides a dispensing defect recognition system based on machine vision, comprising:
[0014] an acquisition module configured to acquire an image of at least one workpiece of a dispensing object;
[0015] a cutting module configured to locate the glue strip area in each workpiece image and cut the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object;
[0016] an association module configured to pre-process each dispensing image to obtain each binary dispensing image, and associate each binary dispensing image according to a preset association strategy to obtain at least one binary dispensing image set;
[0017] a determination module configured to select a first binary glue spotting image and a second binary glue spotting image from a certain binary glue spotting image set, and determine a first glue spot contour point set in the first binary glue spotting image and a second glue spot contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are the two binary glue spotting images with the smallest similarity in the certain binary glue spotting image set;
[0018] a fitting module configured to obtain a first line segment and a second line segment by fitting each first glue dot contour point in the first glue dot contour point set, and to obtain a third line segment and a fourth line segment by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of a glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center;
[0019] a judging module configured to judge whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold;
[0020] The identification module is configured to use the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image as the defect recognition results of other binary dispensing images in the certain binary dispensing image set if the first deviation degree and the second deviation degree are both not greater than a preset threshold value.
[0021] According to a third aspect, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of the machine vision-based dispensing defect recognition method of any embodiment of the present invention.
[0022] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the program instructions are executed by a processor, the processor executes the steps of the method for identifying dispensing defects based on machine vision according to any embodiment of the present invention.
[0023] The machine vision-based glue dispensing defect recognition method and system of the present application obtains a first line segment and a second line segment by fitting each first glue point contour point in a first glue point contour point set, and obtains a third line segment and a fourth line segment by fitting each second glue point contour point in a second glue point contour point set, and judges whether the first degree of deviation between the first line segment and the third line segment, and the second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold value, so as to detect smaller local distortions as much as possible, thereby better improving the accuracy of subsequent defect recognition result coverage, and when both the first degree of deviation and the second degree of deviation are not greater than the preset threshold value, the first defect recognition result of the first binary glue dispensing image and the second defect recognition result of the second binary glue dispensing image are used as the defect recognition results of other binary glue dispensing images in a certain binary glue dispensing image set, which can better improve the speed of defect recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0025] Figure 1 A flowchart of a method for identifying dispensing defects based on machine vision provided by one embodiment of the present invention;
[0026] Figure 2 A structural block diagram of a dispensing defect recognition system based on machine vision provided by one embodiment of the present invention;
[0027] Figure 3 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0029] See also Figure 1 , which shows a flow chart of a method for identifying dispensing defects based on machine vision in the present application.
[0030] like Figure 1As shown in FIG, the method for identifying dispensing defects based on machine vision specifically includes the following steps:
[0031] Step S101: Acquire a workpiece image of at least one dispensing object.
[0032] In this step, the image of the dispensing workpiece is captured and transmitted according to the CMOS image acquisition device to obtain a workpiece image of at least one dispensing object.
[0033] In the specific embodiment, the dispensing workpiece is placed in the feed port and then transported to the discharge port by a conveyor belt. During this process, the conveyor belt stops when the workpiece reaches the limit switch, and the clamp is activated to press the workpiece against the conveyor belt. The camera is moved to the specific detection position via the X and Y axes of the horizontal motion mechanism, and the camera is moved in the Z axis via the vertical motion mechanism to obtain higher quality images. This method of obtaining workpiece images is a conventional technical means and will not be elaborated on here.
[0034] Step S102 , locating the glue strip area in each workpiece image, and cutting the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object.
[0035] In this step, the workpiece image is input into a preset image recognition model. The adhesive strip area in the workpiece image is annotated according to the image recognition model to obtain an annotation frame. The adhesive strip area is then cropped along the annotation frame to obtain the corresponding adhesive dispensing image. This reduces the amount of subsequent image preprocessing required. It should be noted that the image recognition model in the present invention can be obtained by training a neural network using a training set and a validation set.
[0036] Step S103 , pre-processing each dispensing image to obtain each binary dispensing image, and correlating each binary dispensing image according to a preset correlation strategy to obtain at least one binary dispensing image set.
[0037] In this step, each dispensing image is binarized to obtain each binary dispensing image.
[0038] Furthermore, each binary dot image is input into a preset two-dimensional coordinate system, wherein a vertex of each binary dot image coincides with the origin of the preset two-dimensional coordinate system; the height difference between any two pixels at the same horizontal coordinate in a binary dot image is calculated, and the maximum height difference at the same horizontal coordinate is selected, and the average of each maximum height difference is calculated to obtain the maximum height difference average; it is determined whether the maximum height difference average between different binary dot images is greater than a preset average threshold; if the maximum height difference average between two binary dot images is greater than the preset average threshold, the two binary dot images are not associated; if the maximum height difference average between two binary dot images is not greater than the preset average threshold, the two binary dot images are associated to obtain a set of binary dot images. This achieves the goal of associating binary dot images of the same size as much as possible, facilitating subsequent recognition operations.
[0039] For example, under the same horizontal coordinate, there are pixel A, pixel B, pixel C, and pixel D from top to bottom.
[0040] The height differences are: height ab obtained by subtracting the ordinate of pixel point A from the ordinate of pixel point B, height ac obtained by subtracting the ordinate of pixel point C from the ordinate of pixel point A, height ad obtained by subtracting the ordinate of pixel point D from the ordinate of pixel point A, height bc obtained by subtracting the ordinate of pixel point C from the ordinate of pixel point B, height bd obtained by subtracting the ordinate of pixel point B from the ordinate of pixel point D, and height cd obtained by subtracting the ordinate of pixel point C from the ordinate of pixel point D. The average of the maximum height differences is height ad.
[0041] Step S104: Select a first binary glue spotting image and a second binary glue spotting image from a certain binary glue spotting image set, and determine a first glue point contour point set in the first binary glue spotting image and a second glue point contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are the two binary glue spotting images with the least similarity in the certain binary glue spotting image set.
[0042] In this step, each binary glue spot image is input into a preset two-dimensional coordinate system, wherein a vertex of each binary glue spot image coincides with the origin of the preset two-dimensional coordinate system, and the glue strips in the binary glue spot image are arranged parallel to the horizontal axis of the two-dimensional coordinate system. Under the same horizontal coordinate, the grayscale values of the pixels in the glue strip area in the first binary glue spot image are compared to obtain the first pixel point that is greater than the preset grayscale value threshold and the last pixel point that is greater than the preset grayscale value threshold. The first pixel point and the second pixel point are both defined as first glue spot contour points and grouped into the first glue spot contour point set. Similarly, the second glue spot contour point set in the second binary glue spot image can be determined.
[0043] For another example, in the same horizontal coordinate, from top to bottom, there are pixel A, pixel B, pixel C, and pixel D. Then, the first pixel whose grayscale value is greater than the preset threshold is pixel A, and the second pixel whose grayscale value is greater than the preset threshold is pixel D.
[0044] Step S105, fitting the first glue point contour points in the first glue point contour point set to obtain the first line segment and the second line segment, and fitting the second glue point contour points in the second glue point contour point set to obtain the third line segment and the fourth line segment, wherein the first line segment and the third line segment are located on one side of the glue point center, and the second line segment and the fourth line segment are located on the other side of the glue point center.
[0045] In this step, based on the coordinate information of the first glue dot contour point in the preset two-dimensional coordinate system, the first glue dot contours within the same height range are connected in sequence to obtain the first line segment and the second line segment; based on the coordinate information of the second glue dot contour point in the preset two-dimensional coordinate system, the second glue dot contours within the same height range are connected in sequence to obtain the third line segment and the fourth line segment.
[0046] Step S106 , determining whether a first deviation degree between the first line segment and the third line segment, and a second deviation degree between the second line segment and the fourth line segment are greater than a preset threshold.
[0047] In this step, the first line segment and the third line segment are respectively set in a two-dimensional coordinate system, wherein the endpoints of the first line segment and the third line segment coincide with the origin of the preset two-dimensional coordinate system, and the first line segment and the third line segment are set along a direction parallel to the horizontal axis of the preset two-dimensional coordinate system.
[0048] The coordinate information of each first glue dot contour point constituting the first line segment is obtained respectively, and the coordinate information of each second glue dot contour point constituting the third line segment is obtained respectively.
[0049] The first glue dot contour point whose height is greater than a preset height threshold is defined as an abnormal first glue dot contour point, and the first glue dot contour point whose height is not greater than the preset height threshold is defined as a normal first glue dot contour point, and based on the coordinate information of the first glue dot contour point, the adjacent abnormal first glue dot contour points are connected, and the adjacent normal first glue dot contour points are connected to obtain at least one first sub-segment; wherein the height refers to the height of the glue dot contour point from the horizontal axis, that is, the vertical coordinate value.
[0050] A second glue dot contour point with a height greater than a preset height threshold is defined as an abnormal second glue dot contour point, and a second glue dot contour point with a height not greater than the preset height threshold is defined as a normal second glue dot contour point. Adjacent abnormal second glue dot contour points and adjacent normal second glue dot contour points are connected based on the coordinate information of the second glue dot contour points to obtain at least one second sub-line segment. At least one first sub-line segment and at least one second sub-line segment are sorted based on the coordinate information of the glue dot contour points, and a sub-degree of deviation between a first sub-line segment and a second sub-line segment with the same serial number is determined. The sub-degrees of deviation are superimposed to obtain a first degree of deviation between the first line segment and the third line segment, wherein the sub-degree of deviation is the difference between the highest point and the lowest point of a first sub-line segment and a second sub-line segment with the same serial number. It should be noted that sorting the at least one first sub-line segment and the at least one second sub-line segment based on the coordinate information of the glue dot contour points means: obtaining the horizontal coordinate value of each glue dot contour point along the length direction of the rubber strip, and sorting the at least one first sub-line segment and the at least one second sub-line segment based on the magnitude of the horizontal coordinate value. The first line segment and the second line segment are set separately in the two-dimensional coordinate system. For example, if the last horizontal coordinate first glue point contour point in the first sub-line segment A is 5, and the first horizontal coordinate first glue point contour point in the first sub-line segment B is 6, then the first sub-line segment A is arranged before the first sub-line segment B.
[0051] It is determined whether a first deviation between the first line segment and the third line segment is greater than a preset threshold.
[0052] In this embodiment, existing techniques typically analyze line segment similarity, which can easily mask local defects (such as minor distortions in the adhesive path). In this embodiment, a line segment is decomposed into multiple sub-segments. By comparing the difference between the highest and lowest points of sub-segments with the same serial number, the degree of deviation of the sub-segments is determined. This method can capture local morphological anomalies that traditional methods cannot identify. In scenarios with narrow adhesive path widths, even minor local distortions can be detected to the greatest extent possible. This significantly improves the accuracy of subsequent defect identification results.
[0053] In a specific embodiment, after determining whether the first degree of deviation between the first line segment and the third line segment, and the second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold, if the first degree of deviation or the second degree of deviation is greater than the preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are obtained, and defect recognition is performed on other binary dispensing images in a certain binary dispensing image set to obtain corresponding defect recognition results.
[0054] Step S107: If the first deviation degree and the second deviation degree are both not greater than the preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are used as the defect recognition results of other binary dispensing images in the certain binary dispensing image set.
[0055] In this step, the other binary glue spotting images are binary glue spotting images excluding the first binary glue spotting image and the second binary glue spotting image from a certain binary glue spotting image set;
[0056] Specifically, the first line segment and the second line segment in the first binary glue spot image are synchronously set in a preset two-dimensional coordinate system to obtain coordinate information of each first glue point contour point on the first line segment and coordinate information of each first glue point contour point on the second line segment; based on a preset sliding window, the first line segment and the second line segment are slid on, and the distance between the first glue point contour point on the first line segment and the first glue point contour point on the second line segment in the sliding window is calculated to obtain at least one distance value, wherein each time the sliding occurs, the sliding window only contains one first glue point contour point on the first line segment and one first glue point contour point on the second line segment; it is determined whether the difference between any two distance values is greater than a preset distance threshold; if it is greater than the preset distance threshold, the glue strip in the first binary glue spot image is abnormal, otherwise the glue strip is not abnormal; another binary glue spot image whose similarity with the first binary glue spot image is greater than the preset similarity threshold is obtained in a certain binary glue spot image set, and the first defect recognition result of the first binary glue spot image is directly used as the defect recognition result of the other binary glue spot image.
[0057] In summary, the method of the present application obtains the first line segment and the second line segment by fitting each first glue point contour point in the first glue point contour point set, and obtains the third line segment and the fourth line segment by fitting each second glue point contour point in the second glue point contour point set, and judges whether the first degree of deviation between the first line segment and the third line segment, and the second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold value, and can detect smaller local distortions as much as possible, thereby better improving the accuracy of subsequent defect recognition result coverage, and when the first degree of deviation and the second degree of deviation are both not greater than the preset threshold value, the first defect recognition result of the first binary glue spotting image and the second defect recognition result of the second binary glue spotting image are used as the defect recognition results of other binary glue spotting images in a certain binary glue spotting image set, which can better improve the speed of defect recognition.
[0058] See also Figure 2 , which shows a structural block diagram of a dispensing defect recognition system based on machine vision in this application.
[0059] like Figure 2 As shown, the dispensing defect recognition system 200 includes an acquisition module 210 , a cutting module 220 , an association module 230 , a determination module 240 , a fitting module 250 , a judgment module 260 and an identification module 270 .
[0060] Among them, the acquisition module 210 is configured to acquire a workpiece image of at least one dispensing object; the cutting module 220 is configured to locate the glue strip area in each workpiece image, and cut the glue strip area based on a preset cutting rule to obtain a glue strip image corresponding to the at least one dispensing object; the association module 230 is configured to preprocess each dispensing image to obtain each binary dispensing image, and associate each binary dispensing image according to a preset association strategy to obtain at least one binary dispensing image set; the determination module 240 is configured to select a first binary dispensing image and a second binary dispensing image from a certain binary dispensing image set, and determine a first glue point contour point set in the first binary dispensing image, and a second glue point contour point set in the second binary dispensing image, wherein the first binary dispensing image and the second binary dispensing image are two binary dispensing images with the smallest similarity in the certain binary dispensing image set. Glue dot image; a fitting module 250, configured to obtain a first line segment and a second line segment by fitting each first glue dot contour point in the first glue dot contour point set, and to obtain a third line segment and a fourth line segment by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of the glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center; a judgment module 260, configured to judge whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold; an identification module 270, configured to use the first defect recognition result of the first binary glue dot image and the second defect recognition result of the second binary glue dot image as the defect recognition results of other binary glue dot images in the certain binary glue dot image set if both the first deviation degree and the second deviation degree are not greater than the preset threshold.
[0061] It should be understood that Figure 2 Modules and references documented in Figure 1 Therefore, the operations and features described above for the method and the corresponding technical effects also apply to Figure 2 The modules in it will not be described in detail here.
[0062] In other embodiments, embodiments of the present invention further provide a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor is caused to execute the dispensing defect recognition method based on machine vision in any of the above method embodiments;
[0063] As an embodiment, the computer-readable storage medium of the present invention stores computer-executable instructions, and the computer-executable instructions are configured as follows:
[0064] Acquire a workpiece image of at least one dispensing object;
[0065] Positioning the glue strip area in each workpiece image, and cutting the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object;
[0066] Preprocessing each dispensing image to obtain each binary dispensing image, and correlating each binary dispensing image according to a preset correlation strategy to obtain at least one binary dispensing image set;
[0067] Selecting a first binary glue spotting image and a second binary glue spotting image from a set of binary glue spotting images, and determining a first glue spot contour point set in the first binary glue spotting image and a second glue spot contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are two binary glue spotting images with the smallest similarity in the set of binary glue spotting images;
[0068] A first line segment and a second line segment are obtained by fitting each first glue dot contour point in the first glue dot contour point set, and a third line segment and a fourth line segment are obtained by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of a glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center;
[0069] determining whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold;
[0070] If the first deviation degree and the second deviation degree are both not greater than the preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are used as the defect recognition results of other binary dispensing images in the certain binary dispensing image set.
[0071] The computer-readable storage medium may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function; the data storage area may store data generated based on the use of the machine vision-based dispensing defect recognition system. Furthermore, the computer-readable storage medium may include high-speed random access memory and may also include memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some embodiments, the computer-readable storage medium may optionally include memory remotely located relative to the processor. Such remote memory may be connected to the machine vision-based dispensing defect recognition system via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0072] Figure 3 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, the device includes: a processor 310 and a memory 320. The electronic device may also include: an input device 330 and an output device 340. The processor 310, the memory 320, the input device 330 and the output device 340 may be connected via a bus or other means. Figure 3 The example of a bus connection is shown. Memory 320 is the aforementioned computer-readable storage medium. Processor 310 executes various server functional applications and data processing by running the non-volatile software programs, instructions, and modules stored in memory 320, thereby implementing the aforementioned method embodiment of the machine vision-based dispensing defect recognition method. Input device 330 can receive input digital or character information and generate key signal input related to user settings and function control of the machine vision-based dispensing defect recognition system. Output device 340 may include a display device such as a display screen.
[0073] The electronic device can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0074] As an embodiment, the electronic device is applied to a machine vision-based dispensing defect recognition system for a client, and includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:
[0075] Acquire a workpiece image of at least one dispensing object;
[0076] Positioning the glue strip area in each workpiece image, and cutting the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object;
[0077] Preprocessing each dispensing image to obtain each binary dispensing image, and correlating each binary dispensing image according to a preset correlation strategy to obtain at least one binary dispensing image set;
[0078] Selecting a first binary glue spotting image and a second binary glue spotting image from a set of binary glue spotting images, and determining a first glue spot contour point set in the first binary glue spotting image and a second glue spot contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are two binary glue spotting images with the smallest similarity in the set of binary glue spotting images;
[0079] A first line segment and a second line segment are obtained by fitting each first glue dot contour point in the first glue dot contour point set, and a third line segment and a fourth line segment are obtained by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of a glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center;
[0080] determining whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold;
[0081] If the first deviation degree and the second deviation degree are both not greater than the preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are used as the defect recognition results of other binary dispensing images in the certain binary dispensing image set.
[0082] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods of each embodiment or certain portions of the embodiments.
[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for identifying dispensing defects based on machine vision, characterized in that: include: Acquire a workpiece image of at least one dispensing object; Positioning the glue strip area in each workpiece image, and cutting the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object; Preprocessing each dispensing image to obtain each binary dispensing image, and correlating each binary dispensing image according to a preset correlation strategy to obtain at least one binary dispensing image set; Selecting a first binary glue spotting image and a second binary glue spotting image from a set of binary glue spotting images, and determining a first glue spot contour point set in the first binary glue spotting image and a second glue spot contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are two binary glue spotting images with the smallest similarity in the set of binary glue spotting images; A first line segment and a second line segment are obtained by fitting each first glue dot contour point in the first glue dot contour point set, and a third line segment and a fourth line segment are obtained by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of a glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center; determining whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold; If the first deviation degree and the second deviation degree are both not greater than the preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are used as the defect recognition results of other binary dispensing images in the certain binary dispensing image set.
2. The method for identifying dispensing defects based on machine vision according to claim 1, characterized in that: The step of associating the binary dispensing images according to a preset association strategy to obtain at least one binary dispensing image set includes: Inputting each binary glue spot image into a preset two-dimensional coordinate system, wherein a vertex of each binary glue spot image coincides with the origin of the preset two-dimensional coordinate system; Calculate the height difference between any two pixels at the same horizontal coordinate in a binary dispensing image, select the maximum height difference at the same horizontal coordinate, and calculate the average of each maximum height difference to obtain the maximum height difference average; Determine whether the average of the maximum height differences between different binary dispensing images is greater than a preset average threshold; If the average of the maximum height difference between two binary dispensing images is greater than a preset average threshold, the two binary dispensing images are not associated; If the average of the maximum height difference between two binary dispensing images is not greater than a preset average threshold, the two binary dispensing images are associated to obtain a binary dispensing image set.
3. The method for identifying dispensing defects based on machine vision according to claim 1, characterized in that: in, Determining a first glue dot contour point set in the first binary glue dot image includes: Inputting each binary glue spot image into a preset two-dimensional coordinate system, wherein a vertex of each binary glue spot image coincides with the origin of the preset two-dimensional coordinate system, and the glue strips in the binary glue spot image are arranged along a direction parallel to the horizontal axis of the two-dimensional coordinate system; Under the same horizontal axis, comparing the grayscale values of pixels in the glue strip area in the first binary glue dispensing image to obtain a first pixel point that is greater than a preset grayscale value threshold and a last pixel point that is greater than the preset grayscale value threshold; The first pixel point and the second pixel point are both defined as first glue dot contour points and divided into a first glue dot contour point set.
4. The method for identifying dispensing defects based on machine vision according to claim 3, characterized in that: The step of fitting the first and second line segments according to each first glue dot contour point in the first glue dot contour point set, and fitting the third and fourth line segments according to each first glue dot contour point in the first glue dot contour point set includes: Based on the coordinate information of the first glue dot contour point in the preset two-dimensional coordinate system, the contours of the first glue dots within the same height range are sequentially connected to obtain a first line segment and a second line segment; Based on the coordinate information of the second glue dot contour points in the preset two-dimensional coordinate system, the second glue dot contours within the same height range are sequentially connected to obtain a third line segment and a fourth line segment.
5. The method for identifying dispensing defects based on machine vision according to claim 1, characterized in that: in, Determining whether a first deviation between the first line segment and the third line segment is greater than a preset threshold specifically includes: Arranging the first line segment and the third line segment in the two-dimensional coordinate system respectively, wherein the endpoints of the first line segment and the three line segments coincide with the origin of the preset two-dimensional coordinate system, and the first line segment and the three line segments are arranged in a direction parallel to the horizontal axis of the preset two-dimensional coordinate system; respectively acquiring coordinate information of each first glue dot contour point constituting the first line segment, and acquiring coordinate information of each second glue dot contour point constituting the third line segment; defining a first glue dot contour point whose height is greater than a preset height threshold as an abnormal first glue dot contour point, defining a first glue dot contour point whose height is not greater than the preset height threshold as a normal first glue dot contour point, and connecting adjacent abnormal first glue dot contour points and adjacent normal first glue dot contour points based on coordinate information of the first glue dot contour points to obtain at least one first sub-line segment; defining a second glue dot contour point whose height is greater than a preset height threshold as an abnormal second glue dot contour point, defining a second glue dot contour point whose height is not greater than the preset height threshold as a normal second glue dot contour point, and connecting adjacent abnormal second glue dot contour points and adjacent normal second glue dot contour points based on coordinate information of the second glue dot contour points to obtain at least one second sub-line segment; The at least one first sub-line segment and the at least one second sub-line segment are respectively sorted based on the coordinate information of the glue point contour point, and a deviation sub-degree between a first sub-line segment and a second sub-line segment with the same serial number is determined, and each deviation sub-degree is superimposed to obtain a first deviation degree between the first line segment and the third line segment, wherein the deviation sub-degree is a difference between a highest point and a lowest point in a first sub-line segment and a second sub-line segment with the same serial number; It is determined whether a first deviation between the first line segment and the third line segment is greater than a preset threshold.
6. The method for identifying dispensing defects based on machine vision according to claim 1, characterized in that: After determining whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold, the method further includes: If the first degree of deviation or the second degree of deviation is greater than a preset threshold, the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image are obtained, and defect recognition is performed on other binary dispensing images in the certain binary dispensing image set to obtain corresponding defect recognition results.
7. The method for identifying dispensing defects based on machine vision according to claim 1, characterized in that: The other binary glue spotting images are binary glue spotting images excluding the first binary glue spotting image and the second binary glue spotting image from the certain binary glue spotting image set; The step of using the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image as defect recognition results of other binary dispensing images in the set of binary dispensing images includes: Synchronously setting the first line segment and the second line segment in the first binary glue dot image in a preset two-dimensional coordinate system to obtain coordinate information of each first glue dot contour point on the first line segment and coordinate information of each first glue dot contour point on the second line segment; Sliding a preset sliding window on the first line segment and the second line segment, and calculating a distance between a first glue dot contour point on the first line segment and a first glue dot contour point on the second line segment in the sliding window to obtain at least one distance value, wherein each time the sliding window slides, the sliding window only includes one first glue dot contour point on the first line segment and one first glue dot contour point on the second line segment; Determine whether the difference between any two distance values is greater than a preset distance threshold; If the distance is greater than a preset threshold, the glue strip in the first binary glue dispensing image is abnormal; otherwise, the glue strip is not abnormal; Another binary glue spotting image whose similarity with the first binary glue spotting image is greater than a preset similarity threshold is obtained from the certain binary glue spotting image set, and the first defect recognition result of the first binary glue spotting image is directly used as the defect recognition result of the another binary glue spotting image.
8. A dispensing defect recognition system based on machine vision, characterized in that: include: an acquisition module configured to acquire an image of at least one workpiece of a dispensing object; a cutting module configured to locate the glue strip area in each workpiece image and cut the glue strip area based on a preset cutting rule to obtain a glue dispensing image corresponding to the at least one glue dispensing object; an association module configured to pre-process each dispensing image to obtain each binary dispensing image, and associate each binary dispensing image according to a preset association strategy to obtain at least one binary dispensing image set; a determination module configured to select a first binary glue spotting image and a second binary glue spotting image from a certain binary glue spotting image set, and determine a first glue spot contour point set in the first binary glue spotting image and a second glue spot contour point set in the second binary glue spotting image, wherein the first binary glue spotting image and the second binary glue spotting image are the two binary glue spotting images with the smallest similarity in the certain binary glue spotting image set; a fitting module configured to obtain a first line segment and a second line segment by fitting each first glue dot contour point in the first glue dot contour point set, and to obtain a third line segment and a fourth line segment by fitting each second glue dot contour point in the second glue dot contour point set, wherein the first line segment and the third line segment are located on one side of a glue dot center, and the second line segment and the fourth line segment are located on the other side of the glue dot center; a judging module configured to judge whether a first degree of deviation between the first line segment and the third line segment, and a second degree of deviation between the second line segment and the fourth line segment are greater than a preset threshold; The identification module is configured to use the first defect recognition result of the first binary dispensing image and the second defect recognition result of the second binary dispensing image as the defect recognition results of other binary dispensing images in the certain binary dispensing image set if the first deviation degree and the second deviation degree are both not greater than a preset threshold value.
9. An electronic device, characterized in that: include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Defect detection method, device and system for functional holes in cover plate of electronic equipment
CN113554582A
Dispensing position error compensation method and device, electronic equipment and storage medium
CN119226686A
Cited By
Visual detection method and system for screw dispensing
CN121883488A
A visual detection method and system for dispensing glue on screws
CN121883488B