Laser processing methods, equipment, systems, storage media and computer program products
By acquiring and processing the main body and edge parts of the image, the problem of poor image cutout effect was solved, and the quality of laser-processed finished products was improved.
Patent Information
- Application Number
- CN202510507349.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2026-11-17
AI Technical Summary
In current laser processing scenarios, the image matting technology has poor matting effect, resulting in poor finished laser processing products based on the matted images.
By acquiring the image to be processed and performing image matting, a first mask image and a second mask image of the target object are obtained, which respectively include the main body part and the edge part. Then, the second mask image is blurred. Finally, the two are superimposed to form the target processing image and imported into the laser processing process.
It improves the image cutout effect, resulting in better laser-processed finished products with clear main parts and natural transitions at the edges, thus enhancing the processing effect.
Smart Images

Figure CN123118684A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of laser processing technology, and in particular to a laser processing method, equipment, system, storage medium and computer program product. Background Technology
[0002] With the continuous development of image processing technology, image cutout technology has gained widespread attention in fields such as advertising design, film and television post-production, and photography retouching.
[0003] In some laser processing scenarios, users may only want to process the main object in the image to be processed. In this case, a solution is needed to extract the main object from the image so that the extracted object is suitable for the processing scenario. Currently, image extraction in processing scenarios still suffers from poor results, leading to unsatisfactory processing outcomes.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this application is to provide a laser processing method, equipment, system, storage medium, and computer program product, aiming to solve the technical problem that the image matting technology has poor matting effect in existing processing scenarios, resulting in poor finished products of laser processing based on the matted image.
[0006] To achieve the above objectives, this application proposes a laser processing method, the laser processing method comprising:
[0007] Obtain the image to be processed;
[0008] The image to be processed is subjected to image matting to obtain a first mask image and a second mask image of the target object in the image to be processed; wherein, the first mask image includes the main body of the target object, and the second mask image includes the main body and edge of the target object;
[0009] The second mask image is blurred to obtain the processed second mask image;
[0010] The first mask image and the processed second mask image are overlaid to obtain the target processed image;
[0011] The target image is imported into the laser processing process so that the processing equipment performs laser processing based on the target image.
[0012] Furthermore, to achieve the above objectives, this application also proposes a processing apparatus, which includes:
[0013] Slide rail;
[0014] A processing head, which is slidably mounted on the slide rail;
[0015] A communication component, the communication component being used to receive processing instructions generated from a target processing image obtained based on the steps of the laser processing method described above;
[0016] A controller, based on the processing instructions, controls the processing head to move on the slide rail for processing.
[0017] Furthermore, to achieve the above objectives, this application also proposes a processing system, the processing system comprising:
[0018] Processing equipment, the processing equipment comprising a communication component, a controller, a slide rail, and a processing head, the processing head being slidably mounted on the slide rail; and
[0019] A terminal device that communicates with the processing equipment, the terminal device being used to perform the laser processing method described above.
[0020] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the laser processing method described above.
[0021] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the laser processing method described above.
[0022] One or more technical solutions proposed in this application have at least the following technical effects:
[0023] This application acquires an image to be processed and performs image matting on the image to obtain a first mask image and a second mask image of the target object in the image to be processed. The first mask image includes the main body of the target object, and the second mask image includes the main body and edge portions of the target object. Thus, this application obtains a first mask image containing the main body of the target object and a second mask image containing the edge portions of the target object in addition to the main body. Then, by blurring the second mask image, a processed second mask image is obtained. The first and second mask images are then overlaid to obtain the target processed image. This allows the target processed image obtained by overlaying the first and second mask images to present a clear main body of the target object while enhancing the blurring effect of the edge portions, achieving a natural transition from the main body to the edge. Therefore, the final target processed image obtained by this application has a more natural transition effect from the main body to the edge, effectively improving the image matting effect of the target object. The target processed image is then imported into the laser processing process, allowing the processing equipment to perform laser processing based on the target processed image. Therefore, this application uses laser processing on target images with more natural matting effects, resulting in better finished laser-processed products. Attached Figure Description
[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0025] 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, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a schematic diagram of the processing equipment involved in the embodiments of this application;
[0027] Figure 2 This is a schematic diagram of the processing system involved in the embodiments of this application;
[0028] Figure 3 This is a schematic flowchart of the laser processing method according to Embodiment 1 of this application;
[0029] Figure 4 This is a schematic diagram of a scenario illustrating an embodiment of the laser processing method of this application;
[0030] Figure 5 This is an example diagram of the target processed image involved in the embodiments of this application;
[0031] Figure 6 This is a schematic flowchart of Embodiment 2 of the laser processing method of this application;
[0032] Figure 7 This is a schematic flowchart of the laser processing method according to Embodiment 3 of this application;
[0033] Figure 8 This is a schematic diagram of an editable interface involved in an embodiment of this application;
[0034] Figure 9 This is another schematic diagram of the editable interface involved in the embodiments of this application;
[0035] Figure 10 This is a schematic diagram of a computer-readable storage medium involved in an embodiment of this application.
[0036] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0037] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0038] In some laser processing scenarios, users may only want to process the main object in the image to be processed. In this case, a solution is needed to extract the main object from the image so that the extracted object is suitable for the processing scenario. Currently, image extraction in processing scenarios still suffers from poor results, leading to unsatisfactory processing outcomes.
[0039] Current image matting techniques primarily rely on deep learning technologies, especially Convolutional Neural Networks (CNNs) and semantic segmentation algorithms. These deep learning techniques enable models to learn the features of different objects in an image, thereby recognizing the boundary between the foreground and background and completing automatic image matting. However, in practical applications, because the edges of the subject are often blurred and irregular, existing matting techniques are prone to losing edge details, resulting in overly harsh edges in the matted images. In other words, under current processing scenarios, the matting effect of these techniques is poor, leading to unsatisfactory finished products from laser processing based on the matted images.
[0040] Based on this, the main objective of this application is to provide a laser processing method, equipment, system, storage medium, and computer program product, aiming to solve the technical problem that the image matting technology has poor matting effect in existing processing scenarios, resulting in poor finished products of laser processing based on the matted image.
[0041] The laser processing method provided in this application can be implemented by a processing system. For example... Figure 1 As shown, this application proposes a processing system, comprising:
[0042] Processing equipment 101 includes a communication component, a controller, a slide rail, a processing head, and a processing platform, wherein the processing head is slidably mounted on the slide rail; and
[0043] A terminal device 102 that communicates with the processing equipment 101, the terminal device being used to execute the laser processing method of this application.
[0044] In this embodiment, a terminal device 102 and a processing device 101 together constitute a processing system. The terminal device 102 includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the laser processing method of this embodiment. The terminal device may include, but is not limited to, devices such as smartphones, laptops, PDAs (Personal Digital Assistants), PADs (Portable Application Description), and desktop computers.
[0045] It should be noted that the embodiments of this application can be jointly implemented by the processing equipment 101 and the terminal equipment 102 in the processing system. The terminal equipment 102 executes the laser processing method of this application, that is, the terminal equipment 102 can perform the following steps: acquiring an image to be processed; performing image matting processing on the image to be processed to obtain a first mask image and a second mask image of the target object in the image to be processed; wherein, the first mask image includes the main body of the target object, and the second mask image includes the main body and edge of the target object; performing blurring processing on the second mask image to obtain a processed second mask image; and performing superposition processing on the first mask image and the processed second mask image to obtain a target processed image. Then, after obtaining the target processed image, the terminal equipment 102 generates a corresponding processing instruction and sends it to the processing equipment 101. The processing equipment 101 can then control the processing head to move on the processing area of the processing platform used to place the material to be processed according to the processing instruction, so as to process the material to be processed.
[0046] The processing system provided in this application, employing the laser processing method described in the embodiments of this application, can solve the technical problem that in existing processing scenarios, the image matting technique produces poor matting results, leading to unsatisfactory finished products from laser processing based on the matted images. Compared with the prior art, the beneficial effects of the processing system provided in this application are the same as those of the laser processing method provided in the embodiments of this application, and other technical features of the processing system are the same as those disclosed in the method of the embodiments of this application, and will not be repeated here.
[0047] In one embodiment, the hardware structure of the processing equipment in the above-described processing system is as follows: Figure 2 As shown, the processing equipment includes:
[0048] Slide rail;
[0049] A processing head, which is slidably mounted on the slide rail;
[0050] A processing platform is provided below the processing head for placing the material to be processed.
[0051] A communication component, the communication component being configured to receive processing instructions generated from the target processed image obtained according to the steps of the method described above;
[0052] A controller, based on the processing instructions, controls the processing head to move on the slide rail for processing.
[0053] It should be noted that the laser processing method provided in this application embodiment can be implemented independently by the processing equipment. The processing equipment can obtain processing instructions for the target processing image. The target processing image can be obtained through the following steps: obtaining an image to be processed; performing image matting processing on the image to be processed to obtain a first mask image and a second mask image of the target object in the image to be processed; wherein, the first mask image includes the main body of the target object, and the second mask image includes the main body and edge parts of the target object; performing blurring processing on the second mask image to obtain a processed second mask image; and superimposing the first mask image and the processed second mask image to obtain the target processing image. Afterwards, the processing equipment can generate processing instructions based on the target processing image and control the processing head to move on the processing area of the processing platform used to place the material to be processed according to the processing instructions, so as to process the material to be processed.
[0054] In this embodiment, the processing equipment is a laser processing equipment, and the processing equipment and the terminal equipment (such as...) Figure 1The terminal device communicates with one or more devices marked 102, and is used to perform data processing operations of the processing equipment (e.g., data processing of the laser processing method of this application). The communication component receives processing instructions generated by the terminal device from the target processing image obtained according to the steps of the method described above.
[0055] The hardware structure diagram of the processing equipment is shown below. Figure 2 As shown, the processing equipment includes a housing 90, a processing platform 10, a processing head 20, a laser tube 30, a slide rail 40, a communication component 50, and a controller 60. The housing 90 includes an upper shell 70 and a bottom shell 80. The processing platform 10 includes a processing area 11 for placing the material to be processed. The processing head 20 is slidably mounted on the slide rail 40 and is used to move on the processing area to perform processing. The communication component 50 is used to receive the placement angle obtained from the steps of the method provided in this application embodiment. Based on the placement angle, the controller 60 controls the movement of the processing head 50 on the slide rail 80 to process the material to be processed. The communication component 50 and the controller 60 are installed inside the back plate of the laser tube 30 and are not visible from the perspective of the figure, so they are shown by a dashed line connecting them. In one embodiment, a reflector 21 is provided between the processing head 20 and the laser tube 30. The beam generated by the laser tube 30 is reflected by the reflector 21 to the processing head 20 and then reflected, focused, and emitted to process the material to be processed. In one embodiment, the processing head 20 can generate a light spot. In another embodiment, the light spot can be generated by other components such as the laser tube 30 of a carbon dioxide laser tube, and enter the beam emitting device through the reflector 21, etc., and finally exit through the processing head 20 to process the material to be processed.
[0056] In this embodiment, during the processing of the material to be processed by the processing equipment based on the processing execution command, the processing equipment includes a slide rail 40 and a processing head 20, with the processing head 20 slidably mounted on the slide rail 40. For example, the slide rail 40 can be an X-axis or Y-axis guide rail, which can be a linear guide rail or a guide rail that slides with a roller, etc., as long as it can drive the processing head 20 to move and process along the X and Y axes. The processing head 20 may also have a Z-axis movement track for focusing before and / or during processing. Thus, the processing head 20 can move within the area covered by the slide rail 40. Furthermore, the processing head 20 can perform laser processing on the material to be processed. The processing head 20 of the processing equipment is equipped with a laser component for emitting laser light to perform laser processing on the material to be processed.
[0057] In this embodiment, the processing equipment also includes a processing platform 10, which includes a processing area 11 for placing the material to be processed. The processing head 20 can move on the processing area 11 by means of a slide rail 40. During the movement of the processing head 20 on the processing area 11, at least one of the following processing methods can be used to process the material to be processed: laser processing, cutting processing, or printing processing.
[0058] In one feasible embodiment, the processing equipment further includes a housing 90 and a cover plate 71, which enclose an internal space for accommodating the material to be processed. The housing 90 has an opening communicating with the internal space, and the cover plate 71 is connected to the housing 90 to open or close the opening. The cover plate 71 includes a light-transmitting window. The slide rail 40, the processing head 20, and the processing platform 10 are located in the internal space, and a camera device 12 is also provided in the internal space.
[0059] In this embodiment, the housing 90 can be a single-piece housing 90 or a split housing 90, for example, including a detachably connected or fixedly connected housing 90 and a bottom housing, used together with the cover plate 71 to enclose an internal space for accommodating the material to be processed. Through the blocking and / or filtering effect of the upper housing 70 and the bottom housing 80, laser leakage from the processing head 20 can be prevented from causing personal injury to the operator during operation. The housing 90 has an opening communicating with the internal space, and the cover plate 71 is connected to the housing 90 to open or close the opening. For example, the cover plate 71 can be connected to the housing 90 by a hinge connection (i.e., a hinge is installed between the cover plate 71 and the housing 90, so that the cover plate 71 can be opened and closed like a door), a slide rail 40 connection (i.e., a slide rail 40 is provided between the cover plate 71 and the housing 90, and the cover plate 71 moves relative to the housing 90 along the slide rail 40, opening and closing the opening by sliding in and out), etc. The operator can open or close the cover 71 to open or close the internal space, allowing for the insertion or removal of materials to be processed. The cover 71 includes a light-transmitting window, through which the operator can observe the processing within the internal space. The slide rail 40, processing head 20, and processing platform 10 are located within the internal space, which is also equipped with a camera device 12 for recording the processing of materials within the internal space.
[0060] This application provides a laser processing method, referring to... Figure 3 , Figure 3 This is a schematic flowchart of the first embodiment of the laser processing method of this application.
[0061] In this embodiment, the laser processing method includes steps S10 to S30:
[0062] Step S10: Obtain the image to be processed;
[0063] It should be noted that the execution subject in this embodiment is a terminal device, which can be a smartphone, laptop, PDA (Personal Digital Assistant), PAD (Portable Application Description), desktop computer, or other terminal devices.
[0064] It should also be noted that the image to be processed is the image to be processed, and the image to be processed includes at least one object. For example, the object may have hair, such as a pet cat or pet dog with hair.
[0065] This embodiment can obtain the image to be processed by the user by receiving an image file or link uploaded by the user. For example, this embodiment can receive an image file uploaded by the user and directly use the uploaded image file as the image to be processed, or this embodiment can also receive a link uploaded by the user (such as a local link or a network link), access the link, and read the image file selected by the user in the link as the image to be processed.
[0066] Step S20: Perform image matting on the image to be processed to obtain a first mask image and a second mask image of the target object in the image to be processed, wherein the first mask image includes the main body of the target object, and the second mask image includes the main body and edge of the target object;
[0067] It should be noted that the first mask image includes the main body of the target object, and the second mask image includes the main body and edge portions of the target object. The main body is the primary and salient part of the target object, containing its main structure. It is understood that the main body may also include structural details of the target object, but not all structural details. The edge portions may include structural details on the outline of the target object, such as hair, clothing, etc.
[0068] As an example, this embodiment can provide a first matting model and a second matting model. The first matting model is used to output a first mask image, and the second matting model is used to output a second mask image. In this embodiment, the image to be processed can be input into the first matting model and the second matting model respectively. Based on the first matting model and the second matting model, the image to be processed is subjected to matting processing. The output result of the first matting model is used as the first mask image of the target object in the image to be processed, and the output result of the second matting model is used as the second mask image of the target object in the image to be processed. The output result of the first matting model includes the main body of the target object, and the output result of the second matting model includes the main body and edge parts of the target object. Therefore, this embodiment can obtain a first mask image containing the main body of the target object in the image to be processed, and a second mask image containing the main body and edge parts of the target object.
[0069] As another example, this embodiment can process the image to be processed based on a predetermined matting model, so that the predetermined matting model peels away the non-subject parts of the image to be processed layer by layer, and obtains the output result of a specified intermediate layer of the predetermined matting model as a second mask image, wherein the output result of the specified intermediate layer includes the main part and edge part of the target object. The output image after the predetermined matting model has peeled away the non-subject parts of the image to be processed is then obtained and used as a first mask image. Therefore, this embodiment can directly obtain a second mask image containing the main body and edge parts of the target object through a designated intermediate layer of the predetermined matting model. This eliminates the need for two different matting models to separately process the image to be processed to obtain the first and second mask images. On the one hand, this can effectively improve training efficiency and reduce the consumption of computing resources. On the other hand, since the first and second mask images are generated by the same predetermined matting model, they are more consistent in feature representation, which can effectively ensure the feature consistency between the first and second mask images. This is beneficial for the subsequent operation of superimposing the first and second mask images in this embodiment, making the transition of the superimposed target processing image more natural.
[0070] In one feasible embodiment, step S20 includes steps S21 to S23:
[0071] Step S21: Process the image to be processed based on a predetermined matting model, so that the predetermined matting model peels off the non-subject parts of the image to be processed layer by layer.
[0072] Step S22: Obtain the output result of the specified intermediate layer of the predetermined matting model as the second mask image, wherein the output result of the specified intermediate layer includes the main body part and the edge part of the target object;
[0073] Step S223: Obtain the output image after the non-subject part of the image to be processed is stripped by the predetermined matting model, and use it as the first mask image.
[0074] It should be noted that the predetermined matting model is a progressive segmentation neural network model, such as U-Net, Mask R-CNN, and other convolutional neural networks. The predetermined matting model can be deployed locally or in the cloud. When deployed in the cloud, a graphics card is used to perform static processing on the predetermined matting model to accelerate its inference speed. Furthermore, TensorRT can be used to perform pruning and quantization processing on the predetermined matting model without affecting accuracy, further accelerating the model's inference speed. The designated intermediate layer is the intermediate layer network in the predetermined matting model whose output includes the main body and edge parts of the target object. It can be understood that these neural network models learn to identify the main body and non-main body parts in an image through training, and then gradually refine this process through an encoder-decoder structure in different network layers, peeling away the non-main body parts (such as background and edge parts) of the target object in the image to be processed layer by layer from the outside in, ultimately extracting the main body part of the target object in the image to be processed.
[0075] In this embodiment, the output of a specified intermediate layer of the predetermined matting model can be obtained by adjusting the model structure, defining functions, and using hooks. For example, an output node is added to the specified intermediate layer in the neural network structure of the predetermined matting model. Therefore, this embodiment processes the image to be processed based on the predetermined matting model, causing the predetermined matting model to peel away the non-subject parts of the image layer by layer. The output of the specified intermediate layer can then be obtained as a second mask image from its output node. Alternatively, for deep learning frameworks such as TensorFlow and PyTorch, this embodiment can define a set of functions to access the specified intermediate layer of the predetermined matting model. This embodiment can then access the specified intermediate layer of the predetermined matting model through these functions to obtain its output. Furthermore, this embodiment can also use hooks: in the PyTorch framework, hooks can be registered to the specified intermediate layer. Thus, this embodiment processes the image to be processed based on the predetermined matting model, causing the predetermined matting model to peel away the non-subject parts of the image layer by layer. Furthermore, during the forward propagation of the predetermined matting model, the hook can capture the output of the designated intermediate layer as the second mask image. This embodiment can also obtain the output image of the predetermined matting model after stripping the non-subject parts of the image to be processed (i.e., the final output of the predetermined matting model) as the first mask image. Thus, this embodiment can obtain a first mask image containing the main body of the target object in the image to be processed, and a second mask image containing both the main body and edge parts of the target object. Moreover, this embodiment uses the outputs of the designated intermediate and final layers of the same predetermined matting model as the second and first mask images, respectively. Compared to using different matting models, this effectively improves training efficiency and reduces computational resource consumption. Furthermore, since the first and second mask images are generated by the same predetermined matting model, they are more consistent in feature representation, effectively ensuring feature consistency between the first and second mask images. This is beneficial for the subsequent overlay operation between the first and second mask images, making the transition of the overlaid target image more natural.
[0076] In one feasible embodiment, steps A10 to A20 are included before step S21:
[0077] Step A10: Obtain a feedback sample set of the output image of the predetermined matting model, wherein the feedback sample set includes the feedback output image of the predetermined matting model and the corresponding mask annotation;
[0078] Step A20: Based on the feedback output image and the corresponding mask annotation, the predetermined matting model is iteratively updated to obtain a new predetermined matting model.
[0079] It should be noted that the feedback sample set is a collection of training samples obtained from user feedback on the output image of the predetermined matting model. For example, the output image with poor matting effect reported by the user can be used as the feedback output image, one feedback output image and the corresponding mask annotation can be used as a training sample, and multiple training samples can be used as the feedback sample set.
[0080] To continuously optimize the predetermined matting model and make it meet user needs, this embodiment collects feedback output images of the predetermined matting model based on user feedback. These feedback output images are then annotated with corresponding masks, and the feedback output images and corresponding mask annotations are used as a feedback sample set. This embodiment can obtain a feedback sample set of the predetermined matting model's output images, and then iteratively update the predetermined matting model based on the feedback output images and corresponding mask annotations in the feedback sample set to obtain a new predetermined matting model. For example, this embodiment can obtain a historical training sample set of the predetermined matting model, and use the feedback sample set and the historical training sample set as a new training sample set. The initial matting model is trained based on the new training sample set to obtain a new matting model, and the predetermined matting model is updated according to the model parameters of the new matting model to obtain a new predetermined matting model.
[0081] Step S30: Blur the second mask image to obtain the processed second mask image;
[0082] It should be noted that the blurring process is a processing operation used to enhance the edge blurring effect, such as Gaussian blur, box mode, bilateral blur, median blur, etc.
[0083] As an example, taking Gaussian blurring as the blurring process, this embodiment can create a Gaussian kernel based on a predefined kernel size (e.g., 15×15) and standard deviation (σ). A larger kernel size results in higher blur intensity, a larger standard deviation leads to a more dispersed weight distribution, and a wider blur range. For example, based on the predefined kernel size and standard deviation, the weight value at each position is calculated using a two-dimensional Gaussian function to obtain the Gaussian kernel. The kernel center (x=0, y=0) has the largest weight, and the weight decreases with distance from the center. The weight values of the Gaussian kernel can then be normalized to obtain a normalized Gaussian kernel. For example, all weight values are divided by the total weight sum to ensure the kernel sum is 1, avoiding brightness shift. Furthermore, this embodiment can perform a convolution operation on the second mask image based on the normalized Gaussian kernel, using the Gaussian kernel as a sliding window to traverse the second mask image pixel by pixel to obtain the processed second mask image. Therefore, this embodiment uses a Gaussian kernel to calculate the weighted sum of all pixel values in its neighborhood and their corresponding weight values for each pixel in the second mask image. The result of the weighted sum is used as the new pixel value for that pixel. This process continues until all pixels in the second mask image have been processed, resulting in the processed second mask image. Furthermore, this embodiment can also perform boundary processing after all pixels in the second mask image have been processed to obtain a further processed second mask image. For example, symmetrical filling (such as mirroring boundary pixels) can be used to avoid the loss of edge information, thereby improving the edge effect of the processed second mask image.
[0084] As another example, taking bilateral blurring (also known as bilateral filtering) as an example, this embodiment can predefine a filtering radius, which determines the size of the neighborhood considered during filtering. The larger the radius, the more obvious the blurring effect. Then, the output image can be initialized, that is, a blank image of the same size as the input second mask image can be created to store the processed result. Each pixel of the second mask image is traversed, and a spatial weight and intensity weight are calculated for each pixel in the second mask image. For example, this embodiment can calculate the spatial weight of the current pixel for each pixel in its neighborhood, which represents the spatial proximity between the current pixel and the neighboring pixels. And it can calculate the intensity weight of the current pixel for each pixel in its neighborhood, that is, calculate the intensity weight of the current pixel based on the intensity value of each pixel in its neighborhood. Then, based on the spatial weight and intensity weight of each pixel, the total weight of each pixel is calculated, where the total weight is the product of the spatial weight and the intensity weight. The total weights are normalized, and then for each pixel, the normalized total weights and the intensity values of neighboring pixels are used to calculate the filtered pixel value. This filtered value is then filled into the initialized output image, and the result is output as the processed second mask image. Bilateral blurring considers both spatial proximity and pixel value similarity, allowing the image to be blurred while preserving edges and other details.
[0085] In one feasible embodiment, step S30 includes steps S31 to S32:
[0086] Step S31: Gaussian blur the second mask image to obtain a blurred second mask image;
[0087] Step S32: Perform mask transparency processing on the blurred second mask image to obtain the processed second mask image.
[0088] It should be noted that Gaussian blur is an image smoothing operation that uses a Gaussian function as the convolution kernel. The degree of blurring can be controlled by adjusting the size and standard deviation of the convolution kernel. Mask transparency is the operation that converts a mask image from a binary or grayscale image into an image with transparency information.
[0089] like Figure 4As shown, in this embodiment, after inputting the image to be processed into a predetermined matting model to obtain a first mask image and a second mask image, this embodiment applies Gaussian blur to the second mask image to make the pixel transitions of the second mask image smoother, thereby creating a blur effect for the second mask image. This embodiment also performs mask transparency processing on the Gaussian-blurred second mask image, making the second mask image exhibit a certain degree of transparency. Since it has already undergone Gaussian blur processing, the second mask image contains grayscale gradients, and the mask transparency processing of the second mask image will also have a smooth transparency transition (i.e., forming soft edges). Furthermore, the mask transparency processing does not change the original colors and details in the second mask image. Therefore, the processed second mask image can retain more details while enhancing the blur effect.
[0090] Step S40: Overlay the first mask image and the processed second mask image to obtain the target processed image;
[0091] In this embodiment, after blurring the second mask image, the first mask image can be directly superimposed on the processed second mask image to obtain the target processed image. Furthermore, this embodiment can also obtain a difference image by performing a difference operation on the first mask image and the blurred second mask image, and then adding the difference image to the first mask image to obtain the target processed image. The target processed image obtained in this embodiment has a clear main body of the target object and a blurred edge portion of the target object. This allows the target processed image to present a clear main body of the target object while enhancing the edge blurring effect, achieving a natural transition from the main body to the edge. Therefore, the hair effect in the final target processed image obtained in this embodiment is more natural, effectively improving the cutout effect for objects with hair.
[0092] In one feasible embodiment, step S40 includes steps S41 to S42:
[0093] Step S41: Perform a difference operation on the first mask image and the processed second mask image to obtain the difference portion image;
[0094] Step S42: Add the difference portion image and the first mask image together to obtain the target processed image.
[0095] It should be noted that the difference operation is to perform a difference operation on the pixel values of pixels at the same position on the first mask image and the second mask image, that is, to subtract the pixel values of pixels at the same position from each other.
[0096] In this embodiment, a difference operation is performed on the first mask image and the processed second mask image to obtain a difference portion image (i.e., the portion of the processed second mask image excluding the first mask image). This difference portion image is then added to the first mask image to obtain the target processed image. Therefore, in this embodiment, the edge portion of the second mask image experiences smooth transitions and gradual changes in transparency due to Gaussian blur and mask transparency processing, reducing abruptness. The combination of difference and addition operations also avoids over-enhancing overlapping areas, preventing unnatural effects. This results in more natural edges in the final synthesized target processed image, while ensuring the clarity of the main body of the target object in the first mask image. See also... Figure 5 , Figure 5 This is an example diagram of the target processed image involved in the embodiments of this application. Figure 5 The main body is clear, the edges of the hair are naturally smooth, and the texture is restored to the greatest extent. The direction and fluffy layers of the hair are accurately presented, providing users with a higher quality cutout effect.
[0097] Step S50: The target processing image is imported into the laser processing process so that the processing equipment performs laser processing based on the target processing image.
[0098] It should be noted that the laser processing process includes at least preprocessing operations on the target image before laser processing (such as further image processing of the target image, setting processing parameters, generating processing instructions, etc.), and the laser processing process may also include processing operations based on the target image to control the laser processing equipment to perform laser processing.
[0099] In this embodiment, after obtaining the target image, it can be converted into a processing path. For example, if the target image is a vector image, it can be directly converted into a laser processing path. If the target image is a bitmap, it can first be converted into a grayscale image, and then a laser processing path can be generated based on the grayscale values in the grayscale image. The processing equipment is then controlled to perform laser processing according to the laser processing path to process the target image onto the material to be processed.
[0100] In one feasible embodiment, step S50 includes steps S51 to S52:
[0101] Step S51: Display the target processing image in the editable interface; wherein, the editable interface includes an image import control, which is used to import the target processing image in the editable interface into the laser processing process;
[0102] Step S51: In response to a trigger operation on the image import control, the target processing image is imported into the laser processing process.
[0103] It should be noted that the editable interface includes an image import control, which is used to import the target processing image from the editable interface into the laser processing process. For example, the image import control can be displayed in the editable interface as a virtual button labeled "Import Processing".
[0104] This embodiment displays the target processed image in an editable interface, allowing the user to understand the cutout effect of the image to be processed (i.e., the target processed image). If the user is not satisfied, they can intervene to further adjust the target processed image. Therefore, the editable interface includes an image import control. If the user is satisfied with the effect of the target processed image, they can trigger the image import control through mouse, touchscreen clicks, or other triggering operations. In this embodiment, in response to the triggering operation of the image import control, the target processed image is imported into the laser processing process of the processing equipment, so that the processing equipment performs laser processing on the material to be processed based on the target processed image, obtaining consumables engraved with the target processed image.
[0105] In one feasible embodiment, step S50 further includes steps S53 to S54:
[0106] Step S53: Display the target processing image in the editable interface, and generate processing instructions based on the target processing image;
[0107] Step S54: Send the processing instruction to the processing equipment so that the processing equipment performs laser processing on the material to be processed based on the processing instruction.
[0108] It should be noted that the processing instructions are G-codes or other instruction formats that can be recognized by the processing equipment.
[0109] In this embodiment, after obtaining the target image, it can be converted into a processing path. For example, if the target image is a vector image, it can be directly converted into a laser processing path. If the target image is a bitmap, it can be first converted into a grayscale image, and then a laser processing path can be generated based on the grayscale values in the grayscale image. Furthermore, this embodiment can obtain processing parameters, such as laser power, processing speed, and processing depth. These processing parameters can be set according to the material and thickness of the material to be processed. For example, depending on the material and thickness of the material, a preset parameter mapping table can be consulted to find the corresponding parameter combination. Then, this embodiment can generate processing instructions based on the processing path and the processing parameters, and send the processing instructions to the processing equipment. The processing equipment can then execute the received processing instructions to perform laser processing on the material to be processed, obtaining a carved product with the target image engraved.
[0110] One embodiment of this application provides a laser processing method. By acquiring an image to be processed and performing image matting on the image, a first mask image and a second mask image of the target object in the image are obtained. The first mask image includes the main body of the target object, and the second mask image includes the main body and edge portions of the target object. Thus, this embodiment obtains a first mask image containing the main body of the target object and a second mask image containing the edge portions of the target object in addition to the main body. Furthermore, by blurring the second mask image, a processed second mask image is obtained. The first and second mask images are then overlaid to obtain the target processed image. This allows the target processed image obtained by overlaying the first and second mask images to present a clear main body of the target object while enhancing the blurring effect of the edge portions, achieving a natural transition from the main body to the edge. Therefore, the final target processed image obtained in this embodiment has a more natural transition effect from the main body to the edge, effectively improving the image matting effect, especially for objects with hair-like edges. The target image is then imported into the laser processing process, allowing the processing equipment to perform laser processing based on the target image. Therefore, this embodiment uses a target image with a more natural cutout effect for laser processing, resulting in better laser processing results and a superior finished product.
[0111] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 6 Steps B10 to B20 are included before step S20:
[0112] Step B10: Perform target recognition on the image to be processed to obtain each target object in the image to be processed;
[0113] Step B20: Divide the image to be processed into blocks according to each target object to obtain the block-based image to be processed, and perform image matting processing on each block of the image to be processed.
[0114] In real-world applications, the image to be processed may contain multiple target objects. However, conventional matting models may perform poorly when handling images with multiple target objects due to their limitations. Therefore, this embodiment employs convolutional neural networks, SSD (Single Shot multi-box Detector), YOLO (You Only Look Once), and other target recognition algorithms to identify targets in the image to be processed, obtaining bounding boxes for each target object. These bounding boxes contain the location information of the target objects. Furthermore, this embodiment can divide the image to be processed into blocks based on the bounding boxes of each target object, resulting in segmented images. It is understood that each segmented image contains only one target object. Finally, this embodiment can perform matting processing on each segmented image to obtain a first mask image and a second mask image for each target object in the image to be processed. This embodiment first divides the image to be processed into blocks according to each target object in the image to be processed, and then performs image matting processing on each block of the image to be processed based on the predetermined matting model, and then performs overlay processing and image fusion to obtain the target processed image, thereby effectively improving the matting effect for images to be processed with multiple target objects.
[0115] In one feasible embodiment, step S30 further includes steps C10 to C20:
[0116] Step C10: The first mask image and the second mask image obtained by the image cutout process of each image to be processed are superimposed to obtain the object processing image of each target object;
[0117] Step C20: Image fusion is performed on the object processing images of each target object to obtain the target processing image.
[0118] In this embodiment, after performing image matting on each image to be processed to obtain the first and second mask images of each target object in the image to be processed, the second mask images of each target object can be blurred. Then, the first and second mask images obtained from the image matting on each image to be processed are superimposed to obtain the object-processed image of each target object. It is understood that the object-processed image includes a single target object. Therefore, in order to obtain the target-processed image containing each target object corresponding to the image to be processed before block processing, it is further necessary to perform image fusion on the object-processed images of each target object to obtain the target-processed image. For example, in this embodiment, based on the position of each image to be processed in the original image to be processed, each object-processed image can be placed at a corresponding coordinate position to reconstruct the overall image structure of the image to be processed, thus obtaining the target-processed image. Furthermore, to improve the fusion effect, this embodiment can also perform post-processing operations such as edge optimization (Poisson fusion, multi-band fusion, etc.) and denoising on the reconstructed target-processed image to obtain a new target-processed image. It is understood that the image fusion operation can be performed by a deep learning model, such as a convolutional neural network, a generative adversarial network, or a pyramid network.
[0119] In the second embodiment of this application, target recognition is performed on the image to be processed to obtain each target object in the image to be processed, and the image to be processed is divided into blocks according to each target object to obtain the block-processed image. Thus, this embodiment can divide each target object into multiple image blocks to obtain each image to be processed. Furthermore, this embodiment can perform image matting processing on each block of the image to be processed to obtain a first mask image and a second mask image for each target object in the image to be processed, and then blur the second mask image of each target object. Then, the first mask image and the second mask image obtained from the image matting processing of each image to be processed are superimposed to obtain the object-processed image of each target object. Finally, the object-processed images of each target object are merged to obtain the target-processed image. Therefore, this embodiment addresses the problem of poor matting effect of existing matting models for multi-target images by pre-dividing the image according to the target object and then merging the object-processed images of each target object after the matting processing is completed, effectively improving the matting effect for images to be processed containing multiple target objects.
[0120] Based on the first embodiment of this application, in the third embodiment of this application, the content that is the same as or similar to that in embodiments one and two of this application can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 7 Step S10 is followed by steps D10 to D20:
[0121] Step D10: In response to the triggering operation of the image cutout processing control for the image to be processed in the editable interface, perform image cutout processing on the image to be processed to obtain the target processed image;
[0122] Step D20: Display the target image to be processed and the image to be processed with a mask display area in the editable interface; wherein, the mask display area is the mask coverage area displayed on the target object of the image to be processed.
[0123] It should be noted that the cutout processing control is used to perform cutout processing on the image to be processed. For example, the cutout processing control can be displayed in the editable interface as a virtual button labeled "Smart Cutout".
[0124] like Figure 8 As shown, the editable interface includes a cutout processing control (i.e. Figure 8 The "Smart Background Removal" virtual button allows users to trigger the background removal processing control via mouse, touchscreen clicks, or other actions. In this embodiment, in response to the triggering operation of the background removal processing control for the image to be processed in the editable interface, background removal processing is performed on the image to be processed, i.e., steps S20-S40 are executed to obtain the target processed image. In response to the switching operation of the manual background removal control, a manual editing control is displayed in the manual background removal interface. In response to the user's manual operation on the image to be processed, the mask display area of the image to be processed is added to or deleted, obtaining the mask display area of the image to be processed. Background removal processing is performed on the image to be processed based on the mask display area to obtain the target processed image.
[0125] Therefore, in this embodiment, after obtaining the target processed image, the target processed image and the image to be processed with a mask display area can be displayed in an editable interface. The mask display area is the mask-covered area displayed on the target object in the image to be processed. Thus, this embodiment can display the original image to be processed and the target processed image obtained after image matting to the user, while also displaying the coverage area of the target processed image (i.e., the mask display area) on the original image to be processed, so that the user can more intuitively and clearly understand the image matting effect.
[0126] In one feasible embodiment, the editable interface includes adjustment controls for the mask display area, and after step D20, includes steps E10 to E20:
[0127] Step E10: In response to the triggering operation of the adjustment control for the mask display area, the mask display area is adjusted accordingly to obtain and display a new mask display area;
[0128] Step E20: Update the target processing image according to the new mask display area, and display the updated target processing image in the editable interface.
[0129] It should be noted that the adjustment control is used to adjust the mask display area. For example, the adjustment control can be used to add, delete, move, or perform other adjustment operations on the mask display area.
[0130] like Figure 8 As shown, this embodiment can display the target image to be processed and the image to be processed with a mask display area on an editable interface, wherein the mask display area is the mask-covered area displayed on the image to be processed (i.e., Figure 8 (The red-covered area in the middle). This embodiment can respond to the triggering operation of the adjustment control for the mask display area, adding or deleting from the mask display area to adjust the mask display area and obtain and display a new mask display area. For example... Figure 8 As shown, the editable interface may further include an interactive parameter panel, which may include interactive parameters for adjusting the mask display area. For example, the interactive parameters may include brush parameters, such as brush size. Figure 8 Medium brush size, default 10, range 1-100, to support adjusting the brush's operating range. The interactive parameters may also include brush hardness, such as... Figure 8 Medium brush hardness, default 1, range 1-100, where 1 is the softest and 100 is the hardest. Brush hardness can be understood as the degree of feathering or blurring at the brush edge, specifically the degree of feathering during drawing. When the brush hardness is 100%, the edge is sharp with no blurring; when the hardness is 0%, the edge is softest with a noticeable blurring effect, suitable for scenarios requiring a smooth transition. Therefore, this embodiment can add to or remove from the mask display area according to the selected interaction parameters to obtain a new mask display area. For example... Figure 9As shown, when adjusting the mask area by deleting it, the interactive cursor displayed on the editable interface can be a "-" shape (symbol within the dashed box); when adjusting the mask area by adding it, the interactive cursor can be a "+" shape (symbol within the dashed box); and when adjusting the movement, the interactive cursor can be an arrow shape (symbol within the dashed box). This makes it easy for the user to identify the current adjustment operation type. Then, the target processing image is updated according to the new mask display area (i.e., adding a new image area or deleting an existing image area). This allows the embodiment to provide a real-time preview of the target processing image after the user's adjustment of the mask display area, showing the addition or deletion of the mask area. Furthermore, this embodiment can also output the updated target processing image after receiving an image selection command, where the image selection command is an operation command to select the updated current target processing image, such as clicking... Figure 8 The "Save" button in the editable interface.
[0131] In one feasible embodiment, the editable interface further includes an image scaling control; the laser processing method further includes step F10:
[0132] Step F10: In response to the adjustment operation of the image scaling control, the image to be processed and / or the target image having a mask display area is scaled, and the scaled image to be processed and / or the target image having a mask display area is displayed.
[0133] For adjusting the image scaling control, this embodiment can be achieved by clicking the "-" or "+" slider in the image scaling control using a mouse or touchscreen, or by moving the adjustment point in the scaling progress bar. As an example, this embodiment can scale (reduce or enlarge) the image to be processed with a masked display area in response to the adjustment operation of the image scaling control, and display the scaled image with the masked display area. As another example, this embodiment can scale the target image to be processed in response to the adjustment operation of the image scaling control, and display the scaled target image. As yet another example, in response to the adjustment operation of the image scaling control, the image to be processed with a masked display area and the target image to be processed are scaled simultaneously, and the scaled images are displayed, thereby achieving synchronous scaling. For example, for the scaling operation, this embodiment can use the center of the image to be processed with the masked display area as a reference point for scaling. This embodiment can also use the trigger position of the adjustment operation (such as the cursor position) as a reference point for scaling.
[0134] In one feasible embodiment, the editable interface includes adjustment controls for the mask display area, and after step D20, steps G10 to G20 are included:
[0135] Step G10: In response to the interface closing operation, the editable interface is closed, and the image to be processed with the mask display area is saved;
[0136] Step G20: In response to the interface opening operation, the editable interface is opened, and the image to be processed with the mask display area is displayed in the editable interface.
[0137] To facilitate subsequent editing by the user, in this embodiment, in response to the interface closing operation, the editable interface is closed, and the image to be processed with the masked display area is saved. For example, this embodiment can save the image to be processed with the masked display area to local storage or cloud storage. In this embodiment, in response to the interface opening operation, the editable interface can be reopened. After the image to be processed with the masked display area is read from local storage or cloud storage, it can be displayed in the editable interface. Therefore, this embodiment ensures that the image to be processed before the masking process is not lost when the user reopens the editable interface, supporting subsequent multiple edits.
[0138] In one feasible embodiment, steps H10 to H40 are included after step E10:
[0139] Step H10: Record the addition or deletion operations performed within the editable interface to obtain a modification operation record;
[0140] Step H20: In response to the undo operation, based on the previous modification process in the modification operation record, restore the mask display area to the mask display area before the previous modification process; or,
[0141] Step H30: In response to the forward operation, based on the next modification process in the modification operation record, restore the mask display area to the mask display area after the next modification process; or,
[0142] Step H40: In response to the reset operation, based on the modification operation record, the mask display area is restored to the mask display area before all modification operations in the modification operation record.
[0143] This embodiment can record the addition or deletion operations performed within the editable interface to obtain a modification operation record. Therefore, this embodiment can respond to an undo operation, which restores the operation to its state before the last modification operation. Based on the last modification in the modification operation record, the mask display area is restored to its state before the last modification. After the undo operation, this embodiment can also respond to a forward operation, which restores the operation to its state after the next modification operation. Based on the next modification in the modification operation record, the mask display area is restored to its state after the next modification. For example, this embodiment can be accessed via a mouse or touchscreen. Figure 8 The undo button in the upper right corner (i.e.) Figure 8 The back arrow and forward key (i.e.) Figure 8 The forward arrow (in the image) supports returning to the previous / next step. This embodiment can also respond to a reset operation, which is an operation to restore the target processed image to its initial state. Based on the modification operation record, the mask display area is restored to the mask display area before all modification operations in the modification operation record. For example, this embodiment can be accessed via mouse or touchscreen click. Figure 8 The "Reset" button deletes all additions and deletions to the mask display area, restoring it to its state before all modifications in the modification operation record. This embodiment can then update the target processed image based on the restored mask display area and display the updated image. Therefore, this embodiment can directly return to any modified target processed image after undo, forward, or reset operations, eliminating the need to recalculate the algorithm model and displaying any modified target processed image according to user needs, effectively improving user preview efficiency.
[0144] In one feasible embodiment, step I10 to I20 are further included after step S50:
[0145] Step I10: In response to the secondary editing operation, the target image is adjusted to obtain a new target image.
[0146] Step I20: Compare the target processed image with the new target processed image to obtain the difference image region, and import the difference image region into the laser processing process so that the processing equipment performs secondary laser processing based on the difference image region.
[0147] It should be noted that the secondary editing operation refers to the operation of editing the target image after the processing equipment has performed laser processing based on the target image.
[0148] Because there will be some differences in the display effect between the target processed image in image form and the target processed image engraved on the material to be processed, in order to make the engraved product more in line with the user's processing needs, the user can perform secondary editing on the target processed image if they are not satisfied with the effect of the engraved product after laser processing. This embodiment can adjust the target processed image in response to the secondary editing operation to obtain a new target processed image. This embodiment can then compare the original target processed image and the new target processed image to obtain the difference image area. For example, the difference image area is the image area obtained by performing difference processing on the original target processed image and the new target processed image. Furthermore, this embodiment can import the difference image area into the laser processing process so that the processing equipment can perform secondary laser processing based on the difference image area. Thus, this embodiment can perform secondary laser processing on the engraved product based on the differences before and after secondary editing, based on the already engraved target processed image, so that the engraved product can be quickly adjusted to the secondary edited target processed image without re-engraving.
[0149] In one feasible embodiment, step J10 to J30 are further included after step I20:
[0150] Step J10: Compare the target processed image with the new target processed image to obtain the newly added image region and / or sharpened image region as the difference image region;
[0151] Step J20: Based on the newly added image area, generate a new area processing instruction and send the new area processing instruction to the processing equipment so that the processing equipment performs secondary laser processing on the newly added image area corresponding to the engraved product based on the new area processing instruction;
[0152] And / or,
[0153] Step J30: Based on the sharpened image area, generate a sharpening area processing instruction and send the sharpening area processing instruction to the processing equipment, so that the processing equipment performs secondary laser processing on the sharpened image area corresponding to the engraved product based on the sharpening area processing instruction.
[0154] It should be noted that the newly added image area refers to the image area added to the new target processed image compared to the target processed image of the secondary editing operation. The sharpened image area refers to the image area of the new target processed image that has undergone sharpening processing compared to the target processed image of the secondary editing operation. The engraved product is a product obtained by laser processing based on the target processed image by the processing equipment.
[0155] As an example, this embodiment can obtain a new image region by comparing the target processed image with a new target processed image. After obtaining the new image region, this embodiment can convert the new image region into a new region processing path. Then, this embodiment can obtain processing parameters, such as laser power, processing speed, and processing depth. This embodiment can generate a new region processing instruction based on the new region processing path and the processing parameters, and send the new region processing instruction to the processing equipment. The processing equipment can then execute the received new region processing instruction to perform secondary laser processing on the engraved product, obtaining a second-laser-processed engraved product.
[0156] As another example, since the sharpened image will increase the processing depth and highlight the sharpened lines during laser engraving, this embodiment can obtain the sharpened image region by comparing the target processed image with a new target processed image. After obtaining the sharpened image region, this embodiment can convert the sharpened image region into a sharpening region processing path. Furthermore, this embodiment can obtain processing parameters, such as laser power, processing speed, and processing depth. This embodiment can generate a sharpening region processing instruction based on the sharpening region processing path and the processing parameters, and send the sharpening region processing instruction to the processing equipment. The processing equipment can then execute the received sharpening region processing instruction to perform secondary laser processing on the engraved product, obtaining the engraved product after secondary laser processing.
[0157] As another example, this embodiment can compare the target processed image with a new target processed image to obtain a newly added image region and a sharpened image region. After obtaining the newly added image region and the sharpened image region, this embodiment can convert the newly added image region into a newly added region processing path and the sharpened image region into a sharpened region processing path. Furthermore, this embodiment can obtain processing parameters, such as laser power, processing speed, and processing depth. This embodiment can generate newly added region processing instructions and sharpened region processing instructions based on the newly added region processing path, the sharpened region processing path, and the processing parameters, and send these instructions to the processing equipment. The processing equipment can then execute the received newly added region processing instructions and sharpened region processing instructions to perform secondary laser processing on the engraved product, obtaining the engraved product after secondary laser processing.
[0158] This embodiment compares the newly processed target image after secondary editing with the original target processed image to obtain the difference image regions (new image regions and / or sharpened image regions) between the two target processed images. Then, based on the new image regions and / or the sharpened image regions, new region processing instructions and / or sharpening region processing instructions are generated and sent to the processing equipment. The processing equipment executes these instructions to perform secondary laser processing on the engraved product, resulting in a second-stage engraved product. Therefore, this embodiment can correct any unsatisfactory parts that occurred during the first laser processing, providing an opportunity for correction without needing to recreate the entire engraved product. Furthermore, compared to methods that require re-engraving the entire product during modifications, this embodiment offers higher engraving efficiency.
[0159] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the laser processing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0160] like Figure 10 As shown, this application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the laser processing method in the embodiments of this application.
[0161] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0162] The aforementioned computer-readable storage medium may be included in the terminal device; or it may exist independently and not assembled into the terminal device.
[0163] The aforementioned computer-readable storage medium carries one or more programs. When the aforementioned one or more programs are executed by a terminal device, the terminal device causes the terminal device to: acquire an image to be processed; perform image matting processing on the image to be processed to obtain a first mask image and a second mask image of the target object in the image to be processed; wherein the first mask image includes the main body of the target object, and the second mask image includes the main body and edge parts of the target object; perform blurring processing on the second mask image to obtain a processed second mask image; perform overlay processing on the first mask image and the processed second mask image to obtain a target processed image; and import the target processed image into the laser processing process so that the processing equipment performs laser processing based on the target processed image.
[0164] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0165] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0166] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0167] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-described laser processing method. It can solve the technical problem that the image matting technology has poor matting effect in the existing processing scenario, resulting in poor finished products of laser processing based on the matted image. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the laser processing method provided in the embodiments of this application, and will not be repeated here.
[0168] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the laser processing method described above.
[0169] like Figure 10 As shown, the computer program of this computer program product can be stored on a computer-readable storage medium. When the computer program is executed by a processor, it implements the steps of the laser processing method described above. Therefore, the computer program product provided by this application can solve the technical problem that the image matting technology has poor matting effect in the existing processing scenario, resulting in poor finished products of laser processing based on the matted image. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the laser processing method provided in the embodiments of this application, and will not be repeated here.
[0170] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A laser processing method, characterized in that, The laser processing method includes: Obtain the image to be processed; The image to be processed is subjected to image matting to obtain a first mask image and a second mask image of the target object in the image to be processed; wherein, the first mask image includes the main body of the target object, and the second mask image includes the main body and edge of the target object; The second mask image is blurred to obtain the processed second mask image; The first mask image and the processed second mask image are overlaid to obtain the target processed image; The target image is imported into the laser processing process so that the processing equipment performs laser processing based on the target image.
2. The laser processing method as described in claim 1, characterized in that, The step of performing image masking on the image to be processed to obtain a first mask image and a second mask image of the target object in the image to be processed includes: The image to be processed is processed based on a predetermined matting model, so that the predetermined matting model peels off the non-subject parts of the image to be processed layer by layer; The output of a specified intermediate layer of the predetermined matting model is obtained as a second mask image, wherein the output of the specified intermediate layer includes the main body and edge parts of the target object; The output image of the image to be processed after the non-subject part of the image is stripped by the predetermined matting model is obtained, and it is used as the first mask image.
3. The laser processing method as described in claim 1, characterized in that, The step of blurring the second mask image to obtain the processed second mask image includes: Gaussian blur is applied to the second mask image to obtain a blurred second mask image; The blurred second mask image is made transparent to obtain the processed second mask image.
4. The laser processing method as described in claim 1, characterized in that, The step of overlaying the first mask image and the processed second mask image to obtain the target processed image includes: The first mask image and the processed second mask image are subjected to a difference operation to obtain the difference portion image; The difference portion of the image is added to the first mask image to obtain the target processed image.
5. The laser processing method as described in claim 1, characterized in that, Before the step of performing image masking on the image to be processed to obtain a first mask image and a second mask image of the target object in the image to be processed, the following steps are included: Target recognition is performed on the image to be processed to obtain each target object in the image to be processed; The image to be processed is divided into blocks according to each target object to obtain the block-based image to be processed, and each block of the image to be processed is then processed by image matting.
6. The laser processing method as described in claim 5, characterized in that, The step of overlaying the first mask image and the second mask image to obtain the target processed image further includes: The first mask image and the second mask image obtained by the image cutout process of each image to be processed are superimposed to obtain the object processing image of each target object; The object processing images of each target object are fused together to obtain the target processing image.
7. The laser processing method according to claim 1, characterized in that, The step of importing the target image into the laser processing process includes: The target processing image is displayed in an editable interface; wherein, the editable interface includes an image import control, which is used to import the target processing image in the editable interface into the laser processing process; In response to a trigger operation on the image import control, the target processing image is imported into the laser processing process.
8. The laser processing method according to claim 1, characterized in that, The step of importing the target processing image into the laser processing process so that the processing equipment performs laser processing based on the target processing image includes: The target image to be processed is displayed in an editable interface, and processing instructions are generated based on the target image to be processed. The processing instructions are sent to the processing equipment so that the processing equipment performs laser processing on the material to be processed based on the processing instructions.
9. The laser processing method according to any one of claims 1 to 8, characterized in that, Following the step of acquiring the image to be processed, the following is included: In response to the triggering operation of the image cutout processing control in the editable interface, the image cutout processing is performed on the image to be processed to obtain the target processed image; The target image to be processed and the image to be processed with a mask display area are displayed in an editable interface; wherein, the mask display area is a mask-covered area displayed on the target object of the image to be processed.
10. The laser processing method as described in claim 9, characterized in that, The editable interface includes adjustment controls for the mask display area, and after the step of displaying the target processing image and the image to be processed with the mask display area in the editable interface, the following is included: In response to the triggering operation of the adjustment control for the mask display area, the mask display area is adjusted accordingly to obtain and display a new mask display area; The target processing image is updated according to the new mask display area, and the updated target processing image is displayed in the editable interface.
11. The laser processing method according to claim 9, characterized in that, The editable interface also includes an image scaling control; the laser processing method further includes: In response to the adjustment operation of the image scaling control, the image to be processed and / or the target image to be processed with the mask display area are scaled, and the scaled image to be processed and / or the target image to be processed with the mask display area are displayed.
12. The laser processing method according to claim 9, characterized in that, After the step of displaying the target image for processing and the image to be processed with a mask display area in the editable interface, the following steps are included: In response to the interface closing operation, the editable interface is closed, and the image to be processed with the mask display area is saved; In response to the interface opening operation, the editable interface is opened, and the image to be processed with the mask display area is displayed in the editable interface.
13. A processing equipment, characterized in that, The processing equipment includes: slide rail; A processing head, which is slidably mounted on the slide rail; A communication component, the communication component being configured to receive processing instructions generated from a target processing image obtained based on the steps of the laser processing method according to any one of claims 1 to 12; A controller, based on the processing instructions, controls the processing head to move on the slide rail for processing.
14. A processing system, characterized in that, The processing system includes: Processing equipment, the processing equipment comprising a communication component, a controller, a slide rail, and a processing head, the processing head being slidably mounted on the slide rail; and A terminal device that communicates with the processing equipment, the terminal device being used to perform the laser processing method according to any one of claims 1 to 12.
15. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the laser processing method as described in any one of claims 1 to 12.
16. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the laser processing method as described in any one of claims 1 to 12.
