A laser focusing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202310782787.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-06-28
AI Technical Summary
In existing technologies, laser focusing efficiency and accuracy are relatively low, mainly because the height and angle of the laser emitter need to be manually adjusted.
By acquiring images of the laser emitter at different heights and angles from a preset camera, analyzing image features and focus positions, the target focus height and angle of the laser emitter are automatically determined.
It improves the efficiency and accuracy of laser focusing, reduces manual intervention, and achieves a more efficient autofocus process.
Smart Images

Figure CN116953883B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of optical detection technology, and in particular to a laser focusing method, apparatus, electronic device and storage medium. Background Technology
[0002] The laser beam emitted by the laser emitter has a focal point, and the energy of the laser beam is highest at the focal point. Therefore, in order to achieve better results when using a laser emitter, the operator usually needs to manually adjust the height and angle of the laser emitter to complete the laser focusing. However, manually completing the laser focusing usually results in lower focusing efficiency and focusing accuracy. Summary of the Invention
[0003] The purpose of this application is to provide a laser focusing method, apparatus, electronic device, and storage medium to improve the focusing efficiency and accuracy of laser focusing. The specific technical solution is as follows:
[0004] In a first aspect, embodiments of this application provide a laser focusing method, the method comprising:
[0005] Acquire first images of each first printed pattern captured by a preset camera installed at a preset position; wherein each first printed pattern is printed on a preset plane when the laser emitter is at a specified angle and at each of the first preset heights within a first height range;
[0006] Determine the first direction of change of the height at which each first printed pattern is located when printing along the laser emitter, the first trend of change of the image features of each first image, and determine the target height at which the first trend of change satisfies the preset trend requirements; wherein the image features include: image brightness or image sharpness;
[0007] Acquire second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements; wherein, each second printed pattern is printed on the preset plane when the laser emitter is at the target height and at each preset angle;
[0008] When determining the target angle of the laser emitter and the target image features of the target image for printing a second print pattern used to acquire the target image;
[0009] If the target image features meet the preset feature requirements, then the target height and the target angle are respectively determined as the target focusing height and target focusing angle of the laser emitter.
[0010] Optionally, in one specific implementation, the method further includes:
[0011] If the target image features do not meet the preset feature requirements, then the target angle and the height range determined according to the target height are respectively determined as the specified angle and the first height range, and the step of obtaining the first image of each first printed pattern captured by the preset camera installed at the preset position is returned.
[0012] Optionally, in one specific implementation, determining the target height at which the first trend of change satisfies the preset trend requirement includes:
[0013] Determine a second height range within which the first change trend meets a preset trend requirement; wherein the second height range is smaller than the first height range;
[0014] Acquire third images of each third printed pattern captured by the preset camera; wherein each third printed pattern is printed on the preset plane when the laser emitter is at the specified angle and at each of the second preset heights within the second height range, and the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights.
[0015] Determine the second direction of change of the height at which each third printed pattern is located when printing along the laser emitter, the second trend of change of the image brightness of each third image, and determine the target height at which the second trend of change satisfies the preset trend requirements.
[0016] Optionally, in one specific implementation, the height difference between any two adjacent first preset heights is a first value, and the height difference between any two adjacent second preset heights is a second value, wherein the first value is greater than the second value.
[0017] Optionally, in one specific implementation, acquiring the second images of each second printed pattern captured by the preset camera, and determining the target image in the second image whose image focus position meets the preset position requirement, includes:
[0018] Acquire a second image of the current second printed pattern captured by the preset camera, and determine the image focus position of the second image;
[0019] If the focal position of the image meets the preset position requirements, then the second image is determined as the target image;
[0020] Otherwise, determine the direction of brightness change of the second image, and determine the new second printed pattern printed by the laser emitter at a specified angle adjusted according to the direction of brightness change on the preset plane as the current printed pattern; return to the second image of the current second printed pattern acquired by the preset camera.
[0021] Optionally, in one specific implementation, determining the direction of brightness variation in the second image includes:
[0022] The second image is subjected to Gaussian blurring to obtain the brightest and darkest regions in the second image; and the direction of brightness variation in the second image is determined based on the positional relationship between the brightest and darkest regions.
[0023] Optionally, in one specific implementation, the printed pattern printed by the laser emitter on the preset plane consists of an inner pattern and an outer pattern. The inner pattern is a QR code pattern, and the outer pattern is a specified number of rectangular patterns of equal size distributed around the QR code pattern. Furthermore, the spacing between any two adjacent rectangular patterns is the same. The QR code pattern in each printed pattern carries the height information and angle information of the laser emitter when printing the printed pattern.
[0024] Before determining the first direction of change of height along the laser emitter when printing each first printed pattern, and the first trend of change of image features of each first image, the method further includes:
[0025] Based on the QR code pattern in each first image, determine the height of the laser emitter when printing the first printed pattern used to capture the first image;
[0026] Determining the target image in the second image whose image focal position meets the preset position requirements includes:
[0027] Based on the outer pattern in the second image, determine the target image in the second image whose image focal position meets the preset position requirements;
[0028] When determining the target angle of the laser emitter during the printing of the second print pattern used to acquire the target image, the target angle includes:
[0029] Based on the QR code pattern in the target image, determine the target angle of the laser emitter when printing the second printed pattern used to acquire the target image.
[0030] Secondly, embodiments of this application provide a laser focusing device, the device comprising:
[0031] The image acquisition module is used to acquire first images of each first printed pattern captured by a preset camera installed at a preset position; wherein each first printed pattern is printed on a preset plane when the laser emitter is at a specified angle and at each of the first preset heights within a first height range;
[0032] The trend determination module is used to determine the first direction of change of the height of each first printed pattern when printing along the laser emitter, the first trend of change of the image features of each first image, and to determine the target height at which the first trend of change satisfies a preset trend requirement; wherein the image features include: image brightness or image sharpness.
[0033] The image determination module is used to acquire second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements; wherein, each second printed pattern is printed on the preset plane when the laser emitter is at the target height and at each preset angle;
[0034] An angle determination module is used to determine the target angle of the laser emitter and the target image features of the target image when printing a second printed pattern used to acquire the target image;
[0035] The focus determination module is used to determine the target height and the target angle as the target focus height and target focus angle of the laser emitter, respectively, if the target image features meet the preset feature requirements.
[0036] Optionally, in one specific implementation, the apparatus further includes:
[0037] The range determination module is used to determine the target angle and the height range determined according to the target height as the specified angle and the first height range respectively if the target image features do not meet the preset feature requirements, and return to the step of obtaining the first image of each first printed pattern acquired by the preset camera installed at the preset position.
[0038] Optionally, in one specific implementation, the trend determination module includes:
[0039] The range determination submodule is used to determine a second height range in which the first change trend meets a preset trend requirement; wherein the second height range is smaller than the first height range;
[0040] The image acquisition submodule is used to acquire the third images of each third printed pattern captured by the preset camera; wherein each third printed pattern is printed on the preset plane when the laser emitter is at the specified angle and at each of the second preset heights within the second height range, and the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights.
[0041] The trend determination submodule is used to determine the second direction of change of the height at which each third printed pattern is located when printing along the laser emitter, the second trend of change of the image brightness of each third image, and to determine the target height at which the second trend of change meets the preset trend requirements.
[0042] Optionally, in one specific implementation, the height difference between any two adjacent first preset heights is a first value, and the height difference between any two adjacent second preset heights is a second value, wherein the first value is greater than the second value.
[0043] Optionally, in one specific implementation, the image determination module is specifically used for:
[0044] Acquire a second image of the current second printed pattern captured by the preset camera, and determine the image focus position of the second image;
[0045] If the focal position of the image meets the preset position requirements, then the second image is determined as the target image;
[0046] Otherwise, determine the direction of brightness change of the second image, and determine the new second printed pattern printed by the laser emitter at a specified angle adjusted according to the direction of brightness change on the preset plane as the current printed pattern; return to the second image of the current second printed pattern acquired by the preset camera.
[0047] Optionally, in one specific implementation, the image determination module is specifically used for:
[0048] The second image is subjected to Gaussian blurring to obtain the brightest and darkest regions in the second image; and the direction of brightness variation in the second image is determined based on the positional relationship between the brightest and darkest regions.
[0049] Optionally, in one specific implementation, the printed pattern printed by the laser emitter on the preset plane consists of an inner pattern and an outer pattern. The inner pattern is a QR code pattern, and the outer pattern is a specified number of rectangular patterns of equal size distributed around the QR code pattern. Furthermore, the spacing between any two adjacent rectangular patterns is the same. The QR code pattern in each printed pattern carries the height information and angle information of the laser emitter when printing the printed pattern.
[0050] The device further includes:
[0051] A QR code recognition module is used to determine the height of the laser emitter when printing a first printed pattern for capturing the first image, based on the QR code pattern in each first image.
[0052] The image determination module is specifically used for:
[0053] Based on the outer pattern in the second image, determine the target image in the second image whose image focal position meets the preset position requirements;
[0054] The angle determination module is specifically used for:
[0055] Based on the QR code pattern in the target image, determine the target angle of the laser emitter when printing the second printed pattern used to acquire the target image.
[0056] Thirdly, embodiments of this application provide a laser focusing system, the system comprising: a processor, a laser emitter, and a camera;
[0057] The processor is used to implement any of the laser focusing methods described above;
[0058] The laser emitter is used to print patterns on a preset plane;
[0059] The camera is used to capture images of the patterns printed by the laser emitter on a preset plane.
[0060] Fourthly, embodiments of this application provide an electronic device, including:
[0061] Memory, used to store computer programs;
[0062] The processor, when executing a program stored in memory, implements any of the laser focusing methods described above.
[0063] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the laser focusing methods described above.
[0064] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the laser focusing methods described above.
[0065] Beneficial effects of the embodiments in this application:
[0066] As can be seen from the above, by applying the solution provided in the embodiments of this application, the laser emitter can print a first printed pattern on a preset plane when it is at a specified angle and at various first preset heights within a first height range. A preset camera installed at a preset position can capture first images of each of the first printed patterns printed by the laser emitter on the preset plane. Therefore, when performing laser focusing, the first images of each of the first printed patterns captured by the preset camera installed at the preset position can be acquired first, and then the first direction of change of the height along the laser emitter when printing each of the first printed patterns and the first trend of change of the image features of each of the first images can be determined. Since the focusing effect is better when the first trend of change meets the preset trend requirement, the target height at which the first trend of change meets the preset trend requirement can be determined after determining the first trend of change.
[0067] After determining the target height, the laser emitter can print a second printed pattern on a preset plane when it is at the target height and at various preset angles. A preset camera can capture second images of each of the second printed patterns printed on the preset plane. Therefore, after determining the target focusing height, it is also possible to acquire the second images of each of the second printed patterns captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements. Since the focusing effect is better when the image focus position meets the preset position requirements, the target angle of the laser emitter when printing the second printed pattern used to capture the target image can be determined, and the target image features of the target image can be determined.
[0068] If the target image features meet the preset feature requirements, it means that the target height and target angle of the laser emitter can meet the focusing accuracy requirements. Therefore, the target height and target angle can be determined as the target focusing height and target focusing angle of the laser emitter, respectively.
[0069] Based on this, the target focusing height and target focusing angle of the laser emitter can be determined, and the height and angle of the laser emitter can be adjusted according to the aforementioned target focusing height and target focusing angle, thereby completing the focusing of the laser emitter. Since the aforementioned target focusing height and target focusing angle are determined by image analysis of the first and second images, and do not require manual intervention, the solution provided by the embodiments of this application can improve the focusing efficiency and focusing accuracy of laser focusing compared to manual focusing, which requires manual intervention. Attached Figure Description
[0070] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0071] Figure 1 This is a schematic flowchart of a laser focusing method provided in an embodiment of this application;
[0072] Figure 2 This is a schematic diagram showing the positional relationship between the laser emitter and the preset camera provided in an embodiment of this application;
[0073] Figure 3 This is a schematic diagram illustrating the trend of image brightness as a function of laser emitter height.
[0074] Figure 4 Another schematic flowchart of the laser focusing method provided in the embodiments of this application;
[0075] Figure 5 This is another schematic flowchart of the laser focusing method provided in the embodiments of this application;
[0076] Figure 6 A schematic diagram of a printed image provided for an embodiment of this application;
[0077] Figure 7 A schematic diagram of a focal position provided for an embodiment of this application;
[0078] Figure 8 This is a schematic diagram of the structure of a laser focusing system provided in an embodiment of this application;
[0079] Figure 9 This is a schematic diagram of the structure of a laser focusing device provided in an embodiment of this application;
[0080] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0081] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0082] The laser beam emitted by the laser emitter has a focal point, and the energy of the laser beam is highest at the focal point. Therefore, in order to achieve better results when using a laser emitter, the operator usually needs to manually adjust the height and angle of the laser emitter to complete the laser focusing. However, manually completing the laser focusing usually results in lower focusing efficiency and focusing accuracy.
[0083] To address the aforementioned problems, this application provides a laser focusing method.
[0084] This method can be applied to various scenarios requiring laser focusing of laser emitters. The embodiments in this application will not specifically limit the application scenarios.
[0085] Furthermore, the execution subject of the embodiments of the present invention can be various electronic devices capable of data processing, such as mobile phones, laptops, desktop computers, and cameras capable of data processing, etc.; wherein, the electronic device can be an independent electronic device or a device cluster composed of multiple electronic devices. In this application embodiment, no specific limitation is made, and it will be referred to as electronic device.
[0086] This application provides a laser focusing method that may include the following steps:
[0087] Acquire first images of each first printed pattern captured by a preset camera installed at a preset position; wherein each first printed pattern is printed on a preset plane when the laser emitter is at a specified angle and at each of the first preset heights within a first height range;
[0088] Determine the first direction of change of the height at which each first printed pattern is located when printing along the laser emitter, the first trend of change of the image features of each first image, and determine the target height at which the first trend of change satisfies the preset trend requirements; wherein the image features include: image brightness or image sharpness;
[0089] Acquire second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements; wherein, each second printed pattern is printed on the preset plane when the laser emitter is at the target height and at each preset angle;
[0090] When determining the target angle of the laser emitter and the target image features of the target image for printing a second print pattern used to acquire the target image;
[0091] If the target image features meet the preset feature requirements, then the target height and the target angle are respectively determined as the target focusing height and target focusing angle of the laser emitter.
[0092] As can be seen from the above, by applying the solution provided in the embodiments of this application, the laser emitter can print a first printed pattern on a preset plane when it is at a specified angle and at various first preset heights within a first height range. A preset camera installed at a preset position can capture first images of each of the first printed patterns printed by the laser emitter on the preset plane. Therefore, when performing laser focusing, the first images of each of the first printed patterns captured by the preset camera installed at the preset position can be acquired first, and then the first direction of change of the height along the laser emitter when printing each of the first printed patterns and the first trend of change of the image features of each of the first images can be determined. Since the focusing effect is better when the first trend of change meets the preset trend requirement, the target height at which the first trend of change meets the preset trend requirement can be determined after determining the first trend of change.
[0093] After determining the target height, the laser emitter can print a second printed pattern on a preset plane when it is at the target height and at various preset angles. A preset camera can capture second images of each of the second printed patterns printed on the preset plane. Therefore, after determining the target focusing height, it is also possible to acquire the second images of each of the second printed patterns captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements. Since the focusing effect is better when the image focus position meets the preset position requirements, the target angle of the laser emitter when printing the second printed pattern used to capture the target image can be determined, and the target image features of the target image can be determined.
[0094] If the target image features meet the preset feature requirements, it means that the target height and target angle of the laser emitter can meet the focusing accuracy requirements. Therefore, the target height and target angle can be determined as the target focusing height and target focusing angle of the laser emitter, respectively.
[0095] Based on this, the target focusing height and target focusing angle of the laser emitter can be determined, and the height and angle of the laser emitter can be adjusted according to the aforementioned target focusing height and target focusing angle, thereby completing the focusing of the laser emitter. Since the aforementioned target focusing height and target focusing angle are determined by image analysis of the first and second images, and do not require manual intervention, the solution provided by the embodiments of this application can improve the focusing efficiency and focusing accuracy of laser focusing compared to manual focusing, which requires manual intervention.
[0096] The following is a detailed description of a laser focusing method provided in the embodiments of this application, with reference to the accompanying drawings.
[0097] Figure 1 This is a schematic flowchart of a laser focusing method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method may include the following steps S101-S105.
[0098] S101: Obtain the first image of each first printed pattern captured by the preset camera installed at the preset position.
[0099] Each of the first printed patterns is printed on a preset plane when the laser emitter is at a specified angle and at a preset height within a first height range.
[0100] In the laser focusing method provided in this application embodiment, the laser emitter can print a first printed pattern on a preset plane when it is at a specified angle and at each of the first preset heights within a first height range; a preset camera installed at a preset position can capture the first images of each of the first printed patterns printed by the laser emitter on the preset plane; the electronic device can have a communication connection with the preset camera and acquire the first images of each of the first printed patterns captured by the preset camera.
[0101] The first printed pattern can be a QR code, an array pattern, a square, etc., and this application does not specifically limit it.
[0102] Optionally, the first printed pattern may be a pattern carrying height information and angle information of the laser emitter when printing the first printed pattern.
[0103] Optionally, in one specific implementation, the positional relationship between the laser emitter and the preset camera can be as follows: Figure 2 As shown, the laser emitter can print a first printed pattern on a preset plane via a galvanometer. The first printed pattern can reflect ambient light, and a portion of the reflected ambient light can be refracted by a prism to a preset camera installed at a preset position. Thus, the preset camera can capture the first image of each first printed pattern printed by the laser emitter on the preset plane.
[0104] Optionally, in one specific implementation, the height difference between any two adjacent first preset heights is a first value. A reference focusing height can be determined by manual observation, and the first value can be determined according to the focusing accuracy requirements. The first height range can be determined based on the reference focusing height and the first value.
[0105] For example, if it can be determined by manual observation that the laser beam's focus is near a preset plane when the laser emitter is at a height of 20 cm, then the reference focusing height can be determined to be 20 cm. Furthermore, if the focusing accuracy is 1 mm, then the first value can be determined to be 1 mm based on this focusing accuracy. Based on the reference focusing height and the first value, the first height range can be determined to be 19 cm - 21 cm. Furthermore, if the laser emitter is currently at a specified angle, the specified angle can be kept constant, and a first printed pattern can be printed on the preset plane at 1 mm intervals within the height range of 19 cm - 21 cm.
[0106] S102: Determine the first direction of change of the height at which each first printed pattern is located when printing along the laser emitter, the first trend of change of the image features of each first image, and determine the target height at which the first trend of change meets the preset trend requirements.
[0107] Among these image features are: image brightness or image clarity.
[0108] After acquiring the first images of each first printed pattern captured by the preset camera installed at the preset position, the first direction of change of the height at which each first printed pattern is printed along the laser emitter, the first trend of change of the image brightness of each first image, and the target height at which the first trend of change meets the preset trend requirements can be determined.
[0109] Taking laser printing as an example, during laser printing, the power of the laser emitter is fixed, and the laser beam emitted by the laser emitter has a focal point. When using the laser emitter to print a pattern on a preset plane, the printed pattern can be considered as being composed of multiple points. When the laser emitter prints each point that makes up the pattern on the preset plane, if the focal point of the laser beam is exactly located on the preset plane, the laser beam can print a clear pattern on the preset plane; if the focal point of the laser beam is not located on the preset plane for some points in the printed pattern, the laser beam will affect the points in the surrounding area of those points, resulting in a blurry pattern in the area surrounding those points in the printed pattern on the preset plane.
[0110] Furthermore, the material used for laser printing, namely the material of the aforementioned preset plane, is mostly aluminum sheet with a black coating. Laser printing can dissolve the black coating on the surface of the aluminum sheet, thus making the laser-printed pattern appear silver-white, which is the color of aluminum metal.
[0111] Based on the characteristics of laser printing, when the focal point of the laser beam is located on a preset plane, the image of the pattern printed by the laser emitter, captured by the camera, is the clearest and brightest. As the focal point gradually approaches the preset plane, the image of the pattern printed by the laser emitter, captured by the camera, gradually becomes clearer and brighter. As the focal point gradually moves away from the preset plane, the image of the pattern printed by the laser emitter, captured by the camera, gradually becomes blurry and brighter. Furthermore, as the height of the laser emitter changes from low to high or from high to low, the focal point of the laser beam can gradually approach, reach, and then move away from the preset plane; the brightness of the image of the pattern printed by the laser emitter, captured by the camera, can gradually increase to its maximum and then gradually decrease; the clarity of the image of the pattern printed by the laser emitter, captured by the camera, can gradually increase to its maximum and then gradually decrease.
[0112] For example, as the height of the laser emitter changes from low to high, the trend of brightness variation in the image of the pattern printed by the laser emitter, captured by the camera, can be as follows: Figure 3 As shown, when the image brightness of the pattern printed by the laser emitter is at its maximum, the trend of image brightness change is the most gradual, and the trend of image brightness change changes from gradually increasing to gradually decreasing. Therefore, after acquiring each first image acquired by the preset camera, the first trend of image brightness change of each first image can be determined according to the first direction of change of the height at which the laser emitter prints each first printed pattern, and the target height at which the first trend of change satisfies the preset trend requirement can be determined.
[0113] The aforementioned first direction of change can be either the direction in which the laser emitter is at a height from high to low when printing each first printed pattern, or the direction in which the laser emitter is at a height from low to high when printing each first printed pattern.
[0114] Optionally, in one specific implementation, an image brightness variation curve can be fitted based on the height at which the laser emitter prints each first printed pattern and the image brightness of the first image corresponding to each first printed pattern. This image brightness variation curve is then determined as the first trend of image brightness variation of each first image along the first direction of change of the height at which the laser emitter prints each first printed pattern.
[0115] The aforementioned preset trend requirement could be a change in the trend, a change in the smoothness of the trend being less than a preset smoothness level, or a change in the smoothness of the trend being minimal, etc. This application does not specifically limit this requirement; those skilled in the art can determine the aforementioned preset trend requirement based on actual application conditions and focusing accuracy requirements.
[0116] S103: Acquire the second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements.
[0117] Each of the second printed patterns is printed on a preset plane when the laser emitter is at the target height and at each preset angle.
[0118] S104: When determining the target angle of the laser emitter and the target image features of the target image when printing the second printed pattern used to acquire the target image.
[0119] After determining the target height, the laser emitter can print a second pattern on a preset plane when it is at the target height and at various preset angles. A preset camera can then capture second images of each of the second printed patterns printed on the preset plane. Therefore, after determining the target height, the electronic device can acquire the second images of each of the second printed patterns captured by the preset camera.
[0120] During laser focusing, it is crucial to determine not only the appropriate focusing height but also the appropriate focusing angle. Based on these suitable heights and angles, a better focusing effect can be achieved. Since the focal point of each second image corresponding to each second printed pattern on the preset plane differs depending on the laser emitter's angle at which it is positioned, the laser emitter's focusing angle can be determined based on the focal point positions of the second images corresponding to each second printed pattern on the preset plane at different angles.
[0121] Since the focusing effect is better when the image focus position meets the preset position requirements, after acquiring the second images of each second printed pattern captured by the preset camera, the target image in the second image whose image focus position meets the preset position requirements can be determined, and the target angle of the laser emitter and the target image features of the target image can be determined when printing the second printed pattern used to acquire the target image.
[0122] Among them, the target image whose image focal position meets the preset position requirements can be a target image whose image focal position is located in the center area of the image.
[0123] The aforementioned preset angles can be multiple different angles set by those skilled in the art based on actual application conditions. Therefore, the embodiments of this application do not impose specific limitations on them.
[0124] S105: If the target image features meet the preset feature requirements, then the target height and target angle are determined as the target focusing height and target focusing angle of the laser emitter, respectively.
[0125] If the target image features meet the preset feature requirements, it means that the target height and target angle can meet the focusing accuracy requirements. Therefore, the target height and target angle can be determined as the target focusing height and target focusing angle of the laser emitter, respectively.
[0126] Wherein, when the target image feature is the brightness of the target image, the above-mentioned preset feature requirement can be a preset brightness requirement; when the target image feature is the sharpness of the target image, the above-mentioned preset feature requirement can be a preset sharpness requirement.
[0127] Based on this, the target focusing height and target focusing angle of the laser emitter can be determined, and the height and angle of the laser emitter can be adjusted according to the aforementioned target focusing height and target focusing angle, thereby completing the focusing of the laser emitter. Since the aforementioned target focusing height and target focusing angle are determined by image analysis of the first and second images, and do not require manual intervention, the solution provided by the embodiments of this application can improve the focusing efficiency and focusing accuracy of laser focusing compared to manual focusing, which requires manual intervention.
[0128] Optionally, in one specific implementation, the laser focusing method provided in this application embodiment may further include the following step 11.
[0129] Step 11: If the target image features do not meet the preset feature requirements, then the target angle and the height range determined according to the target height are respectively determined as the specified angle and the first height range, and the process returns to the step of obtaining the first image of each first printed pattern acquired by the preset camera installed at the preset position.
[0130] If the target image features do not meet the preset feature requirements, it means that the current target height and target angle cannot meet the focusing accuracy requirements. Then, the target angle and the height range determined according to the target height can be determined as the specified angle and the first height range, respectively. Then, return to the step of obtaining the first image of each first printed pattern captured by the preset camera installed at the preset position, and continue to determine the target height and target angle until the target image features can meet the preset feature requirements.
[0131] Alternatively, in one specific implementation, such as Figure 4 As shown, step S103 above: acquiring the second images of each second printed pattern captured by the preset camera, and determining the target image in the second image whose image focus position meets the preset position requirements, may include the following steps S401-S403.
[0132] S401: Acquire a second image of the current second printed pattern captured by the preset camera, and determine the image focus position of the second image.
[0133] First, after each second printed pattern is printed by the laser emitter and the preset camera captures the second image of the second printed pattern, the second image of the current second printed pattern captured by the preset camera can be obtained, and the image focus position of the second image can be determined.
[0134] Optionally, in one specific implementation, the brightest position in the second image can be determined as the image focus position of the second image.
[0135] S402: If the image focus position meets the preset position requirements, then the second image is determined as the target image.
[0136] If the focal position of the image meets the preset position requirements, it means that the laser emitter has a good focusing effect at the angle when printing the second printed pattern contained in the second image, and thus the second image can be determined as the target image.
[0137] S403: If the image focus position does not meet the preset position requirements, determine the direction of the image brightness change of the second image, and determine the new second printed pattern printed on the preset plane at the specified angle after the laser emitter is adjusted according to the direction of the image brightness change as the current printed pattern; return to step S401.
[0138] If the focal position of the aforementioned image does not meet the preset position requirement, the direction of brightness variation in the second image can be determined. This allows the laser emitter to adjust its angle to a specified angle based on the direction of brightness variation, and print a new second printed pattern on a preset plane at the specified angle. The electronic device can then identify this new second printed pattern as the current printed pattern and return to the second image of the current second printed pattern captured by the preset camera. This process is repeated until the focal position of the image meets the preset position requirement, thus obtaining the target image.
[0139] Optionally, in one specific implementation, determining the direction of brightness and darkness change of the second image may include the following step 21.
[0140] Step 21: Perform Gaussian blur processing on the second image to obtain the brightest and darkest areas in the second image, and determine the direction of brightness change of the second image based on the positional relationship between the brightest and darkest areas.
[0141] In other words, when determining the direction of brightness change in the second image, Gaussian blur processing can be applied to the second image, and the brightest and darkest regions in the second image can be determined based on the result of the Gaussian blur processing. Then, the direction of brightness change in the second image can be determined based on the positional relationship between the brightest and darkest regions.
[0142] Optionally, the Gaussian blurring of the second image described above can be achieved using the following two-dimensional Gaussian function filtering formula.
[0143]
[0144] Among them, G i To obtain the pixel value of the i-th pixel after applying Gaussian blur to the second image; x i Let y be the x-coordinate of the i-th pixel in the second image; i Let be the ordinate of the i-th pixel in the second image; σ is a constant that can be set by those skilled in the art according to the actual application.
[0145] Based on this, by applying this specific implementation method, when determining a target image whose image focus position meets the preset position requirements, the angle of the laser emitter can be adjusted after each second printed pattern is printed. This allows the target image whose image focus position meets the preset position requirements to be found with fewer pattern printings, thereby improving the efficiency of determining the target focus angle.
[0146] One possible specific implementation method, such as Figure 5 As shown, in step S102 above, determining the target height where the first trend of change meets the preset trend requirements may include the following steps S501-S503.
[0147] S501: Determine the second height range where the first trend of change meets the preset trend requirements.
[0148] The second altitude range is smaller than the first altitude range;
[0149] In some cases, in order to further improve the efficiency and accuracy of determining the target focus height, the first height range can be set to a larger range first, and then a second height range in which the first change trend meets the preset trend requirements can be determined based on the first change trend.
[0150] Since the second height range is determined based on the first trend of change, compared to the first height range, the second height range can more accurately define the height range in which the target is focused.
[0151] S502: Acquire the third image of each third printed pattern captured by the preset camera.
[0152] Each of the third printed patterns is printed on a preset plane when the laser emitter is at a specified angle and at each of the second preset heights within the second height range, and the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights.
[0153] After determining the second height range, the height difference between any two adjacent second preset heights within the second height range can be made smaller than the height difference between any two adjacent first preset heights. Therefore, the laser emitter can print each third printed pattern on a preset plane when it is at a specified angle and at each of the respective second preset heights within the second height range; the preset camera can capture images of each third printed pattern and generate each third image. Furthermore, the electronic device can acquire the third images of each third printed pattern captured by the preset camera.
[0154] Optionally, in one specific implementation, the height difference between any two adjacent first preset heights can be a first value, and the height difference between any two adjacent second preset heights can be a second value, wherein the first value is greater than the second value.
[0155] S503: Determine the second direction of change of the height at which each third printed pattern is located when the laser emitter prints each third printed pattern, the second trend of change of the image brightness of each third image, and determine the target height at which the second trend of change meets the preset trend requirements.
[0156] After acquiring each third image captured by the preset camera, the second trend of image brightness change of each third image can be determined according to the second direction of change of the height at which the laser emitter prints each third printed pattern, and the target height at which the second trend of change meets the preset trend requirements can be determined.
[0157] Therefore, since the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights, the target height determined based on the second preset height can have higher accuracy compared to the target height determined based on the first preset height. Furthermore, compared to directly determining the target height based on the first preset height, first determining the second height range based on the first preset height, and then determining the target focus height based on the second preset height, allows for a higher-precision target focus height to be obtained with fewer pattern printing operations, thereby further improving focusing efficiency and accuracy.
[0158] Optionally, in one specific implementation, the printed pattern printed by the laser emitter on the preset plane can consist of an inner layer pattern and an outer layer pattern. The printed pattern provided in this embodiment can be as follows: Figure 6As shown, the inner pattern can be a QR code pattern, and the outer pattern can be a specified number of rectangular patterns of equal size surrounding the QR code pattern. Furthermore, the spacing between any two adjacent rectangular patterns is the same. Each printed pattern contains the height information and angle information of the laser emitter when printing the printed pattern.
[0159] Based on this, before step S102 above: determining the first direction of change of the height at which each first printed pattern is located when printing each first printed pattern along the laser emitter, the first trend of change of the image features of each first image, and determining the target height at which the first trend of change meets the preset trend requirements, the laser focusing method provided in this application embodiment may further include the following step 31.
[0160] Step 31: Determine the height of the laser emitter when printing the first printed pattern used to capture the first image, based on the QR code pattern in each first image.
[0161] Since the QR code pattern in each printed pattern carries the height information of the laser emitter when printing the printed pattern, the height of the laser emitter when printing the first printed pattern used to capture the first image can be determined based on the QR code pattern in each first image.
[0162] In step S104 above, determining the target image in the second image whose image focus position meets the preset position requirements may include the following step 32.
[0163] Step 32: Based on the outer pattern in the second image, determine the target image in the second image whose image focal position meets the preset position requirements.
[0164] When the second printed pattern is as follows Figure 6 When printing the pattern shown, when determining the target image in the second image whose image focus position meets the preset position requirements, the target image in the second image whose image focus position meets the preset position requirements can be determined based on the outer layer pattern in the second image.
[0165] For example, such as Figure 7 As shown, the brightest position in the outer pattern can be determined as the focal point.
[0166] Step S105 above: Determining the target angle of the laser emitter when printing the second printed pattern used to acquire the target image as the target focusing angle of the laser emitter may include the following step 33.
[0167] Step 33: Based on the QR code pattern in the target image, determine the target angle of the laser emitter when printing the second printed pattern used to acquire the target image, and determine the target angle as the target focusing angle of the laser emitter.
[0168] When the second printed pattern is as follows Figure 6 When printing the pattern shown, since the QR code pattern in each printed pattern carries the angle information of the laser emitter's height when printing the printed pattern, the target angle of the laser emitter when printing the second printed pattern for acquiring the target image can be determined based on the QR code pattern in the target image, and the target angle can be determined as the target focusing angle of the laser emitter.
[0169] Corresponding to the laser focusing method provided in the above embodiments of this application, this application also provides a laser focusing system.
[0170] Figure 8 This is a schematic diagram of the structure of a laser focusing system provided in an embodiment of this application, as shown below. Figure 8 As shown, the laser focusing system may include: a processor 801, a laser emitter 802, and a camera 803.
[0171] The processor 801 can be used to implement the steps of any laser focusing method provided in the embodiments of this application.
[0172] The laser emitter 802 can be used to print patterns on a preset plane.
[0173] Camera 803 can be used to capture images of patterns printed on a preset plane by a laser emitter.
[0174] Corresponding to the laser focusing method provided in the above embodiments of this application, this application also provides a laser focusing device.
[0175] Figure 9 This is a schematic diagram of the structure of a laser focusing device provided in an embodiment of this application, as shown below. Figure 9 As shown, the laser focusing device may include the following modules.
[0176] Image acquisition module 901 is used to acquire first images of each first printed pattern captured by a preset camera installed at a preset position; wherein each first printed pattern is printed on a preset plane when the laser emitter is at a specified angle and at each of the first preset heights within a first height range.
[0177] The trend determination module 902 is used to determine the first direction of change of the height of each first printed pattern when printing along the laser emitter, the first trend of change of the image features of each first image, and to determine the target height at which the first trend of change meets the preset trend requirements; wherein the image features include: image brightness or image sharpness.
[0178] The image determination module 903 is used to acquire second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements; wherein each second printed pattern is printed on the preset plane when the laser emitter is at the target height and at each preset angle.
[0179] Angle determination module 904 is used to determine the target angle of the laser emitter and the target image features of the target image when printing the second printed pattern used to acquire the target image.
[0180] The focus determination module 905 is used to determine the target height and the target angle as the target focus height and target focus angle of the laser emitter, respectively, if the target image features meet the preset feature requirements.
[0181] As can be seen from the above, by applying the solution provided in the embodiments of this application, the laser emitter can print a first printed pattern on a preset plane when it is at a specified angle and at various first preset heights within a first height range. A preset camera installed at a preset position can capture first images of each of the first printed patterns printed by the laser emitter on the preset plane. Therefore, when performing laser focusing, the first images of each of the first printed patterns captured by the preset camera installed at the preset position can be acquired first, and then the first direction of change of the height along the laser emitter when printing each of the first printed patterns and the first trend of change of the image features of each of the first images can be determined. Since the focusing effect is better when the first trend of change meets the preset trend requirement, the target height at which the first trend of change meets the preset trend requirement can be determined after determining the first trend of change.
[0182] After determining the target height, the laser emitter can print a second printed pattern on a preset plane when it is at the target height and at various preset angles. A preset camera can capture second images of each of the second printed patterns printed on the preset plane. Therefore, after determining the target focusing height, it is also possible to acquire the second images of each of the second printed patterns captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements. Since the focusing effect is better when the image focus position meets the preset position requirements, the target angle of the laser emitter when printing the second printed pattern used to capture the target image can be determined, and the target image features of the target image can be determined.
[0183] If the target image features meet the preset feature requirements, it means that the target height and target angle of the laser emitter can meet the focusing accuracy requirements. Therefore, the target height and target angle can be determined as the target focusing height and target focusing angle of the laser emitter, respectively.
[0184] Based on this, the target focusing height and target focusing angle of the laser emitter can be determined, and the height and angle of the laser emitter can be adjusted according to the aforementioned target focusing height and target focusing angle, thereby completing the focusing of the laser emitter. Since the aforementioned target focusing height and target focusing angle are determined by image analysis of the first and second images, and do not require manual intervention, the solution provided by the embodiments of this application can improve the focusing efficiency and focusing accuracy of laser focusing compared to manual focusing, which requires manual intervention.
[0185] Optionally, in one specific implementation, the apparatus further includes:
[0186] The range determination module is used to determine the target angle and the height range determined according to the target height as the specified angle and the first height range respectively if the target image features do not meet the preset feature requirements, and return to the step of obtaining the first image of each first printed pattern acquired by the preset camera installed at the preset position.
[0187] Optionally, in one specific implementation, the trend determination module includes:
[0188] The range determination submodule is used to determine a second height range in which the first change trend meets a preset trend requirement; wherein the second height range is smaller than the first height range;
[0189] The image acquisition submodule is used to acquire the third images of each third printed pattern captured by the preset camera; wherein each third printed pattern is printed on the preset plane when the laser emitter is at the specified angle and at each of the second preset heights within the second height range, and the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights.
[0190] The trend determination submodule is used to determine the second direction of change of the height at which each third printed pattern is located when printing along the laser emitter, the second trend of change of the image brightness of each third image, and to determine the target height at which the second trend of change meets the preset trend requirements.
[0191] Optionally, in one specific implementation, the height difference between any two adjacent first preset heights is a first value, and the height difference between any two adjacent second preset heights is a second value, wherein the first value is greater than the second value.
[0192] Optionally, in one specific implementation, the image determination module is specifically used for:
[0193] Acquire a second image of the current second printed pattern captured by the preset camera, and determine the image focus position of the second image;
[0194] If the focal position of the image meets the preset position requirements, then the second image is determined as the target image;
[0195] Otherwise, determine the direction of brightness change of the second image, and determine the new second printed pattern printed by the laser emitter at a specified angle adjusted according to the direction of brightness change on the preset plane as the current printed pattern; return to the second image of the current second printed pattern acquired by the preset camera.
[0196] Optionally, in one specific implementation, the image determination module is specifically used for:
[0197] The second image is subjected to Gaussian blurring to obtain the brightest and darkest regions in the second image; and the direction of brightness variation in the second image is determined based on the positional relationship between the brightest and darkest regions.
[0198] Optionally, in one specific implementation, the printed pattern printed by the laser emitter on the preset plane consists of an inner pattern and an outer pattern. The inner pattern is a QR code pattern, and the outer pattern is a specified number of rectangular patterns of equal size distributed around the QR code pattern. Furthermore, the spacing between any two adjacent rectangular patterns is the same. The QR code pattern in each printed pattern carries the height information and angle information of the laser emitter when printing the printed pattern.
[0199] The device further includes:
[0200] A QR code recognition module is used to determine the height of the laser emitter when printing a first printed pattern for capturing the first image, based on the QR code pattern in each first image.
[0201] The image determination module is specifically used for:
[0202] Based on the outer pattern in the second image, determine the target image in the second image whose image focal position meets the preset position requirements;
[0203] The angle determination module is specifically used for:
[0204] Based on the QR code pattern in the target image, determine the target angle of the laser emitter when printing the second printed pattern used to acquire the target image.
[0205] This application also provides an electronic device, such as... Figure 10 As shown, it includes:
[0206] Memory 1001 is used to store computer programs;
[0207] The processor 1002, when executing the program stored in the memory 1001, implements the steps of any laser focusing method provided in the embodiments of this application.
[0208] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 1002, the communication interface, and the memory 1001 communicating with each other via the communication bus.
[0209] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0210] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0211] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0212] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0213] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the laser focusing methods described above.
[0214] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the laser focusing methods described above.
[0215] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), etc.
[0216] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0217] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments, device embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0218] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A laser focusing method, characterized in that, The method includes: Acquire first images of each first printed pattern captured by a preset camera installed at a preset position; wherein each first printed pattern is printed on a preset plane when the laser emitter is at a specified angle and at each of the first preset heights within a first height range; Determine the first direction of change of the height at which each first printed pattern is located when printing along the laser emitter, the first trend of change of the image features of each first image, and determine the target height at which the first trend of change satisfies the preset trend requirements; wherein the image features include: image brightness or image sharpness; Acquire second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements; wherein, each second printed pattern is printed on the preset plane when the laser emitter is at the target height and at each preset angle; When determining the target angle of the laser emitter and the target image features of the target image for printing a second print pattern used to acquire the target image; If the target image features meet the preset feature requirements, then the target height and the target angle are respectively determined as the target focusing height and target focusing angle of the laser emitter.
2. The method according to claim 1, characterized in that, The method further includes: If the target image features do not meet the preset feature requirements, then the target angle and the height range determined according to the target height are respectively determined as the specified angle and the first height range, and the step of obtaining the first image of each first printed pattern acquired by the preset camera installed at the preset position is returned.
3. The method according to claim 1, characterized in that, Determining the target height at which the first trend of change meets the preset trend requirements includes: Determine a second height range within which the first change trend meets a preset trend requirement; wherein the second height range is smaller than the first height range; Acquire third images of each third printed pattern captured by the preset camera; wherein each third printed pattern is printed on the preset plane when the laser emitter is at the specified angle and at each of the second preset heights within the second height range, and the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights. Determine the second direction of change of the height at which each third printed pattern is located when printing along the laser emitter, the second trend of change of the image brightness of each third image, and determine the target height at which the second trend of change satisfies the preset trend requirements.
4. The method according to claim 3, characterized in that, The height difference between any two adjacent first preset heights is a first value, and the height difference between any two adjacent second preset heights is a second value, wherein the first value is greater than the second value.
5. The method according to claim 1, characterized in that, The step of acquiring second images of each second printed pattern captured by the preset camera, and determining a target image in the second image whose image focus position meets the preset position requirement, includes: Acquire a second image of the current second printed pattern captured by the preset camera, and determine the image focus position of the second image; If the focal position of the image meets the preset position requirements, then the second image is determined as the target image; Otherwise, determine the direction of brightness change of the second image, and determine the new second printed pattern printed by the laser emitter at a specified angle adjusted according to the direction of brightness change on the preset plane as the current printed pattern; return to the second image of the current second printed pattern acquired by the preset camera.
6. The method according to claim 5, characterized in that, Determining the direction of brightness variation in the second image includes: The second image is subjected to Gaussian blurring to obtain the brightest and darkest regions in the second image; and the direction of brightness variation in the second image is determined based on the positional relationship between the brightest and darkest regions.
7. The method according to any one of claims 1-6, characterized in that, The printed pattern printed by the laser emitter on the preset plane consists of an inner pattern and an outer pattern. The inner pattern is a QR code pattern, and the outer pattern is a specified number of rectangular patterns of equal size distributed around the QR code pattern. The spacing between any two adjacent rectangular patterns is the same. The QR code pattern in each printed pattern carries the height information and angle information of the laser emitter when printing the printed pattern. Before determining the first direction of change of height along the laser emitter when printing each first printed pattern, and the first trend of change of image features of each first image, the method further includes: Based on the QR code pattern in each first image, determine the height of the laser emitter when printing the first printed pattern used to capture the first image; Determining the target image in the second image whose image focal position meets the preset position requirements includes: Based on the outer pattern in the second image, determine the target image in the second image whose image focal position meets the preset position requirements; When determining the target angle of the laser emitter during the printing of the second print pattern used to acquire the target image, the target angle includes: Based on the QR code pattern in the target image, determine the target angle of the laser emitter when printing the second printed pattern used to acquire the target image.
8. A laser focusing device, characterized in that, The device includes: The image acquisition module is used to acquire first images of each first printed pattern captured by a preset camera installed at a preset position; wherein each first printed pattern is printed on a preset plane when the laser emitter is at a specified angle and at each of the first preset heights within a first height range; The trend determination module is used to determine the first direction of change of the height of each first printed pattern when printing along the laser emitter, the first trend of change of the image features of each first image, and to determine the target height at which the first trend of change satisfies a preset trend requirement; wherein the image features include: image brightness or image sharpness. The image determination module is used to acquire second images of each second printed pattern captured by the preset camera, and determine the target image in the second image whose image focus position meets the preset position requirements; wherein, each second printed pattern is printed on the preset plane when the laser emitter is at the target height and at each preset angle; An angle determination module is used to determine the target angle of the laser emitter and the target image features of the target image when printing a second printed pattern used to acquire the target image; The focus determination module is used to determine the target height and the target angle as the target focus height and target focus angle of the laser emitter, respectively, if the target image features meet the preset feature requirements.
9. The apparatus according to claim 8, characterized in that, The device further includes: The range determination module is used to determine the target angle and the height range determined according to the target height as the specified angle and the first height range respectively if the target image features do not meet the preset feature requirements, and return to the step of obtaining the first image of each first printed pattern captured by the preset camera installed at the preset position; And / or, The trend determination module includes: The range determination submodule is used to determine a second height range in which the first change trend meets a preset trend requirement; wherein the second height range is smaller than the first height range; The image acquisition submodule is used to acquire the third images of each third printed pattern captured by the preset camera; wherein each third printed pattern is printed on the preset plane when the laser emitter is at the specified angle and at each of the second preset heights within the second height range, and the height difference between any two adjacent second preset heights is less than the height difference between any two adjacent first preset heights. The trend determination submodule is used to determine the second change direction of the height at which each third printed pattern is located when printing along the laser emitter, the second change trend of the image brightness of each third image, and to determine the target height at which the second change trend meets the preset trend requirements; And / or, The height difference between any two adjacent first preset heights is a first value, and the height difference between any two adjacent second preset heights is a second value, wherein the first value is greater than the second value; And / or, The image determination module is specifically used for: Acquire a second image of the current second printed pattern captured by the preset camera, and determine the image focus position of the second image; If the focal position of the image meets the preset position requirements, then the second image is determined as the target image; Otherwise, determine the direction of brightness variation in the second image, and determine the new second printed pattern printed by the laser emitter at a specified angle adjusted according to the direction of brightness variation on the preset plane as the current printed pattern; return to the second image of the current second printed pattern captured by the preset camera; And / or, The image determination module is specifically used for: The second image is subjected to Gaussian blurring to obtain the brightest and darkest regions in the second image; and the direction of brightness variation in the second image is determined based on the positional relationship between the brightest and darkest regions. And / or, The printed pattern printed by the laser emitter on the preset plane consists of an inner pattern and an outer pattern. The inner pattern is a QR code pattern, and the outer pattern is a specified number of rectangular patterns of equal size distributed around the QR code pattern. The spacing between any two adjacent rectangular patterns is the same. The QR code pattern in each printed pattern carries the height information and angle information of the laser emitter when printing the printed pattern. The device further includes: A QR code recognition module is used to determine the height of the laser emitter when printing a first printed pattern for capturing the first image, based on the QR code pattern in each first image. The image determination module is specifically used for: Based on the outer pattern in the second image, determine the target image in the second image whose image focal position meets the preset position requirements; The angle determination module is specifically used for: Based on the QR code pattern in the target image, determine the target angle of the laser emitter when printing the second printed pattern used to acquire the target image.
10. A laser focusing system, characterized in that, The system includes: a processor, a laser emitter, and a camera; The processor is used to implement the method according to any one of claims 1-7; The laser emitter is used to print patterns on a preset plane; The camera is used to capture images of the patterns printed by the laser emitter on a preset plane.
11. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-7.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.
Citation Information
Patent Citations
Focusing position adjusting method, focusing position adjusting device, and laser processing device
CN102896420A
Laser marking machine and adjusting method
CN113319423A
