Vacuum cup automatic alignment marking method and system based on vision
By using multi-frame image acquisition and rotation compensation technology, combined with checkerboard calibration and template matching, the problems of unstable cup body alignment, cup bottom distortion, and insufficient adaptive logo orientation in the automatic marking equipment for thermos cups have been solved, realizing a high-precision and flexible automatic marking process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-10
Smart Images

Figure CN121837581A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a visual-based automatic positioning and marking method and system for a vacuum cup. BACKGROUND
[0002] With the rapid development of intelligent manufacturing and industrial automation, product marking has become an indispensable link in consumer goods manufacturing. In the daily-use metal product industry such as vacuum cups, laser marking is widely used due to its permanence, high precision and environmental protection. Since vacuum cups are mostly cylindrical or have curved surface structures, the marking position needs to be strictly aligned with the existing patterns. Positioning technology based on machine vision has gradually become a key means to meet this demand, promoting the industry towards automation and high precision.
[0003] The current mainstream scheme of automatic marking equipment for vacuum cups adopts a working mode of "single imaging + template matching / edge detection + mechanical rotation compensation". The core configuration includes a rotating jig, a fixed camera, a light source system, a control unit and a laser marking head. Some devices add a top downward-looking camera for cup bottom marking. Coordinate mapping mostly uses the nine-point calibration method. These existing technologies have realized basic automatic marking, replaced traditional manual intervention and mechanical positioning methods, improved production efficiency, and provided a basic solution for cylindrical surface marking.
[0004] However, the existing technologies still have limitations in practical application. For example, cup body positioning relies on single-frame images which are easily disturbed, cup bottom imaging distortion is not effectively corrected, pixel and laser coordinate system mapping precision is insufficient, and the logo orientation cannot be adapted, resulting in low vacuum cup marking precision, low product qualification rate, and difficulty in adapting to flexible batch production requirements. SUMMARY
[0005] To solve the technical problems that cup body positioning relies on single-frame images which are easily disturbed, cup bottom imaging distortion is not effectively corrected, pixel and laser coordinate system mapping precision is insufficient, and the logo orientation cannot be adapted, the present application provides a visual-based automatic positioning and marking method and system for a vacuum cup.
[0006] The technical solutions provided by the embodiments of the present application are as follows: The first aspect of the embodiments of the present application provides a visual-based automatic positioning and marking method for a vacuum cup, comprising: S1: determining the marking position of the target vacuum cup based on the customer instruction, wherein the marking position includes the cup body and the cup bottom; S2: based on the marking position containing the cup body, acquiring a plurality of cup body images in the rotation process through an image acquisition device; S3: performing target detection on each cup body image to identify the cup body marking area in the cup body image; S4: screening each cup body image through preset screening rules to obtain an alignment reference image; S5: calculating first rotation compensation of the cup body image based on the alignment reference image and position information of the cup body marking area; S6: driving the rotating jig to rotate according to the first rotation compensation so as to position the cup body image to a cup body marking position; S7: acquiring a plurality of cup bottom images through the image acquisition device based on a marking part containing a cup bottom; S8: performing perspective geometric correction on the cup bottom image based on preset checkerboard calibration parameters to obtain a corrected cup bottom image; S9: extracting a continuous circular arc contour feature from the corrected cup bottom image to determine pixel coordinates of a cup bottom center; S10: converting the pixel coordinates of the cup bottom center into a physical position in a marking coordinate system in combination with a nonlinear coordinate mapping relationship; S11: identifying a best rotation angle of the marking in the corrected cup bottom image through a template matching algorithm; S12: performing second rotation compensation on a cup bottom marking path in combination with the physical position and the best rotation angle; S13: controlling a marking device to perform corresponding marking operations in combination with a marking position corresponding to the marking part, wherein the marking position includes the cup body marking position and the cup bottom marking path.
[0007] A second aspect of the embodiment of the present application provides a visual-based vacuum cup automatic alignment marking system, comprising: a processor; a memory, wherein the memory has computer readable instructions stored thereon, and the computer readable instructions are executed by the processor to implement the visual-based vacuum cup automatic alignment marking method as described in the first aspect.
[0008] A third aspect of the embodiment of the present application provides a computer readable storage medium, wherein the computer readable storage medium has a computer program stored thereon, and the program is executed by a processor to implement the visual-based vacuum cup automatic alignment marking method as described in the first aspect.
[0009] The technical scheme provided by the embodiment of the present application has at least the following beneficial effects: In the embodiment of the present application, in view of the limitations of the prior art cup body alignment relying on single-frame images being susceptible to interference, cup bottom imaging distortion not being effectively corrected, pixel and laser coordinate system mapping precision being insufficient, and being unable to adapt to the orientation of the Logo, through multi-frame rotation collection of the cup body, target detection combined with preset rule screening of alignment reference frames, cooperation with first rotation compensation to realize accurate positioning, correction of cup bottom image distortion based on preset checkerboard calibration parameters, extraction of continuous circular arc contour features to determine the cup bottom circle center pixel coordinates, and relying on nonlinear coordinate mapping relationship to improve coordinate conversion precision. The best rotation angle is identified through template matching, and the orientation of the Logo is adapted through second rotation compensation. At the same time, cup body and cup bottom marking modes are supported to switch, effectively improving the production line automation and flexible manufacturing capability. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0011] Figure 1 A flowchart of a visual-based automatic alignment marking method for a vacuum cup provided in the embodiment of the present application.
[0012] Figure 2 A structure diagram of a visual-based automatic alignment marking system for a vacuum cup provided in the embodiment of the present application. DETAILED DESCRIPTION
[0013] The technical solutions in the present application will be described below with reference to the drawings.
[0014] In the embodiments of the present application, the words such as "example", "for example" and the like are used to represent as an example, illustration or description. Any embodiment or design scheme described as "example" in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the word "example" is intended to present the concept in a specific manner. In addition, in the embodiments of the present application, the meaning expressed by "and / or" can be both, or can be one of the two.
[0015] In the embodiments of the present application, "image" and "picture" can be used interchangeably at times. It should be pointed out that when the distinction is not emphasized, the meanings expressed are consistent. "Of", "corresponding" and "corresponding" can be used interchangeably at times. It should be pointed out that when the distinction is not emphasized, the meanings expressed are consistent.
[0016] In the embodiments of the present application, sometimes the subscript such as W1 may be written in the form of non-subscript such as W1, and when the difference is not emphasized, the meanings expressed are consistent.
[0017] To make the technical problems, technical solutions and advantages to be solved by the present application clearer, the following will be described in detail in conjunction with the drawings and specific embodiments.
[0018] Reference is made to the accompanying drawings Figure 1 , which shows a flowchart of a visual-based automatic positioning and marking method for a vacuum cup provided by an embodiment of the present application.
[0019] The embodiment of the present application provides a visual-based automatic positioning and marking method for a vacuum cup, which can be realized by a visual-based automatic positioning and marking device for a vacuum cup, which can be a terminal or a server. The processing flow of the visual-based automatic positioning and marking method for a vacuum cup can include the following steps:
[0020] S1: determining a marking position of a target vacuum cup based on a customer instruction, wherein the marking position includes a cup body and a cup bottom.
[0021] Wherein, the marking position refers to the specific area of the vacuum cup that needs to be laser marked.
[0022] S2: based on the marking position containing the cup body, acquiring a plurality of cup body images through an image acquisition device during rotation.
[0023] Wherein, the image acquisition device refers to an industrial imaging device (such as an industrial camera) used to capture images of the vacuum cup, and the plurality of cup body images refer to a plurality of cup body side images continuously captured during rotation.
[0024] In one possible implementation, S2 specifically includes sub-steps S201 to S203: S201: based on the marking position containing the cup body and the full-view angle acquisition requirement of the cup body, rotating the target vacuum cup in a step-by-step manner through a rotating jig.
[0025] Wherein, the rotating jig refers to a mechanical device for clamping and driving the rotation of the vacuum cup, and the step-by-step rotation refers to segmented rotation at fixed angle intervals.
[0026] S202: based on a preset rotation pause interval angle, capturing the cup body side image of the target vacuum cup through the image acquisition device.
[0027] Wherein, the preset rotation pause interval angle refers to a pre-set rotation pause interval angle, and the cup body side image refers to imaging from the side view of the vacuum cup.
[0028] It should be noted that the size of the preset rotation pause interval angle can be set by the person skilled in the art according to actual needs, and the present application does not make any limitation here.
[0029] S203: Based on the state that the target thermos completes one rotation, ensure that the cup body image collected achieves complete coverage of the circumferential view angle, and obtain a plurality of cup body images.
[0030] Wherein, the complete coverage of the circumferential view angle means that the image collected after one rotation can completely cover the 360° range of the cup body.
[0031] Specifically, in order to solve the problem that the existing single-frame imaging is easy to be disturbed, the present application adopts the cooperative design of "rotation + multi-frame collection", and through continuous shooting of multi-view images, sufficient data support is provided for subsequent identification of the cup body identification area, so as to avoid detection distortion caused by reflection, shielding or incomplete Logo at a single angle.
[0032] For example, the thermos rotates one round in a stepping manner with a pause every 18°, and a total of 20 images are collected (360° / 18°=20), and the front image is synchronously shot by the cup body camera every time the pause occurs, so as to ensure that the cup body circumferential view angle is completely covered, and the Logo in at least several frames is in the center area of the image.
[0033] It should be noted that through the collection of multiple frames of images after one rotation, the complete coverage of the cup body circumferential view angle is achieved, and the problem that a single frame of image is disturbed by reflection, shielding and the like is avoided, so as to provide sufficient and reliable data support for subsequent identification of the cup body identification area, and the stability and reliability of the cup body alignment are significantly improved.
[0034] In the embodiment of the present application, the multi-frame collection mode can avoid the problem that a single frame of image is disturbed, provide sufficient data support for subsequent identification, and improve the positioning reliability.
[0035] S3: Target detection is performed on each cup body image to identify the cup body identification area in the cup body image.
[0036] Wherein, the target detection refers to a computer vision technology for identifying and positioning a specific target from an image, and the cup body identification area refers to a reference area such as a pattern or Logo on the cup body.
[0037] In the embodiment of the present application, this step can accurately lock the cup body identification position, provide a clear reference for subsequent alignment, and ensure the accuracy of the cup body marking positioning.
[0038] S4: Each cup body image is screened through a preset screening rule to obtain an alignment reference image.
[0039] Wherein, the preset screening rule refers to a predetermined judgment standard for selecting the optimal image frame, and the alignment reference frame refers to the best image frame used for calculating the compensation amount after screening.
[0040] In a possible implementation, S4 specifically comprises sub-steps S401-S403: S401: Based on the cup body identification area, the distance between the horizontal center coordinate of the cup body identification area in each cup body image and the image horizontal center axis is calculated.
[0041] The horizontal center coordinate refers to the midpoint horizontal coordinate of the identification area boundary box in the image horizontal direction, and the image horizontal center axis refers to the vertical reference line corresponding to the image vertical center line.
[0042] S402: The absolute values of the distances are arranged in a preset sorting manner.
[0043] The preset sorting manner refers to an algorithm for arranging in ascending order or descending order according to numerical values.
[0044] S403: According to the sorting result, the alignment reference map is determined.
[0045] The alignment reference map refers to a reference image used for calculating the rotation compensation amount, and the identification area thereof is closest to the image center.
[0046] Specifically, by quantifying the offset distance of the identification area and the image center, an objective screening standard is established to ensure that the subsequent angle calculation is based on the image frame in which the logo is closest to the camera, and the nonlinear error of the angle caused by the perspective distortion in the edge area is avoided.
[0047] For example, if the horizontal center coordinate of the identification area in a certain image frame is x=320 pixels, and the image horizontal center axis coordinate is x'=384 pixels, then the distance between them is 64 pixels. By sorting the absolute values of the distances of all frames, the image frame with the smallest distance absolute value (such as 12 pixels) is selected as the alignment reference frame.
[0048] Further, this step cooperates with the multi-frame acquisition technology of S2, and the multi-frame acquisition provides a data basis, and this step realizes optimal data screening. The combination of the two significantly improves the accuracy and stability of the cup body alignment, and the angle estimation error is controlled within 1°.
[0049] It should be noted that by calculating the distance and selecting the optimal image frame, the interference frame with poor quality can be excluded, and the subsequent calculation of the first rotation compensation amount is based on the most accurate image data, which effectively improves the accuracy of the cup body marking alignment and ensures the consistency of the cup body marking position in batch production.
[0050] In the embodiments of the present application, by screening out interference frames with poor quality, the subsequent compensation calculation is based on the optimal image data, and the positioning accuracy is further improved.
[0051] S5: calculating a first rotation compensation of the cup body image based on the position information of the bit reference map and the cup body identification area.
[0052] wherein the first rotation compensation refers to a rotation angle value for adjusting the cup body position to align the identification area with the marking reference.
[0053] Specifically, this step establishes a mapping relationship between pixel offset and physical rotation angle by a formula: wherein, k represents a pixel-angle mapping coefficient, angle represents a known physical rotation angle, x represents a known physical rotation angle, x′ represents the horizontal coordinate of the corresponding feature point before rotation.
[0054] Specifically, the formula quantifies the pixel position offset of the identification area into an executable rotation angle, making the calculation of the first rotation compensation more accurate and quantifiable, avoiding errors in manual estimation, providing accurate angle basis for subsequent cup body positioning to the first marking position, and ensuring the consistency of the cup body marking position.
[0055] In the embodiments of the present application, the compensation amount is calculated based on accurate position information, providing data support for accurate cup body positioning, and effectively reducing positioning deviation.
[0056] S6: driving the rotating jig to rotate according to the first rotation compensation, so that the cup body image is positioned to the cup body marking position.
[0057] wherein the first marking position refers to the starting position of marking determined after the cup body completes the rotation compensation.
[0058] In the embodiments of the present application, accurate positioning of the cup body is achieved by mechanical rotation, ensuring the uniformity of the cup body marking position in batch production and improving the marking consistency.
[0059] S7: acquiring a plurality of cup bottom images through an image acquisition device based on the marking part containing the cup bottom.
[0060] wherein the plurality of cup bottom images refers to a plurality of cup bottom images taken from a top view.
[0061] In the embodiments of the present application, multi-frame acquisition can cover different perspectives of the cup bottom, providing comprehensive data for subsequent distortion correction and center positioning, and ensuring the basic precision of cup bottom marking.
[0062] S8: performing perspective geometric correction on the cup bottom image based on preset checkerboard calibration parameters to obtain a corrected cup bottom image.
[0063] The preset checkerboard calibration parameter refers to an image correction parameter obtained by calibrating a checkerboard calibration board, the perspective geometry correction refers to a technology for correcting image distortion caused by a shooting angle, and the corrected cup bottom image refers to a cup bottom image that conforms to an actual geometric proportion after distortion is eliminated.
[0064] It should be noted that a person skilled in the art can set the size of the preset checkerboard calibration parameter according to actual needs, and the present application does not limit this.
[0065] In a possible implementation, S8 specifically includes sub-steps S801 to S804. S801: Based on the preset checkerboard calibration parameter, a calibration board image of the cup bottom is collected by the image collection device.
[0066] S802: Corner point coordinate data is extracted from the calibration board image.
[0067] The corner point coordinate data refers to image pixel coordinates of intersection points of black and white squares on the calibration board and corresponding physical world coordinates.
[0068] S803: A homography matrix for perspective geometry correction is calculated according to the corner point coordinate data.
[0069] The homography matrix is a 3x3 transformation matrix used to describe the perspective projection mapping relationship between two planes.
[0070] S804: A coordinate transformation operation is performed on the cup bottom image by using the homography matrix to obtain a corrected cup bottom image.
[0071] The coordinate transformation operation refers to re-projection of image pixel positions according to the homography matrix to correct geometric deformation, and the corrected cup bottom image refers to a cup bottom image that conforms to an actual geometric proportion after distortion is eliminated.
[0072] Specifically, to solve the problem that the cup bottom image is easily elliptical, a mapping relationship between world coordinates and pixel coordinates is established by checkerboard calibration, and inverse projection conversion from an ellipse to a circle is realized by using a homography matrix to restore the real geometric shape of the cup bottom.
[0073] For example, a high-precision checkerboard calibration board is imaged in close contact with the cup bottom plane, and the world coordinates (X, Y) and image pixel coordinates (u, v) of the corner points are extracted. A homography matrix is calculated as follows: h calib The matrix is then used for coordinate transformation on the cup bottom elliptical image to obtain a corrected cup bottom image that is approximately a circle:
[0074] wherein, u u and v represent the pixel coordinates of the corner point in the horizontal direction of the image, vpixel coordinate of the corner point in the vertical direction of the image, w scaling factor of the homogeneous coordinate, h 11 、h 12 、h 13 、h 21 、h 22 、h 23 、h 31 、h 32 、h 33indicates 9 elements of the matrix, which are calculated by fitting the world coordinates and pixel coordinates of the chessboard corner points, X coordinate of the corner point in the horizontal direction of the world coordinate system, Y coordinate of the corner point in the vertical direction of the world coordinate system.
[0075] Further, the homography matrix correction technology of this step not only compensates for the distortion caused by the non-perpendicular incidence of the camera, but also corrects the error caused by the mechanical assembly tolerance, thereby providing a geometrically faithful image basis for subsequent cup bottom circle center positioning.
[0076] It should be noted that through the chessboard calibration and homography matrix correction, the perspective distortion of the cup bottom image caused by the shooting angle and the mechanical assembly tolerance can be effectively eliminated, and the real geometric shape of the cup bottom is restored, thereby clearing the obstacles for subsequent cup bottom circle center positioning and identification recognition, and laying a precise image foundation.
[0077] In the embodiment of the application, this step can effectively correct the imaging distortion of the cup bottom, restore the real shape of the cup bottom, and clear the obstacles for subsequent circle center positioning and identification recognition.
[0078] S9: Extracting continuous arc contour features from the corrected cup bottom image to determine the pixel coordinates of the cup bottom circle center.
[0079] The arc contour features refer to the continuous arc line features presented by the cup bottom edge, and the pixel coordinates refer to the coordinate values in the image in units of pixels (used to position the circle center).
[0080] In one possible implementation, S9 specifically includes sub-steps S901 to S906: S901: Detecting the corrected cup bottom image by using a YOLO model to determine the cup bottom identification region.
[0081] The YOLO model is a target detection algorithm based on deep learning, which can identify specific target regions in the image in real time.
[0082] S902: Constructing a circular region of interest with the center of the detection frame of the cup bottom identification region as the circle center.
[0083] Among them, the circular region of interest refers to a local area of the image centered at a certain point and with a certain radius, which is used to limit the scope of subsequent processing.
[0084] S903: Perform desharpening masking on the corrected cup bottom image within the circular region of interest to obtain the enhanced image: in, I ( x, y ) represents the original pixel value. I emph ( x, y ) represents the enhanced pixel value. λ Indicates the enhancing factor. I smooth ( x, y ) represents the pixel value after mean filtering.
[0085] Among them, desharpening masking is an image enhancement technique that improves image contrast and clarity by emphasizing high-frequency edge information.
[0086] S904: Combine the threshold range to perform threshold segmentation on the enhanced image and determine the image contour.
[0087] Threshold segmentation refers to converting a grayscale image into a binary image by comparing the pixel brightness with a set threshold, thereby separating the target from the background.
[0088] It should be noted that those skilled in the art can set the threshold range according to actual needs, and this invention does not limit it.
[0089] S905: Filter out continuous arc segments with a length greater than or equal to a preset angle from the image contour.
[0090] Among them, continuous length refers to the angular span of the contour that extends continuously in the circumferential direction.
[0091] It should be noted that those skilled in the art can set the size of the preset angle according to actual needs, and this invention does not limit that.
[0092] S906: Based on the arc segment, a weighted least squares algorithm is used to fit a circle and determine the pixel coordinates of the center of the cup bottom. in, e i Indicates the first i The deviation of each arc edge point from the fitted circle, (x i , y i ) indicates the first i The pixel coordinates of the points on the edge of the arc, ( a, b () represents the pixel coordinates of the center of the cup bottom circle to be fitted. r This represents the radius of the cup bottom circle to be fitted. w i Indicates the first i The weights corresponding to each deviation This represents the threshold for identifying outliers. median ( ) indicates the median operation. min This indicates the operation of finding the minimum value. N This indicates the number of arc edge points involved in the fitting process.
[0093] Among them, the weighted least squares algorithm is a mathematical optimization method that assigns different weights to different data points during the fitting process in order to reduce the influence of outliers.
[0094] Specifically, this step uses a progressive design that sequentially performs marker localization, region focusing, image enhancement, contour extraction, arc filtering, and center fitting to accurately locate the pixel coordinates of the cup's bottom center, effectively addressing issues such as background interference, local occlusion, and image noise.
[0095] For example, a threshold range of 80-100 can be set for threshold segmentation to filter out dark circular arc segments with a continuous length ≥270° for fitting.
[0096] Furthermore, a robust estimation mechanism is introduced into the circle center fitting process, by calculating the first... i The deviation of each arc edge point, and the determination of the deviation weights, combined with minimizing the weighted sum of squared deviations, weaken the influence of outliers on the fitting results.
[0097] It should be noted that by using YOLO detection to accurately locate the marked area, enhance image contrast, filter effective arc segments, and combine with a robust fitting algorithm, the influence of background interference and outliers can be effectively suppressed, significantly improving the accuracy and anti-interference ability of locating the center of the cup bottom, and providing a reliable pixel coordinate reference for subsequent coordinate transformation.
[0098] In this embodiment of the invention, fitting the center of a circle based on a continuous arc profile can improve the accuracy of the center positioning and provide a reliable reference for subsequent coordinate transformation.
[0099] S10: Combining nonlinear coordinate mapping relationships, the pixel coordinates of the center of the cup bottom are converted into the physical position in the marking coordinate system.
[0100] The nonlinear coordinate mapping relationship refers to a nonlinear conversion rule of associating a pixel coordinate with a physical coordinate, the marking coordinate system refers to a physical coordinate system of the laser marking device, and the physical position refers to a spatial position coordinate in actual marking.
[0101] In a possible implementation, S10 specifically includes sub-steps S1001 to S1006. S1001: Based on the construction requirement of the nonlinear coordinate mapping relationship, circular marking point arrays in a preset array form are pasted on a marking plane of the marking device.
[0102] The array form refers to that the marking points in the point array are arranged in a regular row-column or geometric pattern.
[0103] It should be noted that a person skilled in the art can set the size of the preset array form according to actual needs, which is not limited in the present application.
[0104] S1002: An imaging image of the circular marking point array is captured by using an image acquisition device.
[0105] The imaging image refers to a two-dimensional image formed by the marking point array on an image sensor through a camera optical system.
[0106] S1003: The marking device is controlled to mark at each marking point of the circular marking point array, and the corresponding laser physical coordinates of each marking point are recorded.
[0107] The laser physical coordinates refer to actual three-dimensional positions of a focal point of a marking head in a laser marking machine coordinate system.
[0108] S1004: Based on the marking point coordinate correction requirement, the imaging image is corrected by using a homography matrix, to obtain corrected pixel coordinates of each marking point.
[0109] The corrected pixel coordinates refer to standardized positions of the marking points in the image after eliminating imaging distortion through geometric transformation.
[0110] S1005: The mapping homography matrix of the pixel coordinates and the laser coordinates is calculated according to each corrected pixel coordinate and the corresponding laser physical coordinates, to form the nonlinear coordinate mapping relationship.
[0111] The mapping homography matrix is a mathematical transformation matrix used to realize coordinate conversion between an image pixel coordinate system and a laser marking physical coordinate system.
[0112] S1006: Based on the nonlinear coordinate mapping relationship, the pixel coordinates of the cup bottom center are input into the mapping homography matrix, to convert and obtain the physical position in the marking coordinate system.
[0113] The marking coordinate system is a reference coordinate system for describing the working space position of the marking head.
[0114] Specifically, this step establishes a high-precision mapping of pixel coordinates and laser coordinates by sequentially performing the processes of marking point array arrangement, coordinate synchronous acquisition, image correction, matrix calculation, and coordinate conversion, and compensates for lens distortion and platform assembly errors.
[0115] For example, 3x3 circular marking point arrays are pasted on the marking plane, and the spacing between adjacent marking points is 10 mm. An imaging image is captured by the image acquisition device, and the marking device is controlled to mark at each marking point to record the laser physical coordinates. After the imaging image is corrected using the homography matrix, 9 sets of corrected pixel coordinates and corresponding laser physical coordinates are obtained, and the mapping homography matrix is calculated. The pixel coordinates of the center of the cup bottom can be converted into physical positions in the marking coordinate system by inputting the matrix.
[0116] Further, the nine-point film calibration combined with the homography matrix model used in this step can effectively compensate for lens radial distortion and platform non-coplanarity compared to traditional linear calibration, thereby improving the marking repeatability across batches.
[0117] It should be noted that the high-precision nonlinear coordinate mapping relationship is constructed by marking point array acquisition, coordinate correction, and mapping matrix calculation, which can effectively compensate for lens distortion and platform assembly errors, accurately convert pixel coordinates to physical positions in the marking coordinate system, and significantly improve the repeatability and consistency of cup bottom marking.
[0118] In the embodiment of the present application, the conversion can realize accurate mapping of pixel coordinates to physical positions, and improve the accuracy and repeatability of the cup bottom marking position.
[0119] S11: The optimal rotation angle of the mark in the corrected cup bottom image is identified by a template matching algorithm.
[0120] The template matching algorithm refers to a technique for comparing image marks with a pre-set standard template and finding the optimal match, and the optimal rotation angle refers to the optimal rotation angle value that aligns the mark with the standard template.
[0121] In one possible implementation, S11 specifically includes sub-steps S1101 to S1104: S1101: Set a pre-set standard mark template and pre-set matching parameters.
[0122] The pre-set standard mark template refers to a pre-made and stored mark standard image with a reference direction (e.g., vertical), and the pre-set matching parameters include search angle range, step size, and matching score threshold, etc., which are used to control the configuration of the template matching process.
[0123] S1102: Perform multi-angle rotation matching on the logo area in the cup bottom image based on preset matching parameters, and generate a matching result.
[0124] In the multi-angle rotation matching, the logo area image is compared with the template at multiple rotation angles.
[0125] S1103: Select the best matching item from the matching result according to a preset matching evaluation rule.
[0126] The matching evaluation rule is a criterion for selecting the optimal matching result based on similarity scores, overlap rates, etc. The best matching item refers to the optimal matching angle and its data that meet the evaluation rule.
[0127] S1104: Determine the best rotation angle of the logo in the cup bottom image based on the rotation angle corresponding to the best matching item.
[0128] The best rotation angle refers to the theoretical rotation angle required to align the logo area with the standard template.
[0129] Specifically, to solve the problem that the existing technology cannot adapt to the orientation of the logo, the multi-angle matching of the standard template and the target logo is used to automatically identify the current rotation angle of the logo, providing a basis for subsequent marking path compensation.
[0130] For example, the preset standard logo template is a vertical logo image, and the template training parameters are set as follows: image pyramid layer number 4, scaling range 0.85-1.15, scaling step 0.01, template creation contrast threshold 25, angle search range -30° to 30°, angle search step 1°. The template usage parameters are set as follows: minimum contrast 5, minimum matching score threshold 0.2, maximum number of returned matching results 1, maximum overlap rate 0.1, and greediness 0.5. After generating the matching result through multi-angle rotation matching, the angle corresponding to the item with the highest matching score is selected as the best rotation angle.
[0131] Further, the template matching technology used in this step has strong robustness. Even if the logo is slightly deformed or the lighting changes, the rotation angle can still be accurately identified without the need for manual intervention to achieve fully automatic orientation recognition.
[0132] It should be noted that through the multi-angle rotation matching of the standard template, the actual rotation angle of the cup bottom logo can be accurately identified without the need for manual intervention, providing accurate basis for subsequent cup bottom marking path compensation, achieving adaptive recognition of the logo orientation, and improving the flexible manufacturing capability of the scheme.
[0133] In the embodiment of the present application, the step can accurately identify the rotating posture of the mark, and provide an accurate basis for compensation of the cup bottom marking path.
[0134] S12: In combination with the physical position and the optimal rotating angle, performing second rotating compensation on the cup bottom marking path.
[0135] The second rotating compensation refers to a rotating adjustment operation on the cup bottom marking path (distinguished from the first rotating compensation of the cup body).
[0136] In a possible implementation, S12 specifically includes sub-steps S1201 to S1203: S1201: Obtain the optimal rotating angle of the mark in the corrected cup bottom image.
[0137] S1202: According to the optimal rotating angle, calculate a pre-compensation angle of the cup bottom marking path, wherein the pre-compensation angle is equal in size and opposite in direction to the optimal rotating angle.
[0138] The pre-compensation angle refers to an inverse rotating adjustment amount that needs to be applied to the original marking path to offset the rotation of the mark itself.
[0139] It should be noted that a person skilled in the art can set the size of the pre-compensation angle according to actual needs, which is not limited in the present application.
[0140] S1203: Perform a second rotating compensation operation on the cup bottom marking path according to the pre-compensation angle.
[0141] The second rotating compensation operation refers to a processing step of rotating and transforming the whole marking path in the marking path planning stage.
[0142] Specifically, for the deviation of the marking direction caused by the rotation of the mark, the marking path is adjusted by the inverse angle compensation to ensure that the marking content is consistent with the direction of the mark, and full-automatic flexible production is achieved.
[0143] For example, if the optimal rotating angle of the mark is 15° identified by template matching, the pre-compensation angle is calculated as -15° (equal in size and opposite in direction to the optimal rotating angle), and the preset cup bottom marking path is adjusted by rotating according to the pre-compensation angle, so that the marking content is consistent with the direction of the mark. α
[0144] Further, the present step cooperates with the angle identification of S11 to provide an accurate basis for the angle identification, and the compensation operation realizes path correction, so that the marking starting angle does not need to be manually set, and the heat preservation cup with any clamping angle is adapted.
[0145] It should be noted that through the pre-compensation operation opposite to the optimal rotation angle, the cup bottom marking content and the identification orientation are always consistent, the direction sensitive content such as words and arrows is prevented from being inverted or inclined, the aesthetic degree and brand consistency of the cup bottom marking are significantly improved, and the manufacturing requirements of high-end products are met.
[0146] In the embodiment of the application, the marking content and the identification orientation are consistent through path rotation compensation, the direction deviation is avoided, and the cup bottom marking quality is improved.
[0147] S13: in combination with the marking position corresponding to the marking part, the marking device is controlled to perform corresponding marking operation, wherein the marking position includes a cup body marking position and a cup bottom marking path.
[0148] Specifically, when the marking part is the cup body, the marking is performed at the cup body marking position. When the marking part is the cup bottom, the marking is performed at the physical position according to the compensated cup bottom marking path. When the marking part is the cup body and the cup bottom, the cup body marking and the cup bottom marking are sequentially performed.
[0149] In the embodiment of the application, the step can switch the marking mode as needed, adapt to different marking requirements, and improve the production line automation level and flexible manufacturing capability.
[0150] Referring to the accompanying drawings Figure 2 , a structure schematic diagram of a visual-based vacuum cup automatic alignment marking system provided by the application is shown.
[0151] The application further provides a visual-based vacuum cup automatic alignment marking system 20 applied to the visual-based vacuum cup automatic alignment marking method described above, and comprising: A processor 201.
[0152] A memory 202, the memory 202 stores computer readable instructions, and when the computer readable instructions are executed by the processor 201, the visual-based vacuum cup automatic alignment marking method of the method embodiment is realized.
[0153] The visual-based vacuum cup automatic alignment marking system 20 provided by the application can execute the visual-based vacuum cup automatic alignment marking method described above and realize the same or similar technical effects. To avoid repetition, the application will not be described again.
[0154] It should be appreciated that a processor in the embodiments of the present application can be a central processing unit (CPU). The processor can also be other general purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general purpose processor can be a microprocessor or the processor can be any conventional processor.
[0155] It should also be appreciated that the memory in the embodiments of the present application can be a volatile memory or a nonvolatile memory, or can include both volatile and nonvolatile memory. The nonvolatile memory can be a read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), or flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example, and not limitation, many forms of random access memory (RAM) are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0156] The above-described embodiments can be implemented in whole or in part by software, hardware (such as a circuit), firmware, or any combination thereof. When implemented in software, the above-described embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are wholly or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center through a wired (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. containing one or more available medium collections. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state disk.
[0157] It should be understood that the term "and / or" herein merely describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. In addition, the character " / " herein generally represents that the associated objects before and after it are in an "or" relationship, but it can also represent an "and / or" relationship, which can be understood according to the context before and after it.
[0158] In the present application, "at least one" means one or more, and "multiple" means two or more. "At least one of the following" or the like means any combination of the items, including any combination of single or multiple items. For example, at least one of a, b, or c can represent a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.
[0159] It should be understood that in various embodiments of the present application, the size of the sequence number of the above-described processes does not mean the order of execution, and the execution order of the processes should be determined according to their functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0160] Those skilled in the art can clearly understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the devices, apparatuses and units described above can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
[0162] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0163] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0164] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically independently, or two or more units can be integrated into one unit.
[0165] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or parts of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0166] The embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to realize the visual-based automatic alignment marking method of a vacuum cup.
[0167] The computer readable storage medium provided by the present application can realize the steps and effects of the visual-based automatic alignment marking method of a vacuum cup in the above method embodiment, and details are not repeated in the present application.
[0168] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0169] The following points need to be explained: (1) The drawings of the embodiments of the present application only relate to the structures involved in the embodiments of the present application, and other structures can refer to the usual design.
[0170] (2) For the sake of clarity, the thickness of the layers or regions is magnified or reduced in the drawings used to describe the embodiments of the present application, that is, the drawings are not drawn according to the actual proportion. It can be understood that when an element such as a layer, a film, a region or a substrate is referred to as being located "on" or "under" another element, the element can be "directly" located on or under another element or there can be an intermediate element.
[0171] (3) In the case of no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other to obtain new embodiments.
[0172] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A visual-based automatic positioning and marking method for a vacuum cup, characterized in that, The method comprises the following steps: S1: determining a marking position of a target mug based on a customer instruction, wherein the marking position comprises a body and a bottom of the mug; S2: acquiring a plurality of body images in a rotating process based on the marking position comprising the body through an image acquisition device; S3: performing target detection on each of the body images to identify a body identification area in the body image; S4: screening each of the body images through a preset screening rule to obtain an alignment reference image; S5: calculating a first rotation compensation of the body image based on the alignment reference image and position information of the body identification area; S6: driving a rotating tool to rotate according to the first rotation compensation to position the body image to a body marking position; S7: acquiring a plurality of bottom images based on the marking position comprising the bottom through the image acquisition device; S8: performing perspective geometric correction on the bottom image based on a preset checkerboard calibration parameter to obtain a corrected bottom image; S9: extracting a continuous circular arc contour feature from the corrected bottom image to determine a pixel coordinate of a bottom center; S10: converting the pixel coordinate of the bottom center into a physical position in a marking coordinate system in combination with a nonlinear coordinate mapping relationship; S11: identifying a best rotation angle of the identified bottom image through a template matching algorithm; S12: performing a second rotation compensation on a bottom marking path in combination with the physical position and the best rotation angle; S13: controlling a marking device to perform a corresponding marking operation in combination with a marking position corresponding to the marking position, wherein the marking position comprises the body marking position and the bottom marking path.
2. The visual-based automatic positioning and marking method for a vacuum cup according to claim 1, characterized in that, The S2 specifically comprises: S201: driving the target mug to rotate one round in a step-by-step manner through a rotating tool based on the marking position comprising the body and a full-view angle acquisition requirement of the body; S202: capturing a body side image of the target mug through the image acquisition device based on a preset rotation pause interval angle; S203: ensuring that the acquired body images achieve a circumferential view angle without missing coverage based on a state that the target mug completes one round of rotation to obtain a plurality of body images.
3. The visual-based automatic positioning and marking method for a vacuum cup according to claim 1, characterized in that, The S4 specifically comprises: S401: calculating a distance between a horizontal center coordinate of the body identification area in each of the body images and an image horizontal center axis based on the body identification area; S402: arranging absolute values of each of the distances through a preset sorting manner; S403: determining the alignment reference image according to the sorting result.
4. The visual-based automatic positioning and marking method for a vacuum cup according to claim 1, characterized in that, The S8 specifically comprises: S801: acquiring a calibration board image of the bottom through the image acquisition device based on the preset checkerboard calibration parameter; S802: extracting corner point coordinate data from the calibration board image; S803: calculating a homography matrix for perspective geometric correction according to the corner point coordinate data; S804: performing a coordinate transformation operation on the bottom image by using the homography matrix to obtain the corrected bottom image.
5. The visual-based automatic positioning and marking method for a vacuum cup according to claim 1, characterized in that, The S9 specifically comprises: S901: determining a bottom identification area through YOLO model detection on the corrected bottom image. S902: A circular region of interest is constructed with the center of the detection box of the cup bottom identification area as the center of the circle; S903: A de-sharpening mask processing is performed on the corrected cup bottom image in the circular region of interest to obtain an enhanced image; S904: The enhanced image is threshold segmented in combination with a threshold range to determine an image contour; S905: A circular arc segment with a continuous length greater than or equal to a preset angle is screened out from the image contour; S906: Based on the circular arc segment, a circle is fitted by a weighted least squares algorithm to determine the pixel coordinates of the cup bottom center.
6. The visual-based automatic positioning and marking method for a vacuum cup according to claim 1, characterized in that, The S10 specifically includes: S1001: Based on the construction requirement of a nonlinear coordinate mapping relationship, a circular mark point array in a preset array form is pasted on a marking plane of a marking device; S1002: An imaging image of the circular mark point array is captured by an image acquisition device; S1003: The marking device is controlled to mark at each mark point of the circular mark point array, and the corresponding laser physical coordinates of each mark point are recorded; S1004: Based on a mark point coordinate correction requirement, the imaging image is corrected by a homography matrix to obtain the corrected pixel coordinates of each mark point; S1005: The mapping homography matrix of the pixel coordinates and the laser coordinates is calculated according to each corrected pixel coordinate and the corresponding laser physical coordinate, and the nonlinear coordinate mapping relationship is formed; S1006: Based on the nonlinear coordinate mapping relationship, the pixel coordinates of the cup bottom center are input into the mapping homography matrix to convert and obtain the physical position in the marking coordinate system.
7. The visual-based automatic positioning and marking method for a vacuum cup according to claim 6, characterized in that, The S11 specifically includes: S1101: A preset standard identification template and a preset matching parameter are set; S1102: Based on the preset matching parameter, a multi-angle rotation matching is performed on the cup bottom identification area in the corrected cup bottom image and the preset standard identification template to generate a matching result; S1103: According to a preset matching evaluation rule, the best matching item is screened out from the matching result; S1104: Based on the rotation angle corresponding to the best matching item, the best rotation angle of the identification in the corrected cup bottom image is determined.
8. The visual-based automatic positioning and marking method for a vacuum cup according to claim 6, characterized in that, The S12 specifically includes: S1201: The best rotation angle of the identification in the corrected cup bottom image is obtained; S1202: According to the best rotation angle, a pre-compensation angle of the cup bottom marking path is calculated, wherein the pre-compensation angle is equal in size and opposite in direction to the best rotation angle; S1203: A second rotation compensation operation is performed on the cup bottom marking path according to the pre-compensation angle.
9. A visual-based automatic positioning and marking system for a vacuum cup, characterized in that, It includes: A processor; A memory, the memory has computer readable instructions stored thereon, when the computer readable instructions are executed by the processor, the visual-based automatic positioning marking method for a vacuum cup in any one of claims 1-8 is realized.
10. A readable storage medium, characterized by, The program or instruction stored on the readable storage medium is executed by the processor to realize the steps of the visual-based automatic positioning marking method for a vacuum cup in any one of claims 1-8.