An image processing method and device based on vector graphics drawing
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-07-10
- Publication Date
- 2026-06-12
AI Technical Summary
In existing technologies, vector graphics conversion is inefficient and it is difficult to accurately remove text annotations and watermarks from design drawings, which affects the accuracy of the generated results.
By acquiring the design drawing to be processed, a pre-trained region recognition model is used to automatically identify candidate regions to be converted. Invalid characters are removed by combining optical character recognition (OCR) technology. Finally, vectorization is performed to obtain vector graphics.
It improves the efficiency and accuracy of vector graphics conversion, reduces manual intervention, saves time and labor costs, and enables batch processing of target areas in design drawings.
Smart Images

Figure CN116645678B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, and specifically relates to an image processing method and apparatus based on vector graphics drawing. Background Technology
[0002] In software development, it's often necessary to develop web pages or client applications based on design drafts. Vector image assets, which are small in size, easy to store and transmit over the network, and can be infinitely enlarged, are indispensable in this process. Since design drafts are large bitmap images that may contain various text annotations or watermarks, software developers cannot obtain vector image assets that can be directly used in their programs. To obtain vector image assets, the following solutions are currently used:
[0003] 1. Developers use tools such as Photoshop and Illustrator to process images, manually draw paths based on the shapes in the design drawings using the path tool, and then save them as vector graphics; 2. Use the intelligent recognition function in tools such as Photoshop and Illustrator to convert the image into shapes, and then save it as vector graphics; 3. Visit a third-party website that provides image format conversion services, upload the image, and select to convert it to vector graphics.
[0004] The first method, where developers manually draw paths using design software, relies heavily on manual drawing. It requires downloading the relevant software, possessing basic design skills, and understanding the operation of the specialized software. The resulting image quality is also inconsistent depending on the user's skill level, and it consumes significant time and manpower, resulting in low efficiency. The second and third methods, using built-in software or third-party website-provided intelligent conversion services, cannot accurately identify the target area for conversion. Users need to manually select the area to be converted, and generally, only a small area can be converted at a time, preventing batch conversion and further reducing efficiency. Furthermore, if the area to be converted contains text annotations, watermarks, or other interference, these programs or services cannot accurately remove these interferences, lowering accuracy and affecting the final result. Summary of the Invention
[0005] To address the problems existing in the prior art, this application provides an image processing method and apparatus based on vector graphics drawing, which effectively improves the efficiency and accuracy of vector graphics conversion.
[0006] According to a first aspect of this application, an image processing method based on vector graphics drawing is provided, the method comprising:
[0007] Obtain the design drawing to be processed and determine the candidate regions to be converted in the design drawing to be processed;
[0008] Optical character recognition is performed on the candidate regions to be converted to obtain a character dataset;
[0009] In response to determining that the character dataset includes invalid characters, the invalid characters are removed from the candidate regions to be converted to obtain the target regions to be converted;
[0010] The target region to be converted is vectorized to obtain vector graphics.
[0011] In some optional embodiments of this example, determining the candidate regions to be converted in the design drawing includes:
[0012] Based on a pre-trained region recognition model, the initial regions to be converted in the design drawing to be processed are determined.
[0013] The initial region to be converted is filtered, and in response to determining that the initial region to be converted includes an invalid region, the invalid region is removed from the initial region to be converted to obtain the candidate region to be converted.
[0014] In some optional embodiments of this example, the step of training the region recognition model includes:
[0015] Obtain sample design drawings from different fields and styles, and annotate the areas in the sample design drawings that need to be converted to obtain sample annotation information;
[0016] The neural network model is trained by using the sample design diagram as the sample input and the sample annotation information as the sample output.
[0017] In response to determining that the accuracy of the neural network model meets a preset accuracy threshold and / or the recall meets a preset recall threshold, a trained region recognition model is obtained.
[0018] In some optional embodiments of this example, the step of determining the invalid character includes:
[0019] The character dataset is parsed to obtain multiple character data.
[0020] Each character data is identified by both identifier elements and icon elements. If the character data is neither an identifier element nor an icon element, it is determined to be an invalid character. The identifier elements include brand symbols, company symbols, and organization symbols, and the icon elements include operation symbols, function symbols, and mini-program symbols.
[0021] In some optional embodiments of this example, removing the invalid characters from the candidate region to be converted to obtain the target region to be converted includes:
[0022] Determine the bounding box information of the invalid character;
[0023] Based on the bounding box information, determine the region coordinates of the invalid character in the candidate conversion area;
[0024] Based on the region coordinates, the invalid characters are removed from the candidate regions to be converted to obtain the target region to be converted.
[0025] In some alternative embodiments, the type of the design drawing to be processed includes a bitmap, and the vectorization process includes at least one of the following: edge detection processing, contour extraction processing, and curve fitting processing;
[0026] The method further includes: performing preprocessing operations on the design drawing to be processed; wherein the preprocessing operations include at least one of the following: grayscale processing, binarization processing, and noise reduction processing.
[0027] According to a second aspect of this application, an image processing apparatus based on vector graphics drawing is also provided, the apparatus comprising:
[0028] The candidate conversion region determination module is configured to acquire the design drawing to be processed and determine the candidate conversion regions of the design drawing to be processed;
[0029] An optical character recognition module is configured to perform optical character recognition on the candidate regions to be converted to obtain a character dataset;
[0030] The target region to be converted module is configured to remove the invalid characters from the candidate regions to be converted in response to determining that the character dataset includes invalid characters, thereby obtaining the target region to be converted.
[0031] The vector graphics determination module is configured to perform vectorization processing on the target area to be converted to obtain vector graphics.
[0032] According to a third aspect of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the image processing method based on vector graphics drawing.
[0033] According to a fourth aspect of this application, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the image processing method based on vector graphics drawing.
[0034] According to a fifth aspect of this application, a computer program product is also provided, comprising a computer program / instructions that, when executed by a processor, implement the steps of the image processing method based on vector graphics drawing.
[0035] This application provides an image processing method and apparatus based on vector graphics drawing. The method involves acquiring a design drawing to be processed and determining candidate regions to be converted; performing optical character recognition (OCR) on the candidate regions to obtain a character dataset; removing invalid characters from the candidate regions to obtain a target region to be converted in response to the determination that the character dataset includes invalid characters; and vectorizing the target region to obtain a vector graphic. In essence, by using machine learning technology to identify the regions to be converted in the design drawing and combining it with OCR technology to identify text regions and remove text interference, the method effectively improves the efficiency and accuracy of subsequent vectorization conversion. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is an exemplary system architecture diagram to which one embodiment of this application may be applied;
[0038] Figure 2 This is a flowchart of an image processing method based on vector graphics drawing according to an embodiment of this application;
[0039] Figure 3 This is a flowchart of a method for determining candidate regions to be converted according to an embodiment of this application;
[0040] Figure 4 This is a flowchart of a method for training a region recognition model according to an embodiment of this application;
[0041] Figure 5 This is a flowchart of a method for determining invalid characters according to an embodiment of this application;
[0042] Figure 6 This is a flowchart of a method for determining a target region to be converted according to an embodiment of this application;
[0043] Figure 7 This is a schematic diagram of an image processing apparatus based on vector graphics drawing according to an embodiment of this application;
[0044] Figure 8 This is a schematic diagram of a B / S system according to an embodiment of this application;
[0045] Figure 9 This is a block diagram of an electronic device used to implement an image processing method based on vector graphics drawing according to an embodiment of this application. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0047] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0048] Figure 1 An exemplary system architecture is shown, illustrating an embodiment of the vector graphics-based image processing method or vector graphics-based image processing apparatus to which the present application can be applied.
[0049] like Figure 1 As shown, the system architecture may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0050] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send images, etc. Various communication client applications, such as image processing software, web browser applications, search applications, or social media platform software, can be installed on terminal devices 101, 102, and 103.
[0051] Terminal devices 101, 102, and 103 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices, including but not limited to smartphones, tablets, e-book readers, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. They can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module. No specific limitations are imposed here.
[0052] Server 105 can be a server that provides various services, such as a backend server that performs vector processing on design drawings uploaded by users through terminal devices 101, 102, and 103. The backend server can analyze and process the acquired data and feed back the processing results (such as converted vector graphics) to terminal devices 101, 102, and 103.
[0053] It should be noted that server 105 can be either hardware or software. When server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When server 105 is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module. No specific limitations are made here.
[0054] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0055] It should be noted that the image processing method based on vector graphics drawing provided in this application embodiment is generally executed by server 105. Accordingly, the image processing device based on vector graphics drawing is generally disposed in server 105.
[0056] Figure 2 A schematic flowchart illustrating an image processing method based on vector graphics drawing according to an embodiment of this application is shown. (Refer to...) Figure 2 The method includes:
[0057] Step 201: Obtain the design drawing to be processed and determine the candidate regions to be converted in the design drawing to be processed;
[0058] Step 202: Perform optical character recognition on the candidate regions to be converted to obtain a character dataset;
[0059] Step 203: In response to determining that the character dataset includes invalid characters, remove the invalid characters from the candidate regions to be converted to obtain the target regions to be converted;
[0060] Step 204: Vectorize the target area to be converted to obtain vector graphics.
[0061] This application provides an image processing method based on vector graphics drawing. By using machine learning technology to identify the areas to be converted in the design drawing, and combining it with OCR technology to identify text areas, text interference is removed, effectively improving the efficiency and accuracy of subsequent vectorization conversion.
[0062] The following is about Figure 2Each step is explained in detail:
[0063] Step 201: Obtain the design drawing to be processed and determine the candidate regions to be converted in the design drawing to be processed.
[0064] In software development, it is often necessary to develop web pages or client-side programs based on design drawings. It should be understood that the design to be processed... Figure 1 Bitmap graphics are images composed of pixels, also known as raster images. They are typically used to store photographs, images, and other natural scenes, and become blurry when enlarged. Vector graphics, on the other hand, are images represented by mathematical formulas, also called vector images. Vector images are composed of a series of basic geometric shapes such as points, line segments, curves, and polygons. They can accurately represent images and can be infinitely enlarged or reduced. They are often used to store images of simple geometric shapes such as icons and text. Therefore, it is necessary to convert bitmap designs into vector graphics.
[0065] Specifically, the areas to be converted are the identifying symbols or graphics on the design drawing that can represent the brand, company, organization, etc., as well as the small icons on the computer interface that represent specific operations, functions, or applications.
[0066] In this embodiment, candidate regions to be converted in the design drawing to be processed can be automatically identified based on a pre-trained region recognition model. It should be understood that there are multiple candidate regions to be converted.
[0067] It should be understood that the design drawings to be processed may inevitably have some image overlap or partial image loss. Therefore, in order to improve the accuracy of vector conversion, in some optional methods of this embodiment, such as... Figure 3 As shown, step 201 further includes:
[0068] Step 2011: Based on the pre-trained region recognition model, determine the initial regions to be converted in the design drawing to be processed;
[0069] Step 2012: Filter the initial region to be converted. In response to determining that the initial region to be converted includes invalid regions, remove the invalid regions from the initial region to be converted to obtain the candidate region to be converted.
[0070] In this embodiment, based on a pre-trained region recognition model, all regions to be converted in the design drawing to be processed can be identified. As mentioned above, among these initially regions to be converted, there may be cases of image overlap, unclear images, or partial image loss. These initially regions to be converted are defined as invalid regions. It should be understood that converting invalid regions into vector graphics is meaningless.
[0071] Therefore, it is necessary to filter the initial region to be converted and remove invalid regions from it, and use the remaining initial region to be converted as a candidate region to be converted, thereby improving the accuracy of vector conversion.
[0072] In some optional embodiments of this example, such as Figure 4 As shown, the steps for training the region recognition model include:
[0073] Step 2013: Obtain sample design drawings from different fields and styles, and mark the areas in the sample design drawings that need to be converted to obtain sample annotation information.
[0074] In this embodiment, a large number of UI design images from different fields and styles are collected. The dataset should be large enough to ensure the accuracy of the trained model. Data augmentation operations such as rotation, scaling, and cropping can also be performed on the sample images to further increase the diversity of the samples.
[0075] After determining the sample design drawings, image annotation tools are used to mark the areas that need to be converted, such as Logo and Icon, in each sample design drawing. Here, Logo refers to a distinctive symbol or graphic used to represent a brand, company, organization, etc.; Icon refers to a small icon on a computer interface used to represent a specific operation, function, or application. The sample annotation information includes the coordinates and category of the annotation box; the category is the type of area to be converted, such as Logo and Icon in this embodiment.
[0076] Step 2014: Use the sample design diagram as the sample input and the sample annotation information as the sample output to train the neural network model.
[0077] In this embodiment, the neural network model can be YOLO, Faster R-CNN, etc. The input of the model is the labeled sample design map, and the output of the model is the coordinates and category of the labeled box.
[0078] Step 2015: In response to determining that the accuracy of the neural network model meets a preset accuracy threshold and / or the recall meets a preset recall threshold, a trained region recognition model is obtained.
[0079] In this embodiment, the model can be trained using 80% of the sample dataset and validated using 20% of the sample dataset. The accuracy and recall are observed, and the parameters are adjusted until the accuracy of the neural network model meets the preset accuracy threshold and / or the recall meets the preset recall threshold, thus obtaining the trained region recognition model.
[0080] This embodiment is based on machine learning technology to train a neural network model that can automatically identify the conversion area of the design drawing to be processed. Compared with the existing technology of manually drawing the conversion area, it can save time and labor costs and improve the efficiency of vector conversion of design drawings.
[0081] Step 202: Perform optical character recognition on the candidate regions to be converted to obtain a character dataset.
[0082] In this embodiment, optical character recognition based on OCR technology can process and analyze images of printed characters to obtain a character dataset in text form. By using OCR technology to identify the text in the area to be converted, text in the design drawing can be removed quickly and accurately during the conversion process, further improving the accuracy of the conversion.
[0083] Step 203: In response to determining that the character dataset includes invalid characters, remove the invalid characters from the candidate regions to be converted to obtain the target regions to be converted.
[0084] It should be understood that, without considering watermarks, the Logo and Icon in the aforementioned examples can be in the form of pure images, a combination of images and text, or pure text. Therefore, the character dataset obtained after performing optical character recognition on the candidate areas to be converted may include, in addition to the watermark text and other interfering text that needs to be removed, text symbols used to represent brands, companies, organizations, etc., or text icons used on computer interfaces to represent specific operations, functions, or applications. These text symbols and text icons cannot be removed as interfering text.
[0085] Therefore, in order to improve the completeness and accuracy of vector conversion, in some optional methods of this embodiment, it is necessary to pre-determine invalid characters in the character dataset, wherein invalid characters are the aforementioned interfering text.
[0086] like Figure 5 As shown, the steps to determine invalid characters include:
[0087] Step 2031: Parse the character dataset to obtain multiple character data;
[0088] Step 2032: For each character data, identify the identifier element and the icon element. In response to the character data not being an identifier element and not being an icon element, determine that the character data is invalid.
[0089] In this embodiment, after parsing the character dataset to obtain multiple character data, each character data can be matched with a pre-stored identifier element database and icon element database. If a match is successful, it indicates that the character data is not invalid. Alternatively, identifier element recognition and icon element recognition can be performed on each character data based on a pre-trained identifier element model and icon element model; this application does not limit this. When it is determined that the character data is neither an identifier element nor an icon element, it is determined that the character data is invalid.
[0090] In this embodiment, the identification elements include brand symbols, company symbols, and organization symbols. These symbols are all text-based. For example, a company's symbol is plain text and should not be considered an invalid character. The icon elements include operation symbols, function symbols, and mini-program symbols. These symbols are all text-based. For instance, an icon that performs calculations is an addition, subtraction, multiplication, or division equation, and the corresponding character data should not be considered invalid.
[0091] After determining that an invalid character is used, in some optional methods of this embodiment, such as Figure 6 As shown, removing the invalid characters from the candidate region to be converted to obtain the target region to be converted further includes:
[0092] Step 2033: Determine the bounding box information of the invalid character;
[0093] Step 2034: Determine the region coordinates of the invalid character in the candidate conversion area based on the bounding box information;
[0094] Step 2035: Based on the region coordinates, remove the invalid characters from the candidate region to be converted to obtain the target region to be converted.
[0095] In this embodiment, an open-source OCR engine such as Tesseract can be integrated into the system. The bounding box information provided by the engine is used to determine the regional coordinates of invalid characters in the candidate area to be converted, thereby removing the interfering text in the candidate area to be converted and obtaining the target area to be converted.
[0096] Step 204: Vectorize the target area to be converted to obtain vector graphics.
[0097] In this embodiment, the image of the target area to be converted after removing invalid characters is converted into vector graphics. This conversion can be performed using vectorization libraries such as Potrace, or by vectorizing the target area to be converted based on edge detection, contour extraction, curve fitting, etc., and finally all the design drawings to be processed are converted into vector graphics.
[0098] It should be noted that, in order to further improve the accuracy of vector conversion of the design drawings to be processed, the image processing method in this embodiment also includes:
[0099] Preprocessing operations are performed on the design drawing to be processed; wherein the preprocessing operations include at least one of the following: grayscale processing, binarization processing, and noise reduction processing, specifically:
[0100] Grayscale processing converts the design image to grayscale to reduce the image's dimensionality, facilitating subsequent analysis and processing; binarization converts the grayscale image to a black and white image, dividing pixels into black and white categories to highlight target objects; denoising removes noise generated during image acquisition or transmission.
[0101] Further, the aforementioned steps 201-204 are performed on the preprocessed design drawing to be processed, which will not be described in detail in this application.
[0102] It should also be noted that, based on the pre-trained region recognition model and filtering, multiple candidate regions to be converted in a design drawing can be identified. To improve the efficiency of vector conversion, each identified candidate region to be converted is segmented into an independent small image for subsequent processing. For example, steps 202-204 are performed synchronously in multiple threads on images from candidate region 1 to candidate region n, ultimately resulting in multiple vector graphics; or batch conversion is performed on images from candidate region 1 to candidate region n, reducing manual intervention and saving time and labor costs.
[0103] This application overcomes the shortcomings of existing bitmap-to-vector conversion methods, providing a method that is simple to operate, highly efficient, saves time and manpower, and improves conversion accuracy. By utilizing machine learning technology to identify and classify the areas to be converted, based on a pre-trained area recognition model, it can automatically identify areas such as logos and icons in a design drawing that need to be converted. During the conversion process, it can more accurately process the content of each area, improving conversion accuracy. Furthermore, it can identify all target areas to be converted in the drawing, and then perform batch OCR recognition and vector conversion, reducing manual intervention and improving efficiency.
[0104] Based on the same inventive concept, this application also provides an image processing apparatus based on vector graphics drawing, which can be used to implement the methods described in the above embodiments, as described in the following embodiments. Since the principle by which this image processing apparatus based on vector graphics drawing solves the problem is similar to that of the image processing method based on vector graphics drawing, the implementation of the image processing apparatus based on vector graphics drawing can refer to the implementation of the image processing method based on vector graphics drawing, and repeated details will not be elaborated further. As used below, the terms "unit" or "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0105] like Figure 7 As shown, the image processing device based on vector graphics drawing includes:
[0106] The candidate conversion region determination module 701 is configured to acquire the design drawing to be processed and determine the candidate conversion regions of the design drawing to be processed;
[0107] The optical character recognition module 702 is configured to perform optical character recognition on the candidate region to be converted to obtain a character dataset.
[0108] The target region to be converted determination module 703 is configured to remove the invalid characters from the candidate regions to be converted in response to determining that the character dataset includes invalid characters, thereby obtaining the target region to be converted.
[0109] The vector graphics determination module 704 is configured to perform vectorization processing on the target area to be converted to obtain vector graphics.
[0110] In some optional embodiments of this example, the apparatus further includes:
[0111] The initial region to be converted module is configured to determine the candidate initial regions to be converted of the design drawing to be processed based on a pre-trained region recognition model.
[0112] The candidate region to be converted determination module is further configured to:
[0113] The initial region to be converted is filtered, and in response to determining that the initial region to be converted includes an invalid region, the invalid region is removed from the initial region to be converted to obtain the candidate region to be converted.
[0114] In some optional embodiments of this example, the step of training the region recognition model includes:
[0115] Obtain sample design drawings from different fields and styles, and annotate the areas in the sample design drawings that need to be converted to obtain sample annotation information;
[0116] The neural network model is trained by using the sample design diagram as the sample input and the sample annotation information as the sample output.
[0117] In response to determining that the accuracy of the neural network model meets a preset accuracy threshold and / or the recall meets a preset recall threshold, a trained region recognition model is obtained.
[0118] In some optional embodiments of this example, the step of determining the invalid character includes:
[0119] The character dataset is parsed to obtain multiple character data.
[0120] Each character data is identified by both identifier elements and icon elements. If the character data is neither an identifier element nor an icon element, it is determined to be an invalid character. The identifier elements include brand symbols, company symbols, and organization symbols, and the icon elements include operation symbols, function symbols, and mini-program symbols.
[0121] In some optional embodiments of this example, the target region to be converted determination module is further configured as follows:
[0122] Determine the bounding box information of the invalid character;
[0123] Based on the bounding box information, determine the region coordinates of the invalid character in the candidate conversion area;
[0124] Based on the region coordinates, the invalid characters are removed from the candidate regions to be converted to obtain the target region to be converted.
[0125] In some alternative embodiments, the type of the design drawing to be processed includes a bitmap, and the vectorization process includes at least one of the following: edge detection processing, contour extraction processing, and curve fitting processing;
[0126] The device further includes:
[0127] The image preprocessing module is configured to perform preprocessing operations on the design drawing to be processed; wherein the preprocessing operations include at least one of the following: grayscale processing, binarization processing, and noise reduction processing.
[0128] Furthermore, this application encapsulates the above methods into different modules and integrates them into a B / S system to provide users with vector image conversion functionality. (See reference...) Figure 8 The B / S system architecture mainly consists of the following parts:
[0129] 1. Front-end Page: The part that directly interacts with the user. Users can access this webpage resource through a browser. Users can upload design drafts through the browser, and the page will send the design drafts to the back-end server for processing. The processing results can be displayed, and users can also download the processed vector graphics through the page.
[0130] 2. Backend Server: Responsible for receiving design drafts or other requests from the frontend, calling other modules within it to implement specific image processing and conversion functions, packaging the processed vector images for the frontend to download, and communicating with the frontend using the HTTP protocol. This backend server should be understood as... Figure 1 Server 105 in the middle.
[0131] 3. The image processing apparatus of the foregoing embodiments specifically includes: an image preprocessing module, an initial region to be converted determination module, a candidate region to be converted determination module, an optical character recognition module, a target region to be converted determination module, and a vector graphics determination module. The image preprocessing module is responsible for preprocessing the original design image uploaded by the user, and may include steps such as grayscale conversion, binarization, and noise reduction to reduce interference in subsequent image processing, reduce computational load, and improve the recognition accuracy of the region recognition model and the accuracy of the optical character recognition module. The descriptions of the initial region to be converted determination module, the candidate region to be converted determination module, the optical character recognition module, the target region to be converted determination module, and the vector graphics determination module can be found in the foregoing embodiments, and will not be detailed here.
[0132] It should be noted that the system architecture is not limited to B / S architecture; it can also be C / S architecture or local client, etc., but the same functionality should be provided.
[0133] This application encapsulates an image processing method based on vector image rendering into a B / S system. Users do not need to download any software; they can simply upload images to a webpage to obtain the conversion results of all target areas in the image. The operation is simple and easy to use.
[0134] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0135] An electronic device 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, the instructions being executed by the at least one processor to enable the at least one processor to perform the steps of the image processing method based on vector graphics drawing of the foregoing embodiments.
[0136] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the steps of the image processing method based on vector graphics drawing of the foregoing embodiments.
[0137] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the image processing method based on vector graphics drawing as described in the foregoing embodiments.
[0138] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure 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 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, 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 present disclosure described and / or claimed herein.
[0139] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.
[0140] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0141] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 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 computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as an image processing method based on vector graphics drawing.
[0142] For example, in some embodiments, an image processing method based on vector graphics drawing can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by computing unit 901, one or more steps of the image processing method based on vector graphics drawing described above can be performed. Alternatively, in other embodiments, computing unit 901 can be configured to perform an image processing method based on vector graphics drawing by any other suitable means (e.g., by means of firmware).
[0143] 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), systems-on-a-chip (SoCs), payload-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 transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0144] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0145] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. 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 fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0146] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. 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).
[0147] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments 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., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0148] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0149] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.
[0150] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. 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 disclosure should be included within the scope of protection of this disclosure.
Claims
1. An image processing method based on vector graphics rendering, characterized by, include: Obtain the design drawing to be processed and determine the candidate regions to be converted in the design drawing to be processed; Optical character recognition is performed on the candidate regions to be converted to obtain a character dataset; In response to determining that the character dataset includes invalid characters, the invalid characters are removed from the candidate regions to be converted to obtain the target regions to be converted; The target region to be converted is vectorized to obtain vector graphics. The step of determining the invalid character includes: The character dataset is parsed to obtain multiple character data. Each character data is identified by both identifier elements and icon elements. If the character data is neither an identifier element nor an icon element, it is determined to be an invalid character. The identifier elements include brand symbols, company symbols, and organization symbols, and the icon elements include operation symbols, function symbols, and mini-program symbols.
2. The method of claim 1, wherein, The process of determining the candidate regions to be converted in the design drawing to be processed includes: Based on a pre-trained region recognition model, the initial regions to be converted in the design drawing to be processed are determined. The initial region to be converted is filtered, and in response to determining that the initial region to be converted includes an invalid region, the invalid region is removed from the initial region to be converted to obtain the candidate region to be converted.
3. The method of claim 2, wherein, The steps for training the region recognition model include: Obtain sample design drawings from different fields and styles, and annotate the areas in the sample design drawings that need to be converted to obtain sample annotation information; The neural network model is trained by using the sample design diagram as the sample input and the sample annotation information as the sample output. In response to determining that the accuracy of the neural network model meets a preset accuracy threshold and / or the recall meets a preset recall threshold, a trained region recognition model is obtained.
4. The method according to claim 1, characterized in that, The step of removing invalid characters from the candidate region to be converted to obtain the target region to be converted includes: Determine the bounding box information of the invalid character; Based on the bounding box information, determine the region coordinates of the invalid character in the candidate conversion area; Based on the region coordinates, the invalid characters are removed from the candidate regions to be converted to obtain the target region to be converted.
5. The method according to claim 1, characterized in that, The type of the design drawing to be processed includes bitmap, and the vectorization process includes at least one of the following: edge detection processing, contour extraction processing, and curve fitting processing; The method further includes: performing preprocessing operations on the design drawing to be processed; wherein the preprocessing operations include at least one of the following: grayscale processing, binarization processing, and noise reduction processing.
6. An image processing device based on vector graphics drawing, characterized in that, include: The candidate conversion region determination module is configured to acquire the design drawing to be processed and determine the candidate conversion regions of the design drawing to be processed; An optical character recognition module is configured to perform optical character recognition on the candidate regions to be converted to obtain a character dataset; The target region to be converted module is configured to remove the invalid characters from the candidate regions to be converted in response to determining that the character dataset includes invalid characters, thereby obtaining the target region to be converted. The vector graphics determination module is configured to vectorize the target area to be converted to obtain vector graphics. The step of determining the invalid character includes: The character dataset is parsed to obtain multiple character data. Each character data is identified by both identifier elements and icon elements. If the character data is neither an identifier element nor an icon element, it is determined to be an invalid character. The identifier elements include brand symbols, company symbols, and organization symbols, and the icon elements include operation symbols, function symbols, and mini-program symbols.
7. 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, it implements the steps of the image processing method based on vector graphics drawing as described in any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of an image processing method based on vector graphics drawing as described in any one of claims 1 to 5.
9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the image processing method based on vector graphics drawing as described in any one of claims 1 to 5.