Method, device and equipment for generating vector manuscript drawing for producing pet identity card and medium

By generating vector manuscript pictures of pet identity cards in one-click, the problems of complex operations and shortage of art in the existing technology are solved, and efficient and fast vector manuscript pictures are achieved, reducing corporate costs.

CN120070664APending Publication Date: 2025-05-30ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510108347.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The prior art is complex in generating vector manuscript diagrams of pet identity cards, requiring multiple tools and steps, resulting in factories facing the problem of shortage of artists and extended delivery when high order volumes.

Method used

Through the pictures uploaded by users, the required vector manuscript pictures are generated in one click, including cutouts, style conversion, vector image conversion and synthetic frames, which are directly used for production, simplifying the process.

Benefits of technology

It greatly improves work efficiency, reduces the workload of artists, shortens the design cycle, reduces the cost of the enterprise, and can quickly generate vector manuscript drawings that meet the requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070664A_ABST
    Figure CN120070664A_ABST
Patent Text Reader

Abstract

The invention provides a method, a device, equipment and a medium for generating a vector manuscript drawing for producing a pet identity card, and the method comprises the steps: carrying out the matting of a picture uploaded by a user, and obtaining a needed main body picture in the picture; converting the main body picture into a required style picture; converting the style picture into a main body vector diagram; and synthesizing the outer frame vector diagram with the set size and shape with the main body vector diagram to obtain the required vector manuscript diagram, and generating the required vector manuscript diagram in a one-key manner through the picture uploaded by the user, so that the required vector manuscript diagram is directly used for production, and the working efficiency is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method, device, equipment and medium for generating a vector manuscript image for producing a pet identity card. Background Art

[0002] At present, when factories produce ID cards with pet images, some production equipment can only recognize vector graphics. Therefore, when producing, it is necessary to first generate vector graphics manuscripts, and then input the vector graphics manuscripts into the equipment before production can be carried out. At present, factories need to use multiple tools and multiple steps to process the vector graphics manuscripts of ID cards with pet images:

[0003] 1. You need to use PS or other special cutout tools to cut out the pet photos provided by the customer, keep the head or the whole body in the photo according to the user's requirements, and remove the background;

[0004] 2. It is necessary to use the photocopy and other filters of tools such as PS or gimp for binarization, or use manual hand-drawing to obtain binary images of various styles;

[0005] 3. Import the binary pet image into CDR software and convert it into a vector image through multiple steps;

[0006] 4. Select fonts in CDR, add strings such as pet names, and convert text to vector graphics;

[0007] 5. Add a frame, and adjust the position and size of the pet vector graphics and text vector graphics;

[0008] 6. Save the final vector image for production.

[0009] The existing technology is complex to operate and requires a lot of manual processing. When the factory has a large number of orders, it often faces a shortage of graphic designers and needs to outsource the orders, which in turn extends the delivery time. Summary of the invention

[0010] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for generating vector manuscript images for producing pet identity cards. The required vector manuscript images can be generated in one click through pictures uploaded by users and directly used in production, thereby greatly improving work efficiency.

[0011] In a first aspect, the present invention provides a method for generating a vector draft image of a pet identification card, comprising the following steps:

[0012] Step 1: Cut out the picture uploaded by the user to obtain the main picture required in the picture;

[0013] Step 2: Convert the main image into the required style image;

[0014] Step 3: Convert the style picture into a main body vector graph;

[0015] Step 4: Synthesize the outer frame vector graph with the set size and shape and the main body vector graph to obtain the required vector manuscript graph.

[0016] In a second aspect, the present invention provides a device for generating a vector manuscript graph of a pet identification tag, including:

[0017] A main body matting module that mats the picture uploaded by the user to obtain the required main body picture in the picture;

[0018] A style conversion module that converts the main body picture into the required style picture;

[0019] A vector graph conversion module that converts the style picture into a main body vector graph;

[0020] A generated manuscript graph module that synthesizes the outer frame vector graph with the set size and shape and the main body vector graph to obtain the required vector manuscript graph.

[0021] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method described in the first aspect is implemented.

[0022] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.

[0023] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:

[0024] The method of the present invention enables factory-related personnel such as salesmen and customer service to generate the vector manuscript graph for final production with one key according to the requirements given by customers. The effect of the vector manuscript graph meets the requirements, and there is no need for graphic designers to process it, greatly reducing the workload of graphic designers.

[0025] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features, and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are specifically given below. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The present invention will be further described below with reference to the accompanying drawings in conjunction with the embodiments.

[0027] Figure 1 It is a flowchart in the method in Embodiment 1 of the present invention;

[0028] Figure 2 This is a schematic structural diagram of the device in the second embodiment of the present invention. Specific implementation mode

[0029] By providing a method, device, equipment and medium for generating vector manuscript diagrams of pet identity cards in the embodiments of the present application, the cost of enterprises is greatly reduced, and vector manuscript diagrams can be generated quickly, greatly improving production efficiency.

[0030] Embodiment 1

[0031] As Figure 1 shown, this embodiment provides a method for generating a vector manuscript diagram of a pet identity card, including the following steps:

[0032] Step 1: Perform matting on the picture uploaded by the user to obtain the required main picture in the picture;

[0033] Step 2: Convert the main picture to generate the required style picture;

[0034] Step 3: Convert the style picture to a main vector graph; reduce the main vector graph according to the size of the outer frame vector graph;

[0035] Step 4: Synthesize the outer frame vector graph with the set size and shape and the main vector graph to obtain the required vector manuscript diagram.

[0036] In this embodiment, preferably, step 1 is specifically: judge the pixels of the picture uploaded by the user. If the pixels of the picture are less than 2000×2000, directly perform matting operation through the visual intelligence open platform to obtain the required main picture; if the pixels of the picture are greater than or equal to 2000×2000, use Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to perform equal-proportion scaling on the picture to obtain a scaled picture; perform matting operation on the scaled picture through the visual intelligence open platform to obtain a first mask picture; use Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to perform equal-proportion reduction on the first mask picture to obtain a second mask picture of the original size; read the alpha channel of each pixel point in the picture uploaded by the user to obtain a first matrix, read the alpha channel of each pixel point in the second mask picture to obtain a second matrix, and call Core.min to merge the first matrix and the second matrix to obtain a third matrix; replace the alpha channel in the picture uploaded by the user with the third matrix to obtain the required main picture;

[0037] Due to the cropping size limit of Alibaba Cloud Vision Intelligence Open Platform, when the longest side exceeds 2000 pixels, it needs to be scaled proportionally. Call Imgproc.resize and use the Imgproc.INTER_LANCZOS4 algorithm for image scaling.

[0038] Call Imgproc.resize and use the Imgproc.INTER_LANCZOS4 algorithm for image scaling. This algorithm can reduce the impact of artifacts while maintaining edge sharpness.

[0039] Obtain the cropping result based on the black and white image + original image:

[0040] a. Extract the alpha channel of the original image. Call Core.min, which will take the minimum value of the mask and the alpha channel of the original image to ensure that the original information of the alpha channel is retained. Through this step of processing, the lines of the obtained cropping can be made more perfect.

[0041] b. Remove the alpha channel of the original image and add the black and white image as the new alpha channel for layer merging.

[0042] c. Set the color value of the transparent area to black. This step is to reduce the size of the cropping result image and save storage costs.

[0043] The core code is as follows:

[0044] / / Create a fully transparent matrix with the same size as the original image for comparison;

[0045] Mat compareAlpha = new Mat(outImg.size(), CvType.CV_8UC1, Scalar.all(0.0));

[0046] / / Used to save the comparison result;

[0047] Mat compareResult = new Mat();

[0048] / / Compare the alpha channel of the original image and alpha. The positions where the value in the obtained mask is 0 are the transparent positions in the original image;

[0049] Core.compare(outPlanes.get(3), compareAlpha, compareResult, Core.CMP_EQ);

[0050] / / Create a fully black matrix with the same size as the original image;

[0051] Mat black = new Mat(outImg.size(), outImg.type(), Scalar.all(0));

[0052] / / Copy the black in black to the corresponding position in outImg according to the mask;

[0053] Core.bitwise_and(black, outImg, outImg, compareResult);

[0054] In this embodiment, preferably, step 2 is specifically as follows: Obtain a style map of a set style, where the style map includes multiple pictures of the same set item in different proportions in the picture to obtain training data; Pass each style map through a multimodal model to label it with a style label in a set format to form a corresponding label file; Set the number of training epochs, learning rate, and training image pixels, and then input the training data and the label file to perform Lora model training to obtain the required Lora style model; Then input the main picture, the set prompt, and the Lora style model into the diffusion model to generate the required style picture; The diffusion model can be StableDiffusion.

[0055] In this embodiment, preferably, step 3 is specifically as follows: Convert the style picture into a main vector graph using the potrace open source library;

[0056] Step 4 is specifically as follows: If text needs to be added, synthesize the required text vector graph, the outer frame vector graph of the set size and shape with the main vector graph to obtain the required vector manuscript graph; If text does not need to be added, synthesize the outer frame vector graph of the set size and shape with the main vector graph to obtain the required vector manuscript graph.

[0057] Based on the same inventive concept, the present application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.

[0058] Embodiment 2

[0059] As Figure 2 shown, in this embodiment, a device for generating a vector manuscript graph of a pet identification tag is provided, including:

[0060] A main body matting module that mats the picture uploaded by the user to obtain the required main picture in the picture;

[0061] A style conversion module that converts the main picture into the required style picture;

[0062] A vector graph conversion module that converts the style picture into a main vector graph;

[0063] The generated manuscript diagram module synthesizes the outer frame vector diagram with the set size and shape and the main body vector diagram to obtain the required vector manuscript diagram.

[0064] In this embodiment, preferably, the main body matte extraction module specifically: judges the pixels of the picture uploaded by the user. If the pixels of the picture are less than 2000×2000, directly perform matte extraction operation through the visual intelligence open platform to obtain the required main body picture; if the pixels of the picture are greater than or equal to 2000×2000, use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to scale the picture proportionally to obtain a scaled picture; perform matte extraction operation on the scaled picture through the visual intelligence open platform to obtain the first mask picture; use the Imgproc.resize in OpenCV with the Imgproc.INTER_LANCZ0S4 algorithm to restore the first mask picture proportionally to the second mask picture of the original size; read out the alpha channel of each pixel point in the picture uploaded by the user to obtain the first matrix, read out the alpha channel of each pixel point in the second mask picture to obtain the second matrix, and call Core.min to merge the first matrix and the second matrix to obtain the third matrix; replace the alpha channel in the picture uploaded by the user with the third matrix to obtain the required main body picture.

[0065] In this embodiment, preferably, the style conversion module specifically: obtains a style picture with a set style, and the style picture includes multiple pictures of the same set item in different proportions in the picture to obtain training data; tags each of the style pictures through a multimodal model according to the set format style label to form a corresponding label file; sets the number of training rounds, learning rate, and training image pixels, and then inputs the training data and the label file to perform Lora model training to obtain the required Lora style model; then inputs the main body picture, the set prompt words, and the Lora style model into the diffusion model to generate the required style picture.

[0066] In this embodiment, preferably, the vector diagram conversion module specifically: converts the style picture into a main body vector diagram using the potrace open source library;

[0067] The generated manuscript diagram module specifically: if text needs to be added, synthesize the required text vector diagram, the outer frame vector diagram with the set size and shape, and the main body vector diagram to obtain the required vector manuscript diagram; if text does not need to be added, synthesize the outer frame vector diagram with the set size and shape and the main body vector diagram to obtain the required vector manuscript diagram.

[0068] Since the device introduced in the second embodiment of the present invention is the device used to implement the method of the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, those skilled in the art can understand the specific structure and variations of the device, so it will not be elaborated here. Any device used to implement the method of the first embodiment of the present invention falls within the scope of protection of the present invention.

[0069] Based on the same inventive concept, this application provides an embodiment of an electronic device corresponding to the first embodiment. For details, see the third embodiment.

[0070] Embodiment Three

[0071] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, any implementation manner in the first embodiment can be realized.

[0072] Since the electronic device introduced in this embodiment is the device used to implement the method in the first embodiment of this application, based on the method introduced in the first embodiment of this application, those skilled in the art can understand the specific implementation manners and various variations of the electronic device in this embodiment. Therefore, the details of how this electronic device implements the method in the embodiments of this application will not be introduced in detail here. Any device used by those skilled in the art to implement the method in the embodiments of this application falls within the scope of protection of this application.

[0073] Based on the same inventive concept, this application provides a storage medium corresponding to the first embodiment. For details, see the fourth embodiment.

[0074] Embodiment Four

[0075] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any implementation manner in the first embodiment can be realized.

[0076] The technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0077] In this embodiment, the user can upload a picture and a set style to generate a vector manuscript drawing for final production with one click. When the user confirms that the effect of the vector manuscript drawing meets the requirements, there is no need for a graphic artist to process it, greatly reducing the workload of the graphic artist; this greatly improves the production efficiency, shortens the design cycle before production, and does not require the participation of a graphic artist, greatly reducing the cost of the enterprise.

[0078] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0079] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0080] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0082] Although the specific embodiments of the present invention have been described above, those skilled in the art of this technology should understand that the specific embodiments we described are illustrative rather than used to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered by the scope protected by the claims of the present invention.

Claims

1. A method for generating a vector draft image for producing a pet ID card, characterized in that: The steps include: Step 1: Cut out the picture uploaded by the user to obtain the main picture required in the picture; Step 2: Convert the main image into the required style image; Step 3: Convert the style image into a main vector image; Step 4: synthesize the outer frame vector image of a set size and shape with the main body vector image to obtain the required vector manuscript image.

2. A method for generating a vector draft image for producing a pet ID card according to claim 1, characterized in that: The step 1 is specifically as follows: judging the pixels of the picture uploaded by the user, if the pixels of the picture are less than 2000×2000, directly performing a cutout operation through the visual intelligence open platform to obtain the required main picture; if the pixels of the picture are greater than or equal to 2000×2000, using Imgproc.resize in OpenCV and using the Imgproc.INTER_LANCZ0S4 algorithm to scale the picture in equal proportion to obtain a scaled picture; performing a cutout operation on the scaled picture through the visual intelligence open platform to obtain a first mask picture; restoring the first mask picture to a second mask picture of the original size in equal proportion through Imgproc.resize in OpenCV and using the Imgproc.INTER_LANCZ0S4 algorithm; reading out the transparent channel of each pixel in the picture uploaded by the user to obtain a first matrix, reading out the transparent channel of each pixel in the second mask picture to obtain a second matrix, calling Core.min to merge the first matrix with the second matrix to obtain a third matrix; The transparent channel in the picture uploaded by the user is replaced by the third matrix to obtain the required main picture.

3. A method for generating a vector draft image for producing a pet ID card according to claim 1, characterized in that: The step 2 is specifically as follows: obtaining a style map of a set style, wherein the style map includes multiple pictures of the same set object in different proportions in the pictures, and obtaining training data; labeling each of the style maps according to a set format style label through a multimodal model to form a corresponding label file; setting the number of training rounds, learning rate, and training image pixels, and then inputting the training data and the label file to perform Lora model training to obtain the required Lora style model; and then inputting the main picture, the set prompt words, and the Lora style model into the diffusion model to generate the required style picture.

4. A method for generating a vector draft image for producing a pet ID card according to claim 1, characterized in that: The step 3 specifically includes: converting the style image into a main vector image using the potrace open source library; The specific step 4 is: if text needs to be added, the required text vector image, the outer frame vector image of the set size and shape and the main body vector image are synthesized to obtain the required vector manuscript image; if text does not need to be added, the outer frame vector image of the set size and shape is synthesized with the main body vector image to obtain the required vector manuscript image.

5. A device for generating vector draft images for producing pet identity cards, characterized in that: include: The main image cutout module cuts out the image uploaded by the user to obtain the main image required in the image; Style conversion module, converting the main image into the required style image; Vector image conversion module, converting style images into subject vector images; A manuscript image generation module is used to synthesize an outer frame vector image of a set size and shape with the main body vector image to obtain the required vector manuscript image.

6. The device for generating vector draft images for producing pet ID cards according to claim 5, characterized in that: The subject cutout module is specifically as follows: the pixels of the picture uploaded by the user are judged. If the pixels of the picture are less than 2000×2000, the cutout operation is directly performed through the visual intelligence open platform to obtain the required subject picture; if the pixels of the picture are greater than or equal to 2000×2000, the picture is scaled in proportion using the Imgproc.resize in OpenCV and the Imgproc.INTER_LANCZ0S4 algorithm to obtain a scaled picture; the scaled picture is cutout through the visual intelligence open platform to obtain a first mask picture; the first mask picture is proportionally restored to a second mask picture of the original size through the Imgproc.resize in OpenCV and the Imgproc.INTER_LANCZ0S4 algorithm; the transparent channel of each pixel in the picture uploaded by the user is read out to obtain a first matrix, the transparent channel of each pixel in the second mask picture is read out to obtain a second matrix, and Core.min is called to merge the first matrix with the second matrix to obtain a third matrix; The transparent channel in the picture uploaded by the user is replaced by the third matrix to obtain the required main picture.

7. The device for generating vector draft images for producing pet ID cards according to claim 5, characterized in that: The style conversion module is specifically as follows: obtaining a style map of a set style, wherein the style map includes multiple pictures of the same set object in different proportions in the picture, and obtaining training data; labeling each of the style maps according to the set format style label through a multimodal model to form a corresponding label file; setting the number of training rounds, learning rate and training image pixels, and then inputting the training data and the label file to perform Lora model training to obtain the required Lora style model; and then inputting the main picture, the set prompt words and the Lora style model into the diffusion model to generate the required style picture.

8. The device for generating vector draft images for producing pet ID cards according to claim 5, characterized in that: The vector map conversion module specifically includes: converting the style image into a main vector map using the potrace open source library; The module for generating a manuscript image is specifically as follows: if text needs to be added, the required text vector image, the outer frame vector image of a set size and shape are synthesized with the main body vector image to obtain the required vector manuscript image; if text does not need to be added, the outer frame vector image of a set size and shape is synthesized with the main body vector image to obtain the required vector manuscript image.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.