Target object recognition method, laser engraving equipment and computer storage medium
By performing frequency domain conversion and clustering processing on the images of laser engraving equipment, calculating unit vector angles to identify the bearing plate, solving the problem of rapid accuracy of bearing plate detection in laser engraving equipment and ensuring the laser engraving effect.
Patent Information
- Application Number
- CN202510550043.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-08
AI Technical Summary
In laser engraving equipment, how to quickly and accurately detect whether there is a bearing plate on the processing platform to ensure that the laser engraving effect is not affected.
By dividing the image to be detected into a plurality of sub-images, and performing frequency domain conversion and clustering processing on each sub-image, the angle between unit vectors is calculated, and whether the angle to be detected is within a preset range, to identify the existence of the target object.
It realizes the rapid and accurate identification of the existence of the bearing plate, ensures the laser engraving effect, reduces the computational complexity and improves the universality.
Smart Images

Figure CN120451503A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image detection technology, and in particular to a target object recognition method, laser engraving equipment, and computer storage medium. Background Art
[0002] In some areas, it's necessary to determine whether a target object exists within a certain area. For example, when using high-power laser engraving or cutting, a carrier plate with a characteristic shape is often placed on the laser engraving machine's processing platform. The material to be processed is then placed on the carrier plate to protect the laser engraving machine during the engraving process.
[0003] However, placing a carrier plate on the processing platform changes the working distance between the material being processed and the laser in the laser engraving equipment, which in turn affects the engraving effect of the laser engraving equipment. How to quickly and accurately detect whether the carrier plate is placed on the processing platform before laser engraving becomes a pressing problem. Summary of the Invention
[0004] In view of this, the present application provides a target object recognition method, a laser engraving device and a computer storage medium, which can quickly and accurately detect whether a carrier plate is placed on the processing platform before laser engraving, thereby ensuring the effect of laser engraving.
[0005] A first aspect of the present application provides a target object recognition method, which includes: dividing an image to be detected into multiple sub-images, wherein the image to be detected is an image of a processing platform including a laser engraving device; performing frequency domain conversion on each of the sub-images to obtain multiple frequency domain images, wherein each of the sub-images corresponds to one frequency domain image; performing clustering processing on each of the frequency domain images to obtain multiple cluster centers, wherein one frequency domain image corresponds to multiple cluster centers; taking any one of the multiple frequency domain images as a target frequency domain image, and respectively calculating vectors between the center of the target frequency domain image and the multiple cluster centers corresponding to the target frequency domain image to obtain multiple unit vectors; sorting the multiple unit vectors according to a preset rule, and calculating the angle between each two adjacent unit vectors after sorting to obtain multiple angles to be detected, wherein the angles to be detected are used to characterize the characteristics of the target object; when the multiple angles to be detected are all within a preset angle range, determining that the image to be detected contains the target object.
[0006] Compared with the related art, the embodiments of the present application have at least the following advantages: First, the image to be detected is divided into multiple sub-images, and each sub-image is converted into the frequency domain to obtain a frequency domain image that can reflect the frequency characteristics. Then, the cluster center of each frequency domain image is calculated, and based on the cluster center, the multiple images to be detected corresponding to each frequency domain image are determined to improve the versatility of target object detection. Next, it is detected whether the multiple angles to be detected corresponding to the target frequency domain image are all within the preset angle range. When it is detected that the multiple angles to be detected corresponding to any frequency domain image are all within the preset angle range, it indicates that the target object exists in the image to be detected. In this way, the target object can be identified quickly and accurately, so that the user can determine whether to adjust the focus of the laser based on the recognition result to ensure the effect of laser engraving.
[0007] In some possible implementations, after obtaining at least one angle to be detected based on the angle between the multiple unit vectors, it also includes: when any one of the at least one angle to be detected is not within the preset angle range, taking any other frequency domain image except the target frequency domain image as the new target frequency domain image; if each of the angles to be detected corresponding to the new target frequency domain image is within the preset angle range, it is determined that the image to be detected contains the target object.
[0008] In some possible implementations, the method further includes: when the target detection angle corresponding to each of the frequency domain images is not within the preset angle range, determining that the image to be detected does not contain the target object, and the target detection angle is any one of the at least one detection angle corresponding to any one of the frequency domain images.
[0009] In some possible implementations, the unit vector includes a first unit vector; the respectively calculating the vectors between the center of the target frequency domain image and the multiple cluster centers corresponding to the target frequency domain image to obtain multiple unit vectors includes: respectively calculating the vectors from the center of the target frequency domain image to the multiple cluster centers corresponding to the target frequency domain image to obtain multiple first unit vectors; the calculating the angles between the multiple unit vectors to obtain multiple angles to be detected includes: respectively calculating the angle between each first unit vector and a first preset direction to obtain multiple first angles; sorting the multiple first angles in ascending order; sorting the multiple first unit vectors based on the ascending sorting results of the multiple first angles; calculating the angle between each two adjacent first unit vectors after sorting to obtain multiple angles to be detected.
[0010] In some possible implementations, the unit vector includes a second unit vector; the respectively calculating the vectors between the center of the target frequency domain image and the multiple cluster centers corresponding to the target frequency domain image to obtain multiple unit vectors includes: respectively calculating the vectors from the multiple cluster centers corresponding to the target frequency domain image to the center of the target frequency domain image to obtain multiple second unit vectors; the calculating the angles between the multiple unit vectors to obtain multiple angles to be detected includes: respectively calculating the angle between each second unit vector and a second preset direction to obtain multiple second angles; sorting the multiple second angles in descending order; sorting the multiple second unit vectors based on the descending sorting results of the multiple second angles; calculating the angle between each two adjacent second unit vectors after sorting to obtain multiple angles to be detected.
[0011] In some possible implementations, clustering is performed on each of the frequency domain images to obtain a plurality of cluster centers, including: obtaining characteristic parameters of the target object, wherein the characteristic parameters characterize geometric features of the target object; clustering is performed on each of the frequency domain images based on the characteristic parameters to obtain a plurality of cluster centers, wherein the characteristic parameters are equal to the number of cluster centers corresponding to each of the frequency domain images.
[0012] In some possible implementations, clustering is performed on each of the frequency domain images to obtain multiple cluster centers, including: calculating each of the frequency domain images separately; binarizing each of the calculated frequency domain images to obtain multiple binary images, wherein one frequency domain image corresponds to one binary image; clustering is performed on each of the binary images to obtain multiple cluster centers, wherein one binary image corresponds to multiple cluster centers.
[0013] In some possible implementations, the calculating each of the frequency domain images includes: performing quadrant swapping on each of the frequency domain images to obtain a translated frequency domain image; and performing logarithmic processing on each of the translated frequency domain images.
[0014] A second aspect of the present application discloses a laser engraving device, which includes a memory and a processor. The processor is communicatively connected to the memory, and is configured to execute the target object recognition method described above.
[0015] A third aspect of the present application discloses a computer storage medium comprising computer instructions. When the computer instructions are executed on a laser engraving device, the laser engraving device executes the target object recognition method as described above.
[0016] It can be understood that the laser engraving device of the second aspect and the computer storage medium of the third aspect provided above correspond to the method of the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flowchart of the steps of a target object recognition method provided in one embodiment of the present application.
[0019] Figure 2 A flowchart of sub-steps of a target object recognition method provided in one embodiment of the present application.
[0020] Figure 3 for Figure 1 A simple diagram of multiple unit vectors in .
[0021] Figure 4 This is a flowchart of another seed step of the target object recognition method provided in one embodiment of the present application.
[0022] Figure 5 for Figure 1 Another simple illustration of multiple unit vectors in .
[0023] Figure 6 FIG. 1 is a schematic diagram of the hardware structure of a laser engraving device according to an embodiment of the present application.
[0024] The following specific implementation methods will further illustrate this application in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0025] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features therein can be combined with each other in the absence of conflict.
[0026] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application pertains. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0028] It should be further noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0029] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A alone, A and B together, and B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," and so on (if any) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or precedence.
[0030] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0031] When a laser engraving device performs high-power laser engraving or cutting, it is often necessary to first place a carrier plate with a characteristic shape on the processing platform of the laser engraving device. Then, the material to be processed is placed on the carrier plate to protect the laser engraving device during the laser engraving process.
[0032] However, placing a carrier plate on the processing platform will change the working distance between the material to be processed and the laser in the laser engraving equipment. At the same time, for the laser, the working distance is an important variable, because the focal length of the laser is fixed. Therefore, whether or not to place a carrier plate will determine whether the laser engraving equipment needs to move the Z axis in the laser engraving equipment to readjust the laser focus.
[0033] Therefore, before laser engraving, how to quickly and accurately detect whether a carrier plate is placed on the processing platform to prevent the user from forgetting to adjust the focus of the laser and affecting the engraving quality has become an urgent problem that needs to be solved.
[0034] Based on this, one embodiment of the present application provides a target object recognition method that can quickly and accurately identify the presence of a carrier plate within a laser engraving device. The following description uses a hexagonal honeycomb grid plate as an example. In other embodiments, the carrier plate can also be a grid plate with triangular or quadrilateral features. This application does not limit the shape of the carrier plate.
[0035] Please refer to Figure 1 , is a flowchart of the steps of a target object recognition method provided in one embodiment of the present application. In this embodiment, the target object recognition method is applied to a laser engraving device to identify whether a carrier plate is placed on the processing platform of the laser engraving device. In other embodiments, the target object recognition method can also be applied to other devices, and this application does not limit the type of device to which the target object recognition method is applied.
[0036] The target object recognition method includes the following steps: Step 101: Divide the image to be detected into multiple sub-images.
[0037] Before executing this step, the acquisition component within the laser engraving device must first capture an image of the processing platform to be inspected. This allows for subsequent inspection to determine whether the target object exists within the image. The target object can be a honeycomb grid panel with hexagonal features, or a grid panel with triangular features. The acquisition component can be a camera.
[0038] After the acquisition component acquires the image to be detected, the laser engraving device can divide the image to be detected into multiple sub-images. Specifically, the image to be detected is divided according to the preset row number values and the preset column number values to obtain multiple sub-images.
[0039] For example, suppose the size of the image to be detected is 1500 600, the row index range of the image to be detected is: 0 to 1499, and the column index range is: 0 to 599. At the same time, if the preset row number value is 150 and the preset column number value is 60, then in the 0-149 rows of the image to be detected, 10 sub-images can be divided from left to right, and the size of each sub-image is 150. 60; In columns 150-299 of the image to be detected, 10 sub-images can be divided according to the above method... and so on, to obtain multiple sub-images.
[0040] In this embodiment, after the image to be detected is divided, the number of the multiple sub-images obtained does not exceed a preset number threshold, wherein the preset number threshold can be the square of a positive integer such as 4 or 9, and can be set according to actual division requirements.
[0041] It should be noted that dividing the image to be detected helps provide an effective region of interest for the target object recognition method, thereby making it easier for the target object recognition method to perform effective calculations on the details of the image to be detected.
[0042] Step 102: Perform frequency domain conversion on each sub-image to obtain multiple frequency domain images.
[0043] In this embodiment, Fourier transform can be performed on each sub-image, so multiple frequency domain images can be obtained from one image to be detected, wherein each sub-image corresponds to a frequency domain image.
[0044] Step 103: Perform clustering processing on each frequency domain image to obtain multiple cluster centers. One frequency domain image corresponds to multiple cluster centers.
[0045] In some embodiments, clustering each frequency domain image to obtain a plurality of cluster centers includes receiving characteristic parameters of a target object to be identified, the characteristic parameters representing geometric features of the target object. Clustering each frequency domain image based on the characteristic parameters to obtain a plurality of cluster centers, wherein the characteristic parameters are equal to the number of cluster centers corresponding to each frequency domain image.
[0046] For example, before laser engraving, a laser engraving device needs to detect whether a honeycomb grid plate with hexagonal features is placed on the processing platform. In this case, the user can set the feature parameter in the laser engraving device to any of the following: edge number feature data, angle feature data, or vertex coordinate feature data. In this embodiment, the feature parameter is set to edge number feature data, and the feature parameter is 6.
[0047] Each frequency domain image is clustered based on the characteristic parameters to obtain 6 cluster centers. In other words, after clustering each frequency domain image, each frequency domain image can obtain 6 corresponding cluster centers.
[0048] In other embodiments, the characteristic parameter may also be set as angle characteristic data. The specific content of the characteristic parameter may be set according to actual needs, and this application does not limit this.
[0049] In this embodiment, a k-means clustering algorithm is used to cluster each frequency domain image, obtaining multiple cluster centers. The k-means clustering algorithm primarily involves determining the number of clusters, randomly initializing cluster centers, calculating the distance between data points and cluster centers, assigning data points to the nearest cluster center, updating cluster centers, and determining convergence conditions. When convergence is achieved, the clustering algorithm terminates and outputs the results.
[0050] In other embodiments, a hierarchical clustering algorithm or a density-based clustering algorithm may be used to perform clustering processing on each frequency domain image to obtain multiple cluster centers. This application does not limit the type of clustering algorithm used to perform clustering processing on each frequency domain image.
[0051] Furthermore, before clustering each frequency domain image, the frequency domain image must first be binarized. The specific steps include: calculating each frequency domain image separately. Binarizing each calculated frequency domain image to obtain multiple binary images, where one frequency domain image corresponds to one binary image. Then, clustering each binary image to obtain multiple cluster centers, where one binary image corresponds to multiple cluster centers.
[0052] In this embodiment, when binarization is performed on each calculated frequency domain image, the data threshold selected for binarization can be the 10th percentile pixel value after all pixel values in the frequency domain image being processed are sorted in descending order. In other embodiments, the data threshold selected for binarization can also be the 12th percentile pixel value or the 15th percentile pixel value after all pixel values in the frequency domain image being processed are sorted in descending order. The data threshold can be set according to actual binarization requirements, and this application does not limit the specific value of the data threshold selected for binarization.
[0053] Furthermore, the step of calculating each frequency domain image includes performing a quadrant swap on each frequency domain image to obtain a shifted frequency domain image. Each shifted frequency domain image is subjected to a logarithmic operation. In this manner, multiple calculated frequency domain images are obtained. In this embodiment, each shifted frequency domain image is subjected to a logarithmic operation using the natural logarithm base e as its base.
[0054] By first performing Fourier transform processing on the image to be detected, and then performing quadrant exchange, logarithm processing and binarization processing on the Fourier transform processed image in sequence, the obtained binary image can better reflect the data characteristics of the area that needs attention.
[0055] In this embodiment, in order to reduce the computational complexity of the target object recognition method, after obtaining multiple frequency domain images, non-zero valued pixels in each frequency domain image are obtained, so as to facilitate subsequent clustering processing of the non-zero valued pixels in each frequency domain image.
[0056] Step 104: taking any one of the multiple frequency domain images as a target frequency domain image, respectively calculating vectors between the center of the target frequency domain image and multiple cluster centers corresponding to the target frequency domain image to obtain multiple unit vectors.
[0057] In this embodiment, the unit vector includes a first unit vector and a second unit vector. It is assumed that the multiple cluster centers corresponding to the target frequency domain image are respectively recorded as the first target cluster center, the second target cluster center, and so on.
[0058] Then the first unit vector includes vectors respectively from the center of the target frequency domain image to the first target cluster center, the second target cluster center, .... The first unit vector includes vectors respectively from the first target cluster center, the second target cluster center, .... to the center of the target frequency domain image.
[0059] Step 105: Calculate the angles between multiple unit vectors to obtain at least one angle to be detected, where the angle to be detected is used to characterize the characteristics of the target object.
[0060] The steps of how to calculate the angle between multiple unit vectors and obtain at least one angle to be detected are described in detail below. To avoid repetition, they will not be repeated here.
[0061] In this embodiment, each frequency domain image corresponds to six cluster centers. Therefore, there are six unit vectors between the center of a frequency domain image and its corresponding six cluster centers. By calculating the angles between the six unit vectors, at least one angle to be detected can be obtained.
[0062] It should be noted that if the support plate is a quadrilateral grid plate, the user sets the characteristic parameter to 4 in the previous step. In this case, each frequency domain image corresponds to four cluster centers. Therefore, there are four unit vectors between the center of a frequency domain image and its corresponding four cluster centers. By calculating the angles between these four unit vectors, at least one angle to be detected can be obtained.
[0063] Step 106: When each of the angles to be detected is within the preset angle range, determine that the image to be detected contains the target object.
[0064] In this embodiment, the preset angle range may be 20°-80°. In other embodiments, the preset angle range may be 20°-60° or 30°-70°, and the preset angle range may be set according to actual angle detection requirements.
[0065] In some embodiments, when any one of at least one angle to be detected is not within a preset angle range, any frequency domain image other than the target frequency domain image is used as a new target frequency domain image. If each angle to be detected corresponding to the new target frequency domain image is within the preset angle range, it is determined that the image to be detected contains the target image.
[0066] In other embodiments, when the target detection angle corresponding to each frequency domain image is not within the preset angle range, it is determined that the image to be detected does not contain the target object, and the target detection angle is any one of the at least one detection angle corresponding to any frequency domain image.
[0067] It should be noted that if the image being inspected is determined to contain the target image, this indicates that a honeycomb grid plate has been added to the laser engraving machine's processing platform. Since the honeycomb grid plate was previously absent, the laser's working distance will change due to its presence, requiring the user or system to adjust the laser's focus. Conversely, if the image being inspected is determined not to contain the target image, this indicates that the honeycomb grid plate has been removed from the laser engraving machine's processing platform. Since the honeycomb grid plate was previously present, the user or system will also need to adjust the laser's focus. This ensures the desired laser engraving effect.
[0068] Compared with the related art, the embodiments of the present application have at least the following advantages: On the one hand, this embodiment utilizes Fourier transforms to process each sub-image to extract its frequency characteristics. Although fewer feature regions mean weaker characteristic frequency component amplitudes within the frequency domain image, by appropriately binarizing the frequency domain image, this embodiment is still able to capture the frequency components in the image to be detected. Therefore, this embodiment has relatively relaxed requirements for occlusion relationships, exposure parameters, and distortion levels within the image to be detected; that is, it does not require the image to have very high image quality.
[0069] On the other hand, after a period of use, the carrier plate may be deformed, or the shape characteristics of different models of carrier plates may be different. In order to improve the versatility of this embodiment, clustering processing and angle calculation methods are adopted so that the user only needs to set the characteristic parameters.
[0070] On the other hand, this embodiment only involves Fourier transforms, vector calculations, and clustering processing. The computational cost of the entire process is low, and the computing resources occupied during the calculation process are also small. By detecting whether each angle to be detected corresponding to the target frequency domain image is within a preset angle range. If each angle to be detected corresponding to any frequency domain image is within the preset angle range, it indicates that the target object exists in the image to be detected. In this way, the target object can be quickly and accurately identified, allowing the user to determine whether to adjust the focus of the laser based on the identification results to ensure the laser engraving effect.
[0071] Please refer to Figure 2 , is a flow chart of sub-steps of a target object recognition method provided in an embodiment of the present application. This embodiment specifically describes a process of sorting multiple unit vectors according to preset rules in the above embodiment. The specific steps include: Step 201: Calculate the vectors from the center of the target frequency domain image to the multiple cluster centers corresponding to the target frequency domain image to obtain multiple first unit vectors.
[0072] like Figure 3 As shown, in the above embodiment, after clustering the target frequency domain image, 6 cluster centers are obtained, namely: O1, O2, O3, O4, O5 and O6. Figure 3 The six first unit vectors are obtained by using the vectors between point O) in the image to O1, O2, O3, O4, O5, and O6. That is, the six first unit vectors include: 、 、 、 、 and .
[0073] Step 202: Calculate the angle between each first unit vector and the first preset direction respectively to obtain a plurality of first angles.
[0074] Please continue to refer to Figure 3 , the first preset direction is recorded as P1, and the calculations are The angle between it and P1 direction, The angle between P1 and The angle between P1 and The angle between P1 and The angle between P1 and The angle between it and P1.
[0075] That is, the first angle includes: The angle between it and P1 direction, The angle between P1 and The angle between P1 and The angle between P1 and The angle between P1 and The angle between it and P1.
[0076] Step 203: Sort the plurality of first angles in ascending order, and sort the plurality of first unit vectors based on the ascending order of the plurality of first angles.
[0077] In this embodiment, The angle between it and P1 direction, The angle between P1 and The angle between P1 and The angle between P1 and The angle between P1 and Then, based on the results of the ascending sorting of the plurality of first angles, the plurality of first unit vectors are sorted.
[0078] Step 204: Calculate the angle between every two adjacent first unit vectors after sorting to obtain at least one angle to be detected.
[0079] After steps 201 to 204, a sorting result is obtained for the plurality of first unit vectors. This allows the angle between each two adjacent first unit vectors to be calculated, yielding at least one angle to be detected. This facilitates subsequent testing of each angle to determine whether a target object exists within the image to be detected.
[0080] Compared with the related art, the embodiments of the present application have at least the following advantages: By first calculating the first unit vector between the center of the target frequency domain image and each cluster center corresponding to the target frequency domain image, and then calculating the first angle between each first unit vector and a first preset direction, the results of sorting the multiple first angles in ascending order are obtained. This embodiment can quickly and accurately determine the sorting result of the multiple first unit vectors simply by calculating the unit vectors and comparing the angles. This facilitates the calculation of the angle to be detected between two adjacent first unit vectors in subsequent processes, and the detection of the angle to be detected to determine whether the target object exists in the image to be detected.
[0081] Please refer to Figure 4 , is another seed step flow chart of the target object recognition method provided in one embodiment of the present application. This embodiment specifically describes another process of sorting multiple unit vectors according to preset rules in the above embodiment. The specific steps include: Step 301: Calculate the vectors from the multiple cluster centers corresponding to the target frequency domain image to the center of the target frequency domain image respectively to obtain multiple second unit vectors.
[0082] like Figure 5 As shown, from the center of the target frequency domain image (such as Figure 5 The six first unit vectors are obtained by using the vectors between point O) in the image to O1, O2, O3, O4, O5, and O6. That is, the six first unit vectors include: 、 、 、 、 and .
[0083] Step 302: Calculate the angle between each second unit vector and the second preset direction respectively to obtain a plurality of second angles.
[0084] Please continue to refer to Figure 5 , the second preset direction is recorded as P2, and the calculations are The angle between it and P2 direction, The angle between P2 and The angle between P2 and The angle between P2 and The angle between P2 and The angle between it and P1.
[0085] That is, the second angle includes The angle between it and P2 direction, The angle between P2 and The angle between P2 and The angle between P2 and The angle between P2 and The angle between it and P1.
[0086] Step 303: sort the plurality of second angles in descending order, and sort the plurality of second unit vectors based on the descending order results of the plurality of second angles.
[0087] In this embodiment, The angle between it and P2 direction, The angle between P2 and The angle between P2 and The angle between P2 and The angle between P2 and The angles between the plurality of second angles and P1 are sorted in descending order. Then, based on the results of the ascending sorting of the plurality of second angles, the plurality of second unit vectors are sorted.
[0088] Step 304: Calculate the angle between every two adjacent second unit vectors after sorting to obtain at least one angle to be detected.
[0089] After steps 301 to 304, the sorting result of the plurality of second unit vectors can be obtained. This allows the angle between each two adjacent second unit vectors to be calculated, yielding at least one angle to be detected. This facilitates subsequent testing of each angle to determine whether the target object exists within the image to be detected.
[0090] Compared with the related art, the embodiments of the present application have at least the following advantages: By first calculating the second unit vector between the center of the target frequency domain image and each cluster center corresponding to the target frequency domain image, and then calculating the second angle between each second unit vector and a second predetermined direction, this embodiment can quickly and accurately determine the ranking result of multiple second unit vectors simply by calculating the unit vectors and comparing the angles. This facilitates subsequent calculation of the angle to be detected between two adjacent second unit vectors, and the detection of the angle to be detected to determine whether the target object exists within the image to be detected.
[0091] Please refer to Figure 6 , is a schematic diagram of the hardware structure of the laser engraving device 1000 provided in the embodiment of the present application. Figure 6 As shown, laser engraving device 1000 may include a processor 1001 and a memory 1002. Memory 1002 is configured to store one or more computer programs 1003. One or more computer programs 1003 are configured to be executed by processor 1001. The one or more computer programs 1003 include instructions that can be used to implement the above-described method in laser engraving device 1000.
[0092] It is understood that the structure shown in this embodiment does not constitute a specific limitation on the laser engraving device 1000. In other embodiments, the laser engraving device 1000 may include more or fewer components than shown, or combine or separate some components, or arrange the components differently.
[0093] The processor 1001 may include one or more processing units. For example, the processor 1001 may include an application processor (AP), a modem, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0094] Processor 1001 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 1001 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 1001. If processor 1001 needs to use the same instruction or data again, it can directly access it from this memory. This avoids duplicate accesses, reduces the waiting time of processor 1001, and thus improves system efficiency.
[0095] In some embodiments, the processor 1001 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and / or a USB interface.
[0096] In some embodiments, the memory 1002 may include a high-speed random access memory and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0097] This embodiment further provides a computer-readable storage medium, which stores computer instructions. When the instructions are executed on a laser engraving device, the laser engraving device executes the above-mentioned related method steps to implement the method in the above-mentioned embodiment.
[0098] Among them, the laser engraving device and computer storage medium provided in this embodiment are used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods provided above, and will not be repeated here.
[0099] In practical applications, the above functions can be distributed to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0100] In the several embodiments provided in this application, the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are schematic. For example, the division of the modules or units is a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0101] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0102] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0103] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent molded object, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software molded object, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.
[0104] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. A target object recognition method, characterized in that: The method comprises: Dividing an image to be detected into a plurality of sub-images, wherein the image to be detected is an image of a processing platform including a laser engraving device; Performing frequency domain conversion on each of the sub-images to obtain a plurality of frequency domain images, wherein each of the sub-images corresponds to one frequency domain image; Performing clustering processing on each of the frequency domain images to obtain multiple cluster centers, wherein one frequency domain image corresponds to multiple cluster centers; Taking any one of the plurality of frequency domain images as a target frequency domain image, respectively calculating vectors between a center of the target frequency domain image and a plurality of cluster centers corresponding to the target frequency domain image to obtain a plurality of unit vectors; Obtaining at least one angle to be detected according to the angles between the plurality of unit vectors, wherein the angle to be detected is used to characterize the characteristics of the target object; When each of the angles to be detected is within a preset angle range, it is determined that the image to be detected includes the target object.
2. The target object recognition method according to claim 1, wherein: After obtaining at least one angle to be detected according to the angles between the multiple unit vectors, the method further includes: When any one of the at least one angle to be detected is not within the preset angle range, taking any other frequency domain image except the target frequency domain image as a new target frequency domain image; If each of the to-be-detected angles corresponding to the new target frequency domain image is within the preset angle range, it is determined that the to-be-detected image contains the target object.
3. The target object recognition method according to claim 2, wherein: The method further comprises: When the target detection angle corresponding to each of the frequency domain images is not within the preset angle range, it is determined that the image to be detected does not contain the target object, and the target detection angle is any one of the at least one detection angle corresponding to any one of the frequency domain images.
4. The target object recognition method according to any one of claims 1 to 3, characterized in that: The unit vector includes a first unit vector; and the vectors between the center of the target frequency domain image and the plurality of cluster centers corresponding to the target frequency domain image are respectively calculated to obtain the plurality of unit vectors, including: respectively calculating vectors from the center of the target frequency domain image to the multiple cluster centers corresponding to the target frequency domain image to obtain multiple first unit vectors; The calculating the angles between the plurality of unit vectors to obtain a plurality of angles to be detected includes: Calculating the angle between each of the first unit vectors and the first preset direction to obtain a plurality of first angles; sorting the plurality of first angles in ascending order; sorting the first unit vectors based on the ascending sorting results of the first angles; The angle between every two adjacent sorted first unit vectors is calculated to obtain a plurality of angles to be detected.
5. The target object recognition method according to any one of claims 1 to 3, characterized in that: The unit vector includes a second unit vector; and the vectors between the center of the target frequency domain image and the plurality of cluster centers corresponding to the target frequency domain image are respectively calculated to obtain the plurality of unit vectors, including: respectively calculating vectors from the plurality of cluster centers corresponding to the target frequency domain image to the center of the target frequency domain image to obtain a plurality of second unit vectors; The calculating the angles between the plurality of unit vectors to obtain a plurality of angles to be detected includes: Calculating the angle between each of the second unit vectors and the second preset direction to obtain a plurality of second angles; sorting the plurality of second angles in descending order; sorting the plurality of second unit vectors based on the descending sorting results of the plurality of second angles; The angle between every two adjacent sorted second unit vectors is calculated to obtain a plurality of angles to be detected.
6. The target object recognition method according to any one of claims 1 to 3, characterized in that: The clustering process is performed on each of the frequency domain images to obtain multiple cluster centers, including: Acquire characteristic parameters of the target object, where the characteristic parameters represent geometric features of the target object; Clustering is performed on each of the frequency domain images based on the characteristic parameters to obtain a plurality of cluster centers, wherein the characteristic parameters are equal to the number of the cluster centers corresponding to each of the frequency domain images.
7. The target object recognition method according to any one of claims 1 to 3, characterized in that: The clustering process is performed on each of the frequency domain images to obtain multiple cluster centers, including: Calculating each of the frequency domain images respectively; Performing binarization processing on each calculated frequency domain image to obtain a binary image, wherein one frequency domain image corresponds to one binary image; Clustering processing is performed on each of the binary images to obtain multiple cluster centers, wherein one binary image corresponds to multiple cluster centers.
8. The target object recognition method according to claim 7, wherein: The calculating each of the frequency domain images includes: Performing quadrant swapping on each of the frequency domain images to obtain a shifted frequency domain image; Logarithm processing is performed on each of the shifted frequency domain images.
9. A laser engraving device, characterized in that: The laser engraving device includes a memory and a processor, wherein the processor is communicatively connected to the memory and configured to execute the target object recognition method according to any one of claims 1 to 8.
10. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on a laser engraving device, enable the laser engraving device to perform the target object recognition method according to any one of claims 1 to 8.