A plastic parts spraying control method, system, device and storage medium

By collecting and analyzing the surface images of plastic parts under different lighting conditions, determining the position and offset of the spot, and adjusting the position of the spray gun, the problem of inaccurate alignment of the spray gun in the prior art is solved, and the accuracy and efficiency of spraying are improved.

CN119056612BActive Publication Date: 2025-01-10SHENZHEN XINYUDA PLASTIC MOULD CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411557239.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-01-10
Estimated Expiration
2044-11-04

AI Technical Summary

Technical Problem

In the prior art, the image acquisition method cannot accurately obtain the movement information of the plastic part, making it difficult for the spray gun to accurately align the surface of the plastic part, affecting the accuracy of the spray coating.

Method used

By collecting the surface image of the plastic part under predetermined lighting conditions, dividing it into different light and dark ranges, finding the center coordinates of the largest light spot in the area, and calculating the offset of the spray gun based on its position, adjusting the position of the spray gun to align the surface of the plastic part.

Benefits of technology

Improves the accuracy and accuracy of spray coating to ensure that the paint evenly covers the surface of the plastic parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119056612B_ABST
    Figure CN119056612B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of automatic control technology, and discloses a method, system, device and storage medium for spraying control of plastic parts. The method comprises obtaining an initial image of a surface image of a plastic part to be sprayed collected under predetermined conditions; dividing the initial image into different brightness intervals; finding a target interval according to the area of ​​the light spot in different brightness intervals; determining the center coordinates of the light spot with the largest area in the target interval; finding the position of the light spot with the largest area in a preset image according to the center coordinates of the light spot with the largest area; calculating the offset between the position of the light spot with the largest area in the preset image and the center of the preset image according to the position of the light spot with the largest area in the preset image; adjusting the position of the spray gun based on the offset so that the spray gun is aimed at the surface of the plastic part to be sprayed. The method accurately determines the position of the spray target by analyzing the light spot in the initial image, thereby improving the accuracy of spraying.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automatic control technology, and in particular to a plastic part spraying control method, system, device and storage medium. Background Art

[0002] Workpiece spraying technology is widely used in the field of industrial manufacturing, especially in the surface treatment of plastic parts.

[0003] At present, the commonly used spraying method is mainly robot spray gun, which is an intelligent and automated spraying equipment. The distance between the robot spray gun and the surface of the plastic part is maintained between 0.3 and 0.7 meters. According to the change of the spot position in the collected image of the surface of the plastic part, the position information of the plastic part during the spraying process is determined. According to the position information, the drive motor drives the spray gun to follow the movement of the plastic part, so that the spray gun is aimed at the workpiece, the spraying operation is completed, and the paint covers the surface of the workpiece.

[0004] However, since the image acquisition method in the prior art cannot accurately obtain the movement information of the plastic part, it is impossible to accurately align the spray gun and the surface of the plastic part. Summary of the invention

[0005] The invention provides a plastic part spraying control method to realize the precise spraying of the plastic part.

[0006] In a first aspect, in order to solve the above technical problems, the present invention provides a plastic part spraying control method, which is executed by a controller and includes:

[0007] Acquire an initial image of a surface image of a plastic part to be sprayed collected under predetermined conditions;

[0008] Wherein, the predetermined conditions include: a first predetermined lighting condition and a second predetermined lighting condition, the light intensity under the first predetermined lighting condition is less than the light intensity under the second predetermined lighting condition;

[0009] Dividing the initial image into different brightness intervals;

[0010] Find the target interval according to the spot area in different brightness intervals;

[0011] In the target interval, determining the coordinates of the center of the light spot with the largest area;

[0012] According to the coordinates of the center of the light spot with the largest area, searching for the position of the light spot with the largest area in the preset image;

[0013] According to the position of the light spot with the largest area in the preset image, calculating the offset between the position of the light spot with the largest area in the preset image and the center of the preset image;

[0014] Based on the offset, the position of the spray gun is adjusted so that the spray gun is aimed at the surface of the plastic part to be sprayed.

[0015] Preferably, the step of acquiring an initial image of a surface image of a plastic part to be sprayed collected under predetermined conditions comprises:

[0016] Under the first predetermined lighting condition, acquiring a first image of the surface image;

[0017] Under the second predetermined lighting condition, acquiring a second image of the surface image;

[0018] Determining an initial image of the surface image of the plastic part to be sprayed based on the first image and the second image;

[0019] The surface image is collected when the plastic part is in a stationary state.

[0020] Preferably, determining the initial image of the surface image of the plastic part to be sprayed based on the first image and the second image includes:

[0021] Converting the first image and the second image into grayscale images;

[0022] Calculating a grayscale value difference of corresponding pixels according to a grayscale image corresponding to the first image and a grayscale image corresponding to the second image;

[0023] According to the pixel gray value difference, pixel points on the surface of the plastic part are identified;

[0024] An initial image is determined according to the pixel points on the surface of the plastic part.

[0025] Preferably, the step of resolving pixel points on the surface of the plastic part according to the pixel gray value difference comprises:

[0026] Compare the pixel grayscale value difference with a preset threshold to obtain a pixel grayscale value difference comparison result;

[0027] According to the pixel gray value difference comparison result, the pixel points on the surface of the plastic part are obtained.

[0028] Preferably, finding the target interval according to the spot areas in different brightness intervals includes:

[0029] Calculate the area of ​​each light spot;

[0030] According to the light spot area, selecting the light spot with the largest area;

[0031] According to the position of the light spot with the largest area, a rectangular area corresponding to the light spot with the largest area is determined as the target interval.

[0032] Preferably, determining the coordinates of the center of the light spot with the largest area in the target interval includes:

[0033] Selecting two characteristic diagonal points located in a diagonal direction in the target interval;

[0034] Determine whether the edges where the characteristic diagonal points are located are adjacent;

[0035] If the sides where the characteristic diagonal points are located are not adjacent, a circle is made with the two characteristic diagonal points as the diameter, and the circle with the smallest area is the area where the light spot is located;

[0036] The coordinates of the center of the light spot with the largest area are determined according to the circle with the smallest area.

[0037] Preferably, determining the coordinates of the center of the light spot with the largest area in the target interval further includes:

[0038] Selecting two characteristic diagonal points located in a diagonal direction in the target interval;

[0039] Determine whether the edges where the characteristic diagonal points are located are adjacent;

[0040] If the edges where the diagonal points of the feature are located are adjacent, according to the judgment condition

[0041]

[0042] Obtaining a first judgment result and a second judgment result; wherein the first judgment result represents that the judgment condition is met, and the second judgment result represents that the judgment condition is not met;

[0043] According to the judgment result, determining the coordinates of the center of the light spot with the largest area;

[0044] in, Indicates The length of the adjacent edge of the root edge, Indicates the The intersection point between the root edge and the adjacent edge is the abscissa length of the endpoint, Indicates the The intersection point between the root edge and the adjacent edge is the ordinate length of the endpoint, Represents the angle between adjacent sides and the abscissa axis.

[0045] Preferably, determining the coordinates of the center of the largest spot according to the judgment result includes:

[0046] If it is the first judgment result, according to the The circle with the smallest area on the root edge determines the area where the light spot is located, and the coordinates of the center of the light spot with the largest area are obtained;

[0047] If it is the second judgment result, according to The root side and the adjacent side are used to calculate the equations of the two lines where the adjacent sides are located;

[0048] According to the equations of the two straight lines, the coordinates of the intersection of the two straight lines are calculated, wherein the coordinates of the intersection include the first coordinates of the intersection and the second coordinates of the intersection;

[0049] The area where the light spot is located is determined based on the first intersection point coordinates and the second intersection point coordinates, and the center coordinates of the light spot with the largest area are obtained.

[0050] In a second aspect, the present invention provides a plastic parts spraying control system, comprising:

[0051] An image acquisition module, which acquires an initial image of a surface image of a plastic part to be sprayed, acquired under predetermined conditions;

[0052] A brightness division module, dividing the initial image into different brightness intervals;

[0053] The target interval module finds the target interval according to the spot area in different brightness intervals;

[0054] A light spot center module determines the center coordinates of the light spot with the largest area in the target interval;

[0055] A position matching module, which searches for the position of the light spot with the largest area in a preset image according to the coordinates of the center of the light spot with the largest area;

[0056] an offset calculation module, which calculates the offset between the position of the light spot with the largest area in the preset image and the center of the preset image according to the position of the light spot with the largest area in the preset image;

[0057] The spray gun adjustment module adjusts the position of the spray gun based on the offset so that the spray gun is aligned with the surface of the plastic part to be sprayed.

[0058] In a third aspect, the present invention further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements any one of the above-mentioned methods for controlling spraying of plastic parts when executing the computer program.

[0059] In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned plastic parts spraying control methods.

[0060] Compared with the prior art, the present invention has the following beneficial effects: the present invention relates to the field of automatic control technology, and discloses a plastic part spraying control method, system, device and storage medium, wherein the method is executed by a processor, and includes obtaining an initial image of a surface image of a plastic part to be sprayed collected under predetermined conditions; wherein the predetermined conditions include: a first predetermined lighting condition and a second predetermined lighting condition, and the light intensity under the first predetermined lighting condition is less than the light intensity under the second predetermined lighting condition; dividing the initial image into different brightness intervals; finding a target interval according to the area of ​​the light spot in different brightness intervals; in the target interval, determining the center coordinates of the light spot with the largest area; finding the position of the light spot with the largest area in a preset image according to the center coordinates of the light spot with the largest area; calculating the offset between the position of the light spot with the largest area in the preset image and the center of the preset image according to the position of the light spot with the largest area in the preset image; based on the offset, adjusting the position of the spray gun so that the spray gun is aimed at the surface of the plastic part to be sprayed.

[0061] This method accurately determines the position of the spraying target by analyzing the light spot in the initial image, thereby improving the accuracy of spraying. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 It is a schematic flow chart of a plastic parts spraying control method provided by the first embodiment of the present invention;

[0063] Figure 2 It is a structural schematic diagram of a plastic parts spraying control system provided by the first embodiment of the present invention. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0065] Reference Figure 1 The first embodiment of the present invention provides a method for controlling spraying of plastic parts, comprising the following steps:

[0066] S11, obtaining an initial image of the surface image of the plastic part to be sprayed collected under predetermined conditions;

[0067] S12, dividing the initial image into different brightness intervals;

[0068] S13, finding the target interval according to the spot area in different brightness intervals;

[0069] S14, determining the coordinates of the center of the light spot with the largest area in the target interval;

[0070] S15, searching for a position of the light spot with the largest area in a preset image according to the coordinates of the center of the light spot with the largest area;

[0071] S16, calculating, according to the position of the light spot with the largest area in the preset image, an offset between the position of the light spot with the largest area in the preset image and the center of the preset image;

[0072] S17, based on the offset, adjusting the position of the spray gun so that the spray gun is aligned with the surface of the plastic part to be sprayed.

[0073] In step S11, an initial image of the surface image of the plastic part to be sprayed is acquired under predetermined conditions;

[0074] In one embodiment, the method of obtaining an initial image of the surface image of the plastic part to be sprayed, which is captured under predetermined conditions, includes: capturing a first image of the surface image under the first predetermined lighting conditions; capturing a second image of the surface image under the second predetermined lighting conditions; determining the initial image of the surface image of the plastic part to be sprayed based on the first image and the second image; wherein the surface image is captured when the plastic part is in a stationary state.

[0075] In an optional embodiment, the encoded first image and the second image of the plastic part to be sprayed are received and sent by a camera, and the encoded first image and the second image of the plastic part to be sprayed are decoded to obtain a current surface image corresponding to the plastic part to be sprayed; wherein the camera captures the first image and the second image of the plastic part to be sprayed, encodes the first image and the second image of the plastic part to be sprayed, and transmits the encoded first image and the second image to the processor.

[0076] In an optional embodiment, the first image and the second image of the plastic part to be sprayed are received and encoded by the camera, and the first image and the second image of the plastic part to be sprayed are decoded, including: data acquisition, the camera first collects the data of the surface image of the plastic part to be sprayed through its detection unit; signal conditioning, the collected raw data is often an analog signal, which needs to be converted into a digital signal through an analog-to-digital converter (ADC). Analog signal conditioning includes steps such as amplification and filtering to ensure the quality and accuracy of the signal; data encoding, the digital signal needs to be encoded into a specific format for transmission; data transmission, the encoded data is transmitted to the processor through the communication interface; data reception and decoding, after the processor receives the data transmitted by the camera, it needs to decode and convert the encoded data back to the original digital signal or analog signal for further processing and analysis.

[0077] It should be noted that the encoding methods include: digital encoding, converting the numerical value of an analog signal into a digital code, such as binary or hexadecimal; pulse code modulation (PCM), converting the time waveform of an analog signal into a series of pulses, each pulse representing a specific signal value; modulation coding, modulating a digital signal into a format suitable for wireless or wired transmission, such as frequency modulation (FM) or phase modulation (PM).

[0078] Furthermore, the communication interface includes: serial communication, such as RS-232, RS-485, I2C, SPI, etc., which is suitable for short-distance, low-speed data transmission; parallel communication, such as PCI, USB, etc., which is suitable for high-speed, large-capacity data transmission; wireless communication, such as Wi-Fi, Bluetooth, Zigbee, etc., which is suitable for long-distance, flexible deployment scenarios.

[0079] In order to obtain an initial image of the surface image of the plastic part to be sprayed under predetermined conditions, two implementation methods are provided below:

[0080] In an optional embodiment, the processor acquires the first image and the second image of the plastic part to be sprayed detected by the camera, including:

[0081] The processor searches for Bluetooth devices to match and establish a Bluetooth connection with the camera. In this step, the processor's Bluetooth management software lists all detectable Bluetooth devices. The user needs to select the corresponding camera from the list and may need to enter a pairing code or go through other security authentication processes to complete the pairing.

[0082] After the pairing is successful, the processor sends a data acquisition instruction to the camera through the Bluetooth interface. This instruction is a specific signal or data sequence, which instructs the camera to start performing the data acquisition task;

[0083] After receiving the command, the camera activates its built-in data acquisition system to shoot the surface of the plastic part to be sprayed. The collected raw data is then processed and encoded inside the camera to form a structured Bluetooth data packet. This data packet follows the Bluetooth communication protocol to ensure the integrity and correctness of the data during transmission.

[0084] After the encoding is completed, the camera uses Bluetooth wireless technology to send the data packet to the processor. After the Bluetooth receiving module of the processor receives the data packet, it performs a decoding operation to parse out the first image and the second image of the plastic part to be sprayed in the data packet. The decoding process includes verifying the integrity of the data packet, performing error detection and verification, and extracting useful data content.

[0085] During the entire process, communication stability and data accuracy are crucial, and software settings are required to optimize the data transmission rate and retransmission mechanism to ensure the reliability of data transmission.

[0086] In an optional embodiment, the initial image of the surface image of the plastic part to be sprayed collected under predetermined conditions is obtained by:

[0087] The camera establishes a communication connection with the processor through the RS-232 serial interface. In this process, it is first necessary to ensure that the RS-232 ports of the camera and the processor are correctly connected, and configure the corresponding communication parameters, such as baud rate, data bits, stop bits, and parity bits, to match the communication settings of both parties. Once the communication settings are completed, the processor sends a data acquisition signal instruction to the camera through the RS-232 interface. This instruction is a specific data sequence used to indicate that the camera starts the data acquisition process. After receiving the instruction, the camera activates the internal data acquisition mechanism and starts measuring the first image and the second image of the plastic part to be sprayed. The collected data is then encoded inside the camera and constructed into a data packet that conforms to the communication protocol. This data packet includes a start bit, data content, check bit, and stop bit to ensure the integrity and correctness of the data. After the encoding is completed, the camera sends the data packet back to the processor through the RS-232 bus. After the RS-232 interface of the processor receives the data packet from the camera, it performs decoding processing. The decoding process involves checking the structure of the data packet, performing error detection and verification, and then extracting the actual first image and second image data of the plastic part to be sprayed.

[0088] The entire communication process requires precise time synchronization and data synchronization to ensure data accuracy and reliability; in addition, in order to improve the stability and anti-interference ability of communication, some additional measures will be taken, such as using shielded cables, signal boosters and error retransmission mechanisms.

[0089] In one embodiment, determining the initial image of the surface image of the plastic part to be sprayed based on the first image and the second image includes: converting the first image and the second image into grayscale images; calculating the pixel grayscale value difference of corresponding pixel points according to the grayscale image corresponding to the first image and the grayscale image corresponding to the second image; resolving the pixel points on the surface of the plastic part according to the pixel grayscale value difference; and determining the initial image according to the pixel points on the surface of the plastic part.

[0090] In one embodiment, the pixel points on the surface of the plastic part are resolved based on the pixel grayscale value difference, including: comparing the pixel grayscale value difference with a preset threshold to obtain a pixel grayscale value difference comparison result; and obtaining the pixel points on the surface of the plastic part based on the pixel grayscale value difference comparison result.

[0091] Optionally, the pixel points on the surface of the plastic part are distinguished based on the pixel grayscale value difference, including: the grayscale value difference is a grayscale difference obtained by subtracting the grayscale values ​​of the corresponding pixel points in the grayscale image corresponding to the first image and the grayscale image corresponding to the second image; if the grayscale difference is less than a preset threshold, the pixel point is determined to be a point on the surface of the plastic part to be sprayed.

[0092] It should be noted that under the first predetermined lighting condition, the light intensity is relatively weak. The first image of the surface image collected under this condition can capture some basic features of the surface of the plastic part, but is not enough to highlight all the details. Compared with the first predetermined lighting condition, the second predetermined lighting condition has a stronger light intensity. The second image of the surface image collected under this condition can more clearly capture the subtle features of the surface of the plastic part, including surface bumps, texture, etc.

[0093] In step S12, the initial image is divided into different brightness intervals.

[0094] In one embodiment, a first division point and a second division point are selected in the initial image along a first direction, and a third division point and a fourth division point are selected in the initial image along the second direction; the first division point, the second division point, the third division point and the fourth division point determine a first rectangular area; the grayscale average of the pixels on the four sides of the first rectangular area is calculated; the brightness range of each side is determined according to the grayscale average of the pixels on the four sides; the first direction is perpendicular to the second direction.

[0095] It should be noted that the significance and advantages of this implementation in image processing are mainly reflected in the detailed analysis and feature extraction of image areas. By selecting division points along the first and second directions, the initial image can be divided into precise rectangular areas, and this process helps to identify local features. Calculating the average grayscale of the pixels on the four sides of the rectangular area makes the understanding of edge features more in-depth and helps to identify different brightness intervals. This analysis not only improves the accuracy of image processing, but also provides an important data basis for subsequent image analysis. Since the first direction is perpendicular to the second direction, this method can effectively capture the structural features in the image, thereby enhancing the understanding of the image content. In addition, this interval division method based on edge grayscale has good adaptability and can be widely used in different types of image processing tasks, improving overall processing efficiency and effect. By systematically analyzing the local features of the image, this method provides a reliable basis for subsequent image recognition and processing, and promotes the progress of related applications.

[0096] In step S13, the target interval is found according to the light spot areas in different brightness intervals.

[0097] In one embodiment, finding the target interval according to the spot areas in different brightness intervals includes: calculating the area of ​​each spot; selecting the spot with the largest area according to the spot areas; and determining the rectangular area corresponding to the spot with the largest area as the target interval according to the position of the spot with the largest area.

[0098] In one implementation, calculating the area of ​​each light spot includes:

[0099] Contour detection, in the contour detection stage, the extracted light spots need to be analyzed first; using a specialized image processing algorithm, the boundaries of each light spot are detected; this process usually involves thresholding the light spot image to enhance its contour; next, the algorithm will identify the edges of the light spot to form a closed shape; each contour will be marked and stored for subsequent processing; during the detection process, it is ensured that the outer contour of each light spot can be extracted without being affected by other interfering areas; finally, all contour points will be collected into a list for use in subsequent steps;

[0100] Area calculation: In the area calculation stage, a geometric method is used to determine the area of ​​each spot contour. First, each boundary point of the contour needs to be identified, which defines the shape of the spot. By analyzing the positional relationship of these boundary points, the total area of ​​the spot is calculated using an appropriate geometric formula. This may include a systematic evaluation of the contour points of the spot contour to ensure that all parts are taken into account. Ultimately, the calculation result will provide a specific area value for each spot as a basis for subsequent comparisons.

[0101] Storing the spot area, in the step of storing the spot area, create a structure to save the area information of each spot; this can be a simple list, in which each entry contains the area of ​​the spot and its corresponding identifier. At this time, it should be ensured that the area of ​​each spot corresponds to its position in the image, which is convenient for subsequent processing and comparison; this structure will provide the necessary data support for finding the largest spot later, ensuring that all area data is accurately recorded to avoid omissions.

[0102] It should be noted that this implementation has multiple advantages in the process of calculating the area of ​​each light spot. First, the contour detection stage ensures that the boundary of the light spot can be accurately extracted to form a closed shape by applying a special image processing algorithm. This process uses threshold processing to enhance the visibility of the light spot, effectively filters the background noise, reduces the influence of other interference areas, and ensures the reliability of the extraction results. Secondly, the area calculation adopts a geometric method, based on the systematic evaluation of the contour boundary points, so that the area calculation of each light spot is more accurate. This method not only takes into account the shape complexity of the light spot, but also adapts to different light spot characteristics and provides a more accurate area value. Furthermore, the structure for storing the light spot area is reasonably designed, and the area of ​​each light spot and its corresponding identifier are recorded in a simple list, which is convenient for subsequent processing and comparison. This data organization method not only simplifies the access and management of information, but also provides the necessary data support for the subsequent search for the largest light spot, ensuring the accurate recording of all area data. In addition, this method has good scalability and can adapt to the needs of light spot detection and area calculation in different application scenarios, thereby improving the flexibility and applicability of the system. In general, this method improves the accuracy and efficiency of spot analysis through precise contour detection, reasonable area calculation and effective data storage, laying a solid foundation for subsequent image processing and analysis.

[0103] In one implementation, selecting the light spot with the largest area according to the light spot area includes:

[0104] First, initialize a variable to track the current maximum area found, and set an identifier to point to the light spot; next, traverse the previously stored light spot area list, and compare the area of ​​each light spot with the current maximum area one by one; if it is found that the area of ​​a light spot is larger than the current maximum value, update the maximum area and its corresponding light spot identifier; after traversal, the final maximum area and its identifier will provide a basis for the subsequent determination of the target interval, ensuring that the light spot with the largest area can be accurately found; through this process, the light spots that are most important for subsequent analysis can be effectively screened out.

[0105] It should be noted that this implementation has obvious advantages in the process of selecting the light spot with the largest area. First, by initializing the maximum area variable and identifier, the clarity and efficiency of the comparison process are ensured, making the search logic simple and clear. When traversing the light spot area list, the method of comparing the areas one by one is not only intuitive, but also easy to implement, and can quickly identify the largest light spot. This process avoids complex calculations and reduces the risk of errors. At the same time, by updating the maximum area and its corresponding identifier, the optimal result can be tracked and recorded in real time, providing an accurate basis for subsequent analysis. In addition, this method has good scalability and can adapt to light spot data of different sizes, ensuring that the most important light spots can be effectively screened out in various scenarios, thereby improving the accuracy and efficiency of the overall analysis.

[0106] In step S14, the coordinates of the center of the light spot with the largest area in the target interval are determined.

[0107] In one embodiment, determining the center coordinates of the light spot with the largest area in the target interval includes: selecting two characteristic diagonal points located in a diagonal direction in the target interval; judging whether the sides where the characteristic diagonal points are located are adjacent; if the sides where the characteristic diagonal points are located are not adjacent, making a circle with the two characteristic diagonal points as diameters, and the circle with the smallest area is the area where the light spot is located; and determining the center coordinates of the light spot with the largest area based on the circle with the smallest area.

[0108] In one embodiment, determining the coordinates of the center of the light spot with the largest area in the target interval further includes: selecting two characteristic diagonal points located in a diagonal direction in the target interval;

[0109] Determine whether the edges where the characteristic diagonal points are located are adjacent; if the edges where the characteristic diagonal points are located are adjacent, according to the determination conditions:

[0110]

[0111] A first judgment result and a second judgment result are obtained; wherein the first judgment result represents that the judgment condition is met, and the second judgment result represents that the judgment condition is not met; according to the judgment result, the coordinates of the center of the largest spot are determined; wherein, Indicates The length of the adjacent edge of the root edge, Indicates the The intersection point between the root edge and the adjacent edge is the abscissa length of the endpoint, Indicates the The intersection point between the root edge and the adjacent edge is the ordinate length of the endpoint, Represents the angle between adjacent sides and the abscissa axis.

[0112] In one embodiment, the step of determining the center coordinates of the largest spot according to the judgment result includes: if it is the first judgment result, The circle with the smallest area on the root edge determines the area where the light spot is located, and the coordinates of the center of the light spot with the largest area are obtained; if it is the second judgment result, according to the The root edge and the adjacent edge are used to calculate the equations of the two straight lines where the adjacent edges are located; based on the equations of the two straight lines, the coordinates of the intersection of the two straight lines are calculated, and the coordinates of the intersection include the first intersection coordinates and the second intersection coordinates; based on the first intersection coordinates and the second intersection coordinates, the area where the light spot is located is determined to obtain the coordinates of the center of the light spot with the largest area.

[0113] It should be noted that this method of finding the coordinates of the center of the light spot with the largest area has several significant advantages. First, the geometric intuitiveness of the method allows users to understand the shape and position of the light spot more clearly. In the process of selecting the characteristic diagonal points, users can intuitively see how these points affect the formation of the light spot. This intuitiveness not only helps to clarify the design and implementation process, but also reduces the difficulty of understanding. Secondly, accuracy is another important advantage of this method. By judging the adjacency of the edges where the characteristic diagonal points are located, the method can accurately calculate the area of ​​the light spot, thereby avoiding errors caused by unclear boundary conditions. This accuracy is particularly critical for application scenarios that require high reliability. The flexibility of the method cannot be ignored. It can be applied to target intervals of different shapes and sizes, whether in simple rectangular intervals or complex polygonal intervals. This flexibility makes the method effective in a variety of environments. In addition, the method also performs well in computational efficiency. Especially in the case of dealing with adjacent edges, by constructing straight line equations and calculating intersections, the light spot area can be efficiently defined, reducing unnecessary calculation steps, thereby improving overall efficiency. Furthermore, this method has a wide range of applicability. In addition to being used for the calculation of light spots, it can also be extended to image processing, computer vision and other fields, and has broad application prospects. In the context of the rapid development of modern technology, algorithms that can adapt to a variety of needs are undoubtedly more valuable. Finally, this method effectively reduces the complexity of calculations by combining geometric properties and simple mathematical operations. By using intuitive geometric relationships and simple algebraic operations, the dependence on complex algorithms is reduced, making the implementation and debugging process easier, especially suitable for rapid development and prototyping. These advantages together constitute the competitiveness of this method in practical applications, making it an efficient and reliable solution that can meet the needs of complex environments. Overall, this method not only has advantages in theory, but also shows its strong practicality and flexibility in practical applications.

[0114] In step S16, according to the position of the light spot with the largest area in the preset image, the offset between the position of the light spot with the largest area in the preset image and the center of the preset image is calculated.

[0115] In one embodiment, the method of calculating the offset between the position of the light spot with the largest area in the preset image and the center of the preset image based on the position of the light spot with the largest area in the preset image includes: obtaining the center coordinates of the preset image, wherein the center coordinates of the preset image are calculated by the image width and height; calculating the offset between the center of the light spot and the center of the preset image, and calculating the horizontal and vertical axis offsets respectively; organizing the calculated offsets into an offset vector; and confirming whether the calculated offsets are within a preset reasonable range to ensure the effectiveness and safety of subsequent adjustments.

[0116] It should be noted that the significance and advantages of this implementation in image analysis and processing are mainly reflected in the precise control of the spot position and the effectiveness of subsequent operations. By first obtaining the center coordinates of the preset image, it can be ensured that the calculation of the spot position is based on an accurate benchmark, which provides an important basis for subsequent analysis. Calculating the offset between the center of the spot and the center of the image, especially considering the offset of the horizontal axis and the vertical axis respectively, helps to fully understand the relative position of the spot in the image. This meticulous calculation not only enhances the understanding of the spot distribution, but also provides a basis for adjusting the device or algorithm, thereby improving the accuracy of the operation. In addition, the offset is organized into a vector form, which is convenient for rapid application in subsequent processing and improves processing efficiency. Confirming whether the offset is within a preset reasonable range is an important measure to ensure that subsequent adjustments are safe and effective, which helps to prevent unexpected situations and improve the stability and reliability of the system. In general, this implementation lays a solid foundation for subsequent image processing and analysis through systematic calculation and reasonable range confirmation, and enhances the overall processing effect.

[0117] In step S17, based on the offset, the position of the spray gun is adjusted so that the spray gun is aligned with the surface of the plastic part to be sprayed.

[0118] In an optional embodiment, adjusting the position of the spray gun based on the offset so that the spray gun is aimed at the surface of the plastic part to be sprayed includes:

[0119] Get the current coordinates of the spray gun and record the current position of the spray gun, including its three-dimensional coordinates (X1, Y1, Z1);

[0120] Determine the target coordinates and calculate the target coordinates (X2, Y2, Z2) based on the position and offset of the largest spot in the preset image.

[0121] Set the movement parameters and determine the speed and acceleration of the spray gun to ensure the smoothness of the movement process;

[0122] Move the spray gun to the target position, use the robot arm or spray gun adjustment system to move the spray gun according to the calculated target coordinates, first move ΔX along the X-axis, then move ΔY along the Y-axis, and if necessary, make fine adjustments along the Z-axis to ensure that the spray gun is at the appropriate height;

[0123] Real-time feedback monitoring, during the movement process, the position sensor is used to monitor the spray gun position in real time, compare the current spray gun position with the target position, and make fine adjustments when necessary to ensure accurate alignment;

[0124] Fine alignment: when the spray gun approaches the target position, reduce the moving speed for fine adjustment, and use a visual system or laser alignment tool to confirm whether the spray gun nozzle is accurately aligned with the surface of the plastic part to be sprayed;

[0125] Confirm the alignment status, ensure that the distance between the nozzle and the surface to be sprayed meets the spraying requirements, and make fine adjustments if necessary;

[0126] Prepare to spray. Once you confirm that the spray gun is aligned correctly, start the spray equipment and prepare for the spraying operation.

[0127] It should be noted that the significance and advantages of the implementation method of adjusting the position of the spray gun in the spraying process are mainly reflected in improving the accuracy and efficiency of spraying. First, by obtaining the current position of the spray gun and calculating the target coordinates, it is possible to ensure that the spray gun is sprayed at the correct position, thereby reducing the risk of uneven or missing coatings. Setting reasonable movement parameters, such as speed and acceleration, helps to ensure the smoothness of the spray gun movement process and avoid equipment vibration or spraying errors caused by rapid movement. In addition, the process of real-time feedback monitoring and fine alignment, using sensors and visual systems, can quickly respond to any deviations to ensure that the spray gun always remains in the correct spraying position. This method significantly improves the accuracy of spraying and ensures the consistency of spraying quality. Confirming the appropriate distance between the nozzle and the surface to be sprayed is a key link in achieving the best spraying effect and avoiding coating defects caused by improper distance. Finally, after integrating these steps, this method not only improves the safety and stability of the spraying operation, but also significantly improves the overall efficiency of the spraying operation, adapts to the needs of industrial automation and high-quality spraying, and has broad application prospects.

[0128] The present invention relates to the field of automatic control technology, and discloses a method, system, device and storage medium for spraying control of plastic parts. The method is executed by a processor, including obtaining an initial image of a surface image of a plastic part to be sprayed collected under predetermined conditions; dividing the initial image into different brightness intervals; finding a target interval according to the area of ​​the light spot in different brightness intervals; determining the center coordinates of the light spot with the largest area in the target interval; finding the position of the light spot with the largest area in a preset image according to the center coordinates of the light spot with the largest area; calculating the offset between the position of the light spot with the largest area in the preset image and the center of the preset image according to the position of the light spot with the largest area in the preset image; adjusting the position of the spray gun based on the offset so that the spray gun is aimed at the surface of the plastic part to be sprayed. The method accurately determines the position of the spray target by analyzing the light spot in the initial image, thereby improving the accuracy of spraying.

[0129] The second embodiment of the present invention provides a plastic parts spraying control system, comprising:

[0130] An image acquisition module, which acquires an initial image of a surface image of a plastic part to be sprayed, acquired under predetermined conditions;

[0131] A brightness division module, dividing the initial image into different brightness intervals;

[0132] The target interval module finds the target interval according to the spot area in different brightness intervals;

[0133] A light spot center module determines the center coordinates of the light spot with the largest area in the target interval;

[0134] A position matching module, which searches for the position of the light spot with the largest area in a preset image according to the coordinates of the center of the light spot with the largest area;

[0135] an offset calculation module, which calculates the offset between the position of the light spot with the largest area in the preset image and the center of the preset image according to the position of the light spot with the largest area in the preset image;

[0136] The spray gun adjustment module adjusts the position of the spray gun based on the offset so that the spray gun is aligned with the surface of the plastic part to be sprayed.

[0137] It should be noted that a plastic parts spraying control system provided in an embodiment of the present invention is used to execute all process steps of a plastic parts spraying control method in the above embodiment, and the working principles and beneficial effects of the two correspond one to one, so they will not be repeated.

[0138] The embodiment of the present invention further provides an electronic device. The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a ... program. When the processor executes the computer program, the steps in the above-mentioned plastic part spraying control method embodiments are implemented, such as Figure 1 Alternatively, when the processor executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are realized, such as the image acquisition module.

[0139] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the electronic device.

[0140] The electronic device may be a computing device such as a desktop computer, a notebook, a PDA, and a smart tablet. The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. The electronic device may include more or fewer components than the above components, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0141] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device.

[0142] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the electronic device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0143] Wherein, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0144] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0145] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for controlling spraying of plastic parts, characterized in that: Executed by the controller, including: Acquire an initial image of a surface image of a plastic part to be sprayed collected under predetermined conditions; Wherein, the predetermined conditions include: a first predetermined lighting condition and a second predetermined lighting condition, the light intensity under the first predetermined lighting condition is less than the light intensity under the second predetermined lighting condition; Dividing the initial image into different brightness intervals; Find the target interval according to the spot area in different brightness intervals; In the target interval, determining the coordinates of the center of the light spot with the largest area; According to the coordinates of the center of the light spot with the largest area, searching for the position of the light spot with the largest area in the preset image; According to the position of the light spot with the largest area in the preset image, calculating the offset between the position of the light spot with the largest area in the preset image and the center of the preset image; Based on the offset, adjusting the position of the spray gun so that the spray gun is aimed at the surface of the plastic part to be sprayed; Wherein, determining the coordinates of the center of the light spot with the largest area in the target interval includes: Selecting two characteristic diagonal points located in a diagonal direction in the target interval; Determine whether the edges where the characteristic diagonal points are located are adjacent; If the sides where the characteristic diagonal points are located are not adjacent, a circle is made with the two characteristic diagonal points as the diameter, and the circle with the smallest area is the area where the light spot is located; Determine the center coordinates of the light spot with the largest area according to the circle with the smallest area; If the edges where the diagonal points of the feature are located are adjacent, according to the judgment condition Obtaining a first judgment result and a second judgment result; wherein the first judgment result represents that the judgment condition is met, and the second judgment result represents that the judgment condition is not met; According to the judgment result, determining the coordinates of the center of the light spot with the largest area; If it is the first judgment result, according to the The circle with the smallest area on the root edge determines the area where the light spot is located, and the coordinates of the center of the light spot with the largest area are obtained; If it is the second judgment result, according to The root side and the adjacent side are used to calculate the equations of the two lines where the adjacent sides are located; According to the equations of the two straight lines, the coordinates of the intersection of the two straight lines are calculated, wherein the coordinates of the intersection include the first coordinates of the intersection and the second coordinates of the intersection; Determine the area where the light spot is located based on the first intersection point coordinates and the second intersection point coordinates, and obtain the center coordinates of the light spot with the largest area; in, Indicates The length of the adjacent edge of the root edge, Indicates the The intersection point between the root edge and the adjacent edge is the abscissa length of the endpoint, Indicates the The intersection point between the root edge and the adjacent edge is the ordinate length of the endpoint, Represents the angle between adjacent sides and the abscissa axis.

2. A method for controlling spraying of plastic parts according to claim 1, characterized in that: The step of obtaining an initial image of the surface image of the plastic part to be sprayed collected under predetermined conditions includes: Under the first predetermined lighting condition, acquiring a first image of the surface image; Under the second predetermined lighting condition, collecting a second image of the surface image; Determining an initial image of the surface image of the plastic part to be sprayed based on the first image and the second image; The surface image is collected when the plastic part is in a stationary state.

3. A method for controlling spraying of plastic parts according to claim 2, characterized in that: The step of determining an initial image of the surface image of the plastic part to be sprayed based on the first image and the second image includes: Converting the first image and the second image into grayscale images; Calculating a grayscale value difference of corresponding pixels according to a grayscale image corresponding to the first image and a grayscale image corresponding to the second image; According to the pixel gray value difference, pixel points on the surface of the plastic part are identified; An initial image is determined according to the pixel points on the surface of the plastic part.

4. A method for controlling spraying of plastic parts according to claim 3, characterized in that: The step of resolving pixel points on the surface of the plastic part according to the pixel grayscale value difference comprises: Compare the pixel grayscale value difference with a preset threshold to obtain a pixel grayscale value difference comparison result; According to the pixel gray value difference comparison result, the pixel points on the surface of the plastic part are obtained.

5. A method for controlling spraying of plastic parts according to claim 1, characterized in that: The step of finding the target interval according to the spot area in different brightness intervals includes: Calculate the area of ​​each light spot; According to the light spot area, selecting the light spot with the largest area; According to the position of the light spot with the largest area, a rectangular area corresponding to the light spot with the largest area is determined as the target interval.

6. A plastic parts spraying control system, characterized in that: A method for controlling spraying of plastic parts according to any one of claims 1 to 5, comprising: An image acquisition module, which acquires an initial image of a surface image of a plastic part to be sprayed, acquired under predetermined conditions; A brightness division module, dividing the initial image into different brightness intervals; The target interval module finds the target interval according to the spot area in different brightness intervals; A light spot center module, which determines the center coordinates of the light spot with the largest area in the target interval; A position matching module, which searches for the position of the light spot with the largest area in a preset image according to the coordinates of the center of the light spot with the largest area; an offset calculation module, which calculates the offset between the position of the light spot with the largest area in the preset image and the center of the preset image according to the position of the light spot with the largest area in the preset image; The spray gun adjustment module adjusts the position of the spray gun based on the offset so that the spray gun is aligned with the surface of the plastic part to be sprayed.

7. An electronic device, characterized in that: It comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements the plastic part spraying control method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Laser spot center coordinate determination method and device, and equipment

    CN111811784A

  • Detection method and detection system

    CN115876795A