Image engraving method and device, electronic equipment and storage medium

By performing grayscale conversion on the image to be etched, the target area is determined and the etch path is generated, which solves the problems of low efficiency and resource waste in existing laser etched technology, and achieves efficient image etched and extended equipment life.

CN121083103APending Publication Date: 2025-12-09SHENZHEN ENFU ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511282486.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-09
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing technologies still generate invalid GCode instructions when processing images containing a large number of pure white areas, resulting in low laser engraving efficiency, serious waste of equipment resources, and shortened lifespan of the laser machine.

Method used

By performing grayscale conversion on the image to be etched, the target area is determined and a corresponding etch path is generated. The laser equipment is then controlled to perform the etch operation, avoiding frequent movement of non-target areas. A horizontal serpentine path or a bidirectional scanning path is used to optimize the movement of the laser head.

Benefits of technology

It significantly reduces invalid paths in the laser engraving process, improves overall processing efficiency, extends machine life, avoids waste of equipment resources, and reduces the number of GCode instructions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121083103A_ABST
    Figure CN121083103A_ABST
Patent Text Reader

Abstract

The invention discloses an image engraving method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a to-be-engraved image; performing gray conversion processing on the to-be-engraved image to obtain a target image; determining a target area according to the pixel data of the target image; wherein the target area is an image area, needing to be engraved, in a target image; and generating a corresponding engraving path according to the target area, and controlling laser equipment to execute engraving operation according to the engraving path so as to complete image engraving. According to the technical scheme, invalid paths in the laser engraving process are remarkably reduced, and the overall machining efficiency is improved; frequent movement of the laser head in a non-target area is reduced, and the service life of the machine is prolonged; and the waste of equipment resources is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of laser processing technology, and in particular to a method, apparatus, electronic device, and storage medium for engraving images. Background Technology

[0002] A laser engraving machine is a device that uses a laser beam to locally ablate or discolor the surface of a material. It is widely used for engraving patterns on materials such as wood, leather, paper, and metal. The common way to control a laser engraving machine is to generate and transmit a set of instructions (such as GCode) to control the switching on and off of the laser and its movement path, so as to realize the reproduction of the image content on the material surface.

[0003] In image engraving, a common practice is to convert the input image to grayscale, then scan the image pixels line by line, and generate corresponding GCode control instructions based on the grayscale values. However, when processing images containing a large number of pure white areas (i.e., areas that do not require processing), traditional methods still generate GCode instructions for motion paths for these areas, causing the laser head to make meaningless empty runs.

[0004] This practice not only severely impacts processing efficiency but also wastes equipment resources and reduces the lifespan of the laser machine. Summary of the Invention

[0005] This invention provides a method, apparatus, electronic device, and storage medium for engraving images, which significantly reduces invalid paths during laser engraving, improves overall processing efficiency, reduces frequent movement of the laser head in non-target areas, extends machine lifespan, and avoids waste of equipment resources.

[0006] According to one aspect of the present invention, a method for engraving an image is provided, the method comprising:

[0007] Obtain the image to be sculpted;

[0008] The image to be sculpted is converted to grayscale to obtain the target image;

[0009] Based on the pixel data of the target image, a target region is determined; wherein, the target region is the image area in the target image that requires engraving.

[0010] A corresponding engraving path is generated based on the target area, and the laser device is controlled to perform engraving operations based on the engraving path to complete the image engraving.

[0011] According to another aspect of the present invention, an apparatus for engraving images is provided, the apparatus comprising:

[0012] The image to be sculpted acquisition module is used to acquire the image to be sculpted;

[0013] The target image acquisition module is used to perform grayscale conversion processing on the image to be sculpted to obtain the target image;

[0014] The target region determination module is used to determine the target region based on the pixel data of the target image; wherein, the target region is the image region in the target image that needs to be engraved.

[0015] The image engraving module is used to generate a corresponding engraving path based on the target area, and control the laser device to perform engraving operations based on the engraving path to complete the image engraving.

[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0017] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a method for engraving an image as described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement a method for engraving an image as described in any embodiment of the present invention.

[0019] The technical solution of this invention involves acquiring an image to be engraved; performing grayscale conversion on the image to obtain a target image; determining a target area based on the pixel data of the target image; generating a corresponding engraving path based on the target area; and controlling the laser device to perform the engraving operation according to the engraving path to complete the image engraving. This technical solution significantly reduces invalid paths during laser engraving, improving overall processing efficiency; reduces frequent movement of the laser head in non-target areas, extending machine lifespan; and avoids waste of equipment resources. It effectively solves the problems of low processing efficiency, serious waste of equipment resources, and shortened lifespan of laser machines in existing technologies.

[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of a method for engraving an image according to Embodiment 1 of the present invention;

[0023] Figure 2 A schematic diagram of the target image provided in Embodiment 1 of this application;

[0024] Figure 3 This is the optimized machine motion path provided in Embodiment 1 of this application;

[0025] Figure 4 This is a schematic diagram illustrating a process of engraving an image according to Embodiment 2 of the present invention;

[0026] Figure 5 A flowchart of the image engraving process provided in Embodiment 2 of this application;

[0027] Figure 6 This is a schematic diagram of the structure of an image engraving device provided in Embodiment 3 of the present invention;

[0028] Figure 7 This is a schematic diagram of the structure of an electronic device that implements a method for engraving images according to an embodiment of the present invention. Detailed Implementation

[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "current," "target," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0031] Example 1

[0032] Figure 1 This is a flowchart of a method for engraving an image according to Embodiment 1 of the present invention. This embodiment is applicable to the engraving of images. The method can be executed by an image engraving device, which can be implemented in hardware and / or software and can be configured in a device. For example, the device can be a backend server or other device with communication and computing capabilities. Figure 1 As shown, the method includes:

[0033] S110. Obtain the image to be sculpted.

[0034] The image to be engraved is in color.

[0035] In this solution, the image to be sculpted can be obtained from the database.

[0036] S120. Perform grayscale conversion on the image to be sculpted to obtain the target image.

[0037] The target image can be a grayscale image or a black and white image.

[0038] Specifically, the channel information of the image to be sculpted is processed using a specific formula to convert the image into a target image containing only brightness information.

[0039] S130. Determine the target region based on the pixel data of the target image; wherein the target region is the image region in the target image that needs to be engraved.

[0040] In this embodiment, the target region is the image region in the target image that requires engraving. The non-target region is the image region in the target image that does not require engraving.

[0041] In this scheme, the target image is divided into target region and non-target region based on the pixel data of the target image.

[0042] Specifically, the pixel data of the target image can be compared with a preset threshold to determine the target region and non-target regions. For example, assuming the preset threshold is 128, the region consisting of all pixels in the target image with pixel data less than or equal to 128 is determined as the target region; the region consisting of all pixels in the target image with pixel data greater than 128 is determined as the non-target region.

[0043] Furthermore, the pixel data of the target image can be compared point by point with a preset threshold row by row. Initially, target areas meeting the threshold requirements and non-target areas not meeting the requirements are selected from the entire row of pixel data. If a target area meeting the threshold requirements exists after the initial selection, the effective pixel range of that row is further reduced at both ends. By accurately removing invalid edge areas, the core effective pixels are ultimately retained, improving the accuracy of target area localization.

[0044] S140. Generate a corresponding engraving path according to the target area, and control the laser device to perform engraving operation according to the engraving path to complete the image engraving.

[0045] The carving path is based on pixel coordinates and is a continuous trajectory formed by the sequential connection of a series of ordered pixel positions.

[0046] In this scheme, a path planning algorithm is used to generate the corresponding carving path based on the pixel data arrangement order in the target area.

[0047] Among them, the laser equipment is a laser engraving machine, which can be used for engraving and processing of various materials.

[0048] Furthermore, the laser equipment can be turned on and off according to the engraving path, thereby completing the image engraving.

[0049] Optionally, the engraving path includes a lateral serpentine path or a bidirectional scanning path.

[0050] In this embodiment, the core logic of the bidirectional scanning path is: the laser head moves back and forth horizontally, and after completing each line scan, it only moves one line distance vertically before scanning the next line in the opposite direction. There is no need to run back to the starting point, thereby reducing unnecessary movement and improving processing efficiency.

[0051] In this scheme, the horizontal serpentine path is the specific path shape formed by limiting the fixed direction of bidirectional scanning to the horizontal (i.e., the horizontal direction parallel to the length / width direction of the engraved workpiece).

[0052] By using a lateral serpentine path or a bidirectional scanning path to control the laser equipment to perform engraving operations, image engraving is completed, significantly reducing invalid paths during the laser engraving process and improving overall processing efficiency.

[0053] Optionally, controlling the laser device to perform engraving operations according to the engraving path includes:

[0054] Generate carving control instructions based on the carving path;

[0055] According to the engraving control command, the laser device is controlled to perform an engraving operation that matches the engraving path.

[0056] Specifically, engraving control commands can use GCode control commands, which include two types: G0 and G1. G0 commands control the laser equipment to turn off the laser and only perform movement operations; G1 commands control the laser equipment to turn on the laser and perform processing operations.

[0057] In this solution, optimized GCode control instructions are generated based on the engraving path. These instructions can control the laser device to turn the laser on and off, and drive the laser device to move to the corresponding specified coordinates according to the position of the pixels in the target image.

[0058] By generating an engraving path based on the target area and controlling the laser equipment to perform engraving operations accordingly, invalid paths in the laser engraving process can be significantly reduced to improve overall processing efficiency, reduce the frequent movement of the laser head in non-target areas to extend machine life, avoid waste of equipment resources, and reduce the number of generated GCode instructions to optimize transmission and storage. Moreover, this solution is easy to integrate into existing image-to-GCode workflows and has good scalability.

[0059] In this plan, Figure 2 A schematic diagram of the target image provided in Embodiment 1 of this application, as shown below. Figure 2 As shown, the target image is large, with the white area representing the unprocessed path and the black area representing the region to be processed. Existing techniques typically begin acquiring pixels from the top left corner and then move or carve line by line.

[0060] In this embodiment, Figure 3 The optimized machine motion path provided in Embodiment 1 of this application is as follows: Figure 3 As shown, the green frame represents the image size, the red line represents the machine's idle path, and the black line represents the machine's processing path. Using the optimized image processing method, blank areas are skipped, and the shortest effective path is found, thus greatly improving processing efficiency.

[0061] The technical solution of this invention involves acquiring an image to be engraved; performing grayscale conversion on the image to obtain a target image; determining a target area based on the pixel data of the target image; generating a corresponding engraving path based on the target area; and controlling the laser device to perform the engraving operation according to the engraving path to complete the image engraving. By implementing this technical solution, invalid paths during laser engraving are significantly reduced, improving overall processing efficiency; frequent movement of the laser head in non-target areas is reduced, extending machine lifespan; waste of equipment resources is avoided; and the number of generated GCode instructions is reduced to optimize transmission and storage. Furthermore, this solution is easily integrated into existing image-to-GCode workflows and has good scalability.

[0062] Example 2

[0063] Figure 4 This is a schematic diagram illustrating a process of engraving an image according to Embodiment 2 of the present invention. The relationship between this embodiment and the above embodiments is a detailed description of the target area determination process. Figure 4 As shown, the method includes:

[0064] S410, Obtain the image to be sculpted.

[0065] S420. Perform grayscale conversion on the image to be sculpted to obtain the target image.

[0066] S430. Obtain the current row pixel data in the target image; wherein the current row pixel data contains a number of consecutively arranged pixel values.

[0067] In this embodiment, the current row refers to the row in the target image that is currently in the process of executing the judgment flow. For example, the current row can be the first row or the second row of the target image, depending on the current stage of the judgment process. The pixel data of the current row contains several consecutively arranged pixel values.

[0068] Furthermore, the pixel data of the current row in the target image is obtained through an image reading tool.

[0069] In this plan, Figure 5 A flowchart of the image engraving process provided in Embodiment 2 of this application is shown below. Figure 5 As shown, the pixels in the target image are analyzed line by line.

[0070] S440. Determine whether the current row pixel data is greater than a preset first threshold.

[0071] The first threshold is set according to the requirements of the engraved image; for example, the first threshold is set to 128.

[0072] In this scheme, the specific value of the current row pixel data is compared with a first threshold to determine whether the current row pixel data is greater than the first threshold.

[0073] S450. If not, then the target region corresponding to the current row is determined based on the comparison result between the current row pixel data and the preset second threshold; wherein the second threshold is less than or equal to the first threshold.

[0074] In this scheme, if the pixel data of the current row is greater than the first threshold, the continuous region composed of all pixels in the current row is determined as the non-target region corresponding to the current row.

[0075] In this embodiment, when parsing image pixels line by line, a Boolean variable `isWhiteRow` is set, initially set to false. Each row of pixels is scanned; if the grayscale value of all pixels in that row is greater than a first threshold, `isWhiteRow` is set to true. When `isWhiteRow == true`, that row is skipped, no processing instructions are generated, and the laser head of the laser device is directly moved to the starting position of the next row.

[0076] Specifically, such as Figure 5 As shown, when processing the target image, a white line (non-target area) filtering operation must be performed first: First, a first threshold is set, and then the pixel data of the current line is judged. If the pixel data of the current line is greater than the first threshold, the line is judged as a "white line". For the current line judged as a white line, it is skipped and not retained. Only the image content of the non-white line is processed to achieve effective screening and optimization of the target image.

[0077] The second threshold is set according to the requirements of the sculpted image. The second threshold is less than or equal to the first threshold.

[0078] Furthermore, if the current row pixel data is less than or equal to the first threshold, the current row pixel data is compared with the second threshold, and the target area corresponding to the current row is determined based on the comparison result between the current row pixel data and the second threshold.

[0079] Optionally, the target region is determined based on the comparison result between the current row pixel data and a preset second threshold, including:

[0080] The pixel values ​​in the current row of pixel data are judged point by point. If the currently judged pixel value is less than the second threshold, the pixel point corresponding to the currently judged pixel value is taken as the starting point of the target region in the current row.

[0081] Continue to judge the pixel values ​​after the starting point in the current row point by point. If the currently judged pixel value is less than the second threshold, the temporary endpoint of the current row is continuously updated until a pixel value greater than or equal to the second threshold is detected. Then, the update stops and the last endpoint in the temporary endpoint is taken as the endpoint of the target area in the current row.

[0082] The continuous region consisting of all pixels between the starting point and the ending point is determined as the target region corresponding to the current row.

[0083] Specifically, each pixel value in the current row of pixel data is evaluated point by point. If the currently evaluated pixel value is less than the second threshold, the pixel corresponding to the currently evaluated pixel value (the first valid pixel) is taken as the starting point of the target region in the current row. The process continues to evaluate the pixel values ​​following the starting point in the current row. If the currently evaluated pixel value is less than the second threshold, the temporary ending point of the current row is continuously updated until a pixel value greater than or equal to the second threshold is detected. At this point, the update stops, and the last ending point (the last valid pixel) in the temporary ending point is taken as the ending point of the target region in the current row. The continuous region formed by all pixels between the starting and ending points is determined as the target region corresponding to the current row.

[0084] Specifically, when judging the pixel values ​​after the starting point of the current row point by point, if the currently detected pixel value is less than the second threshold, the temporary end point of the row is continuously updated; when a pixel value is detected to be greater than or equal to the second threshold, if there are still pixels less than the second threshold, the detection needs to continue and the temporary end point is updated; the detection stops when a pixel value is greater than or equal to the second threshold and all subsequent pixel values ​​remain greater than or equal to the second threshold.

[0085] By performing non-target area cropping on both ends of the current row, the target area is constructed only within the effective pixel coverage area. This can shorten the single movement distance of the engraving head and effectively compress the engraving time of each row.

[0086] Optionally, after taking the pixel corresponding to the currently determined pixel value as the starting point of the target region in the current row, the method further includes:

[0087] If all pixel values ​​following the starting point in the current row are less than the second threshold, then the last pixel in the current row is taken as the endpoint of the target region in the current row.

[0088] Specifically, when judging the pixel values ​​after the starting point of the current row point by point, if all pixel values ​​after the starting point of the current row are less than the second threshold, then the last pixel of the current row (the last valid pixel) is taken as the endpoint of the target region in the current row.

[0089] By performing non-target area cropping on both ends of the current row, the target area is constructed only within the effective pixel coverage area. This can shorten the single movement distance of the engraving head and effectively compress the engraving time of each row.

[0090] In this plan, such as Figure 5 As shown, further analysis of the current row's pixel data reveals that the first valid pixel is used as the start point (startPoint) and the last valid pixel as the end point (endPoint), cropping the blank pixel areas on both sides. The target region is generated only for the content within the valid pixel range, thus shortening the carving time and movement distance for each row.

[0091] Optionally, determining the target region based on the pixel data of the target image includes:

[0092] The target regions corresponding to all rows of the target image are integrated to obtain the complete target region of the target image.

[0093] In this scheme, the target image is scanned and processed line by line to accurately locate the target region corresponding to each row of pixel data; after the target regions of all rows are identified, the target regions determined by each row are systematically integrated; through integration and optimization, a complete and coherent target region of the target image is finally generated.

[0094] By defining the target area, invalid paths during laser engraving are significantly reduced, improving overall processing efficiency; the frequent movement of the laser head in non-target areas is reduced, extending machine lifespan; and waste of equipment resources is avoided.

[0095] S460. Generate a corresponding engraving path according to the target area, and control the laser device to perform engraving operation according to the engraving path to complete the image engraving.

[0096] In this plan, such as Figure 5 As shown, GCode control commands are generated to control the laser device to perform engraving operations in order to complete image engraving.

[0097] The technical solution of this invention involves: acquiring an image to be engraved; performing grayscale conversion on the image to obtain a target image; acquiring the pixel data of the current row in the target image; determining whether the pixel data of the current row is greater than a preset first threshold; if not, determining the target area corresponding to the current row based on the comparison result between the pixel data of the current row and a preset second threshold; generating a corresponding engraving path based on the target area; and controlling the laser device to perform engraving operations based on the engraving path to complete the image engraving. By implementing this technical solution, invalid paths during laser engraving are significantly reduced, improving overall processing efficiency; reducing frequent movement of the laser head in non-target areas, extending machine lifespan; avoiding waste of equipment resources; reducing the number of generated GCode instructions to optimize transmission and storage; and this solution is easily integrated into existing image-to-GCode workflows, possessing good scalability.

[0098] Example 3

[0099] Figure 6 This is a schematic diagram of the structure of an image engraving device provided in Embodiment 3 of the present invention. Figure 6 As shown, the device includes:

[0100] The image acquisition module 610 is used to acquire the image to be carved.

[0101] The target image acquisition module 620 is used to perform grayscale conversion processing on the image to be sculpted to obtain the target image;

[0102] The target region determination module 630 is used to determine the target region based on the pixel data of the target image; wherein, the target region is the image region in the target image that needs to be engraved.

[0103] The image engraving module 640 is used to generate a corresponding engraving path according to the target area, and control the laser device to perform engraving operations according to the engraving path to complete the image engraving.

[0104] Optionally, the target area determination module 630 includes:

[0105] The current row pixel data acquisition unit is used to acquire the current row pixel data in the target image; wherein, the current row pixel data includes a number of consecutively arranged pixel values;

[0106] The judgment unit is used to determine whether the current row pixel data is greater than a preset first threshold.

[0107] The target region determination unit corresponding to the current row is used to determine the target region corresponding to the current row based on the comparison result of the pixel data of the current row and the preset second threshold if no; wherein the second threshold is less than or equal to the first threshold.

[0108] Optionally, the target region determination unit corresponding to the current row is specifically used for:

[0109] The pixel values ​​in the current row of pixel data are judged point by point. If the currently judged pixel value is less than the second threshold, the pixel point corresponding to the currently judged pixel value is taken as the starting point of the target region in the current row.

[0110] Continue to judge the pixel values ​​after the starting point in the current row point by point. If the currently judged pixel value is less than the second threshold, the temporary endpoint of the current row is continuously updated until a pixel value greater than or equal to the second threshold is detected. Then, the update stops and the last endpoint in the temporary endpoint is taken as the endpoint of the target area in the current row.

[0111] The continuous region consisting of all pixels between the starting point and the ending point is determined as the target region corresponding to the current row.

[0112] Optionally, the target region determination unit corresponding to the current row is also used for:

[0113] If all pixel values ​​following the starting point in the current row are less than the second threshold, then the last pixel in the current row is taken as the endpoint of the target region in the current row.

[0114] Optionally, the target region determination unit corresponding to the current row is also used for:

[0115] The target regions corresponding to all rows of the target image are integrated to obtain the complete target region of the target image.

[0116] Optionally, the engraving path includes a lateral serpentine path or a bidirectional scanning path.

[0117] Optional, the image engraving module 640 is specifically used for:

[0118] Generate carving control instructions based on the carving path;

[0119] According to the engraving control command, the laser device is controlled to perform an engraving operation that matches the engraving path.

[0120] The image engraving apparatus provided in this embodiment of the invention can execute the image engraving method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0121] Example 4

[0122] Figure 7A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0123] like Figure 7 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0124] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0125] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a method of sculpting an image.

[0126] In some embodiments, a method for engraving an image may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for engraving an image described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a method for engraving an image by any other suitable means (e.g., by means of firmware).

[0127] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0128] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0129] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on 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.

[0130] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0131] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0132] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0133] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0134] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for engraving an image, characterized in that, include: Obtain the image to be sculpted; The image to be sculpted is converted to grayscale to obtain the target image; Based on the pixel data of the target image, a target region is determined; wherein, the target region is the image area in the target image that requires engraving. A corresponding engraving path is generated based on the target area, and the laser device is controlled to perform engraving operations based on the engraving path to complete the image engraving.

2. The method according to claim 1, characterized in that, Determining the target region based on the pixel data of the target image includes: Obtain the pixel data of the current row in the target image; wherein, the pixel data of the current row contains a number of consecutively arranged pixel values; Determine whether the current row pixel data is greater than a preset first threshold; If not, the target region corresponding to the current row is determined based on the comparison result between the current row pixel data and the preset second threshold; wherein the second threshold is less than or equal to the first threshold.

3. The method according to claim 2, characterized in that, Based on the comparison result between the current row pixel data and the preset second threshold, the corresponding target region is determined, including: The pixel values ​​in the current row of pixel data are judged point by point. If the currently judged pixel value is less than the second threshold, the pixel point corresponding to the currently judged pixel value is taken as the starting point of the target region in the current row. Continue to judge the pixel values ​​after the starting point in the current row point by point. If the currently judged pixel value is less than the second threshold, the temporary endpoint of the current row is continuously updated until a pixel value greater than or equal to the second threshold is detected. Then, the update stops and the last endpoint in the temporary endpoint is taken as the endpoint of the target area in the current row. The continuous region consisting of all pixels between the starting point and the ending point is determined as the target region corresponding to the current row.

4. The method according to claim 3, characterized in that, After taking the pixel corresponding to the currently determined pixel value as the starting point of the target region in the current row, the method further includes: If all pixel values ​​following the starting point in the current row are less than the second threshold, then the last pixel in the current row is taken as the endpoint of the target region in the current row.

5. The method according to any one of claims 1-4, characterized in that, Determining the target region based on the pixel data of the target image includes: The target regions corresponding to all rows of the target image are integrated to obtain the complete target region of the target image.

6. The method according to claim 1, characterized in that, The engraving path includes a horizontal serpentine path or a bidirectional scanning path.

7. The method according to claim 1, characterized in that, Controlling the laser device to perform engraving operations according to the engraving path includes: Generate carving control instructions based on the carving path; According to the engraving control command, the laser device is controlled to perform an engraving operation that matches the engraving path.

8. An apparatus for engraving images, characterized in that, include: The image to be sculpted acquisition module is used to acquire the image to be sculpted; The target image acquisition module is used to perform grayscale conversion processing on the image to be sculpted to obtain the target image; The target region determination module is used to determine the target region based on the pixel data of the target image; wherein, the target region is the image region in the target image that needs to be engraved. The image engraving module is used to generate a corresponding engraving path based on the target area, and control the laser device to perform engraving operations based on the engraving path to complete the image engraving.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a method for engraving an image according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a method for engraving an image according to any one of claims 1-7.