Graphic Processing Method, Apparatus and Device
By acquiring and adjusting the graphic data in the graphics processing system, the problem of the color of charts and tables being close to the background in different display areas is solved, and the graphic data is clearly displayed in the target display area, improving the user experience.
Patent Information
- Application Number
- CN202210416844.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-20
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-04-20
AI Technical Summary
The charts and tables extracted by the existing image processing system cannot meet the needs in different display areas. The color close to the background makes the data difficult to clearly identify, reducing the user experience.
By obtaining the graphic type in the image to be processed, obtaining the corresponding graphic processing model, extracting the initial graphic data, and adjusting it based on the display information of the target display area, including color and size adjustments, to ensure that the graphic data is displayed clearly and completely in the target display area.
The extracted graphic data is clearly displayed in the target display area, improving the user experience and visual experience.
Smart Images

Figure HDA0003606396910000011 
Figure HDA0003606396910000021 
Figure HDA0003606396910000022
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular, to a graphic processing method, apparatus, and device. Background Art
[0002] As an intuitive and vivid form of data representation, charts and tables are widely used in various data statistics. In online materials, chart and table data are usually provided for download in the form of pictures, such as PDF files and scanned files. To facilitate the analysis and processing of these chart and table pictures, it is necessary to extract the charts and tables in the pictures. However, the charts and tables extracted by the current picture processing system cannot meet the requirements of different display areas. For example, the color of the extracted chart is close to the background color of the display area in the current application scenario, resulting in the chart data being not easily distinguishable clearly, which reduces the user experience. Summary of the Invention
[0003] In view of this, the present disclosure provides a graphic processing method, apparatus, and device, which can make the extracted graphic data be clearly and completely displayed in the target display area, facilitating user use and perception.
[0004] According to a first aspect of the present disclosure, there is provided a graphic processing method, including:
[0005] Obtain a picture to be processed and the graphic type of the graphics in the picture to be processed;
[0006] According to the graphic type, obtain a corresponding graphic processing model, and based on the graphic processing model, extract the initial graphic data included in the picture to be processed;
[0007] Adjust the initial graphic data based on the display information in the target display area to obtain graphic data adapted to the target display area.
[0008] In a possible implementation manner, the graphic type includes at least one of a chart and a table.
[0009] In a possible implementation manner, when adjusting the initial graphic data based on the display information, it includes the step of adjusting the color of the initial graphic data based on the background color of the target display area.
[0010] In a possible implementation manner, when adjusting the color of the initial graphic data based on the background color, it includes:
[0011] Obtain the color of the initial graphic data;
[0012] Calculate the color difference between the color of the initial graphic data and the background color, and determine whether the color difference is less than a preset color difference threshold:
[0013] When the color difference is less than the preset color difference threshold, adjust the color of the initial graphic data according to the background color.
[0014] In a possible implementation manner, when adjusting the initial graphic data based on the display information, it includes the step of adjusting the size of the initial graphic data based on the display size of the target display area.
[0015] In a possible implementation manner, when adjusting the size of the initial graphic data based on the size of the target display area, it includes:
[0016] Obtain the size of the initial graphic data;
[0017] Calculate the ratio of the size of the target display area to the size of the initial graphic data, and adjust the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data.
[0018] In a possible implementation manner, when adjusting the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data, it includes:
[0019] Judge the size relationship between the ratio and the first size threshold:
[0020] When the ratio is less than the first size threshold, calculate the reduction ratio based on the size of the target display area and the size of the initial graphic data, and perform size reduction processing on the initial graphic data based on the reduction ratio.
[0021] In a possible implementation manner, when the ratio is greater than the first size threshold, it further includes:
[0022] Judge the size relationship between the ratio and the second size threshold;
[0023] When the ratio is greater than the second size threshold, calculate the enlargement ratio based on the size of the target display area and the size of the initial graphic data, and perform size enlargement processing on the initial graphic data based on the enlargement ratio.
[0024] According to a second aspect of the present disclosure, there is provided a graphic processing device, including:
[0025] A picture information acquisition module, configured to acquire a picture to be processed and the graphic type of the graphics in the picture to be processed;
[0026] A graphic extraction module, configured to obtain a corresponding graphic processing model according to the graphic type, and extract initial graphic data included in the to-be-processed picture based on the graphic processing model;
[0027] A graphic adjustment module, configured to adjust the initial graphic data based on the display information in the target display area to obtain graphic data adapted to the target display area.
[0028] According to a third aspect of the present disclosure, there is provided a graphic processing device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to execute the method described in the first aspect of the present disclosure.
[0029] In the present disclosure, after extracting the initial graphic data included in the to-be-processed picture, the initial graphic data is adjusted based on the display information in the target display area to obtain graphic data adapted to the target display area. In this way, the extracted graphic data can be clearly and completely displayed in the target display area, facilitating user use and perception.
[0030] According to the following detailed description of the exemplary embodiments with reference to the accompanying drawings, other features and aspects of the present disclosure will become clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are included in and constitute a part of this specification, illustrate exemplary embodiments, features, and aspects of the present disclosure together with the specification, and are used to explain the principles of the present disclosure.
[0032] Figure 1 A schematic flowchart showing a graphic processing method according to an embodiment of the present disclosure;
[0033] Figure 2 A schematic block diagram showing a graphic processing apparatus according to an embodiment of the present disclosure;
[0034] Figure 3 A schematic block diagram showing a graphic processing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] The following will detail various exemplary embodiments, features, and aspects of the present disclosure with reference to the accompanying drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0036] The special term "exemplary" here means "serving as an example, embodiment, or illustration". Any embodiment described as "exemplary" here is not necessarily to be construed as superior to or better than other embodiments.
[0037] In addition, for a better illustration of the present disclosure, numerous specific details are given in the following detailed implementation manners. Those skilled in the art should understand that the present disclosure can also be implemented without certain specific details. In some instances, methods, means, elements, and circuits well-known to those skilled in the art are not described in detail so as to highlight the gist of the present disclosure.
[0038] <Method Embodiment>
[0039] Figure 1 A schematic flowchart showing a graphic processing method according to an embodiment of the present disclosure. As Figure 1 shown, the graphic processing method includes steps S1100 - S1300.
[0040] S1100, obtain a picture to be processed and the graphic type of the graphics in the picture to be processed.
[0041] The picture to be processed is a picture including graphics. The graphic type of the graphics may include at least one of charts and tables. Among them, the graphic of the chart type may include at least one of pie charts, bar charts, and line charts.
[0042] It should be noted that the pictures to be processed are mostly pictures downloaded by users from network resources according to actual needs. Therefore, before performing graphic processing, the user can clarify the graphic type of the graphics in the picture to be processed. After clarifying the graphic type of the graphics in the picture to be processed, the user can import the picture to be processed by touching the control corresponding to the graphic type. For example, when the graphic type of the graphics in the picture to be processed is a table, the picture to be processed including the table can be imported by touching the table control. Another example is that when the graphic type of the graphics in the picture to be processed is a chart, the picture to be processed including the chart can be imported by touching the chart control.
[0043] When the control corresponding to the graphic type is touched, a data import interface corresponding to the graphic type will be pushed and displayed so that the user can import the picture to be processed through this data import interface. When the data import confirmation control is touched, the picture to be processed imported by the user is obtained, and at the same time, the name of the touched control is recorded to identify the graphic type of the graphics in the picture to be processed through the name of the touched control.
[0044] For example, when the picture to be processed includes a table, when the table control is touched, a data import interface corresponding to the table is pushed and displayed so that the user can import the picture to be processed through this data import interface. When the data import confirmation control is touched, the picture to be processed imported by the user is obtained, and at the same time, the name of the table control is obtained to identify the graphic type of the graphics in the picture to be processed as a table through the name of the table control.
[0045] For another example, if the picture to be processed includes a chart, when the chart control is touched, a data import interface corresponding to the chart is pushed and displayed so that the user can import the picture to be processed through this data import interface. When the data import confirmation control is touched, the picture to be processed imported by the user is obtained, and at the same time, the name of the chart control is obtained to identify that the graphic type of the graphics in the picture to be processed is a chart by the name of the chart control.
[0046] S1200. According to the graphic type, obtain the corresponding graphic processing model, and based on the graphic processing model, extract the initial graphic data included in the picture to be processed.
[0047] The graphic type and the corresponding graphic processing model are stored in the form of a mapping relationship table. In this way, when the graphic type is obtained, the graphic processing model corresponding to the graphic type can be obtained through the mapping relationship table.
[0048] In the embodiment where the graphic type of the graphics in the picture to be processed is a table, first obtain the graphic processing model corresponding to the table type, and then based on the graphic processing model corresponding to the table type, extract the initial table data included in the picture to be processed. Among them, the initial table data is the table data that is consistent with the table style in the picture to be processed.
[0049] In a possible implementation manner, the graphic processing model corresponding to the table type can be constructed based on the unet network, or can be constructed based on the Faster R-CNN network, or can also be constructed based on the opencv module, and no specific limitation is made here.
[0050] In this implementable manner, the steps of extracting the initial table data included in the picture to be processed based on the graphic processing model corresponding to the table type include: inputting the picture to be processed into the graphic processing model corresponding to the table type to obtain the table skeleton of the initial table data included in the picture to be processed; obtaining the region of interest of the cells from the table skeleton; identifying the text content in all the regions of interest of the cells through an optical character recognition model (i.e., an OCR recognition model); typesetting and restoring the text content to the table through the table skeleton to obtain the first table data; identifying the pixel values of the regions of interest of each cell in the picture to be processed, determining the background color of each cell according to the pixel values of the regions of interest of each cell, and setting the background color of the first table data based on the background color of each cell to obtain the initial table data.
[0051] In the example where the graphic type of the graphics in the picture to be processed is a chart, first obtain the graphic processing model corresponding to the chart type, and then based on the graphic processing model corresponding to the chart type, extract the initial chart data included in the picture to be processed. Among them, the initial chart data is the chart data that is consistent with the chart style in the picture to be processed.
[0052] In a possible implementation, the graphic processing model corresponding to the chart type is constructed based on an optical character recognition model (i.e., an OCR recognition model). For example, it can be the GetData model with optical character recognition function.
[0053] In this implementable manner, the steps of extracting the initial chart data included in the picture to be processed based on the graphic processing model corresponding to the chart type include: inputting the picture to be processed into the graphic processing model (GetData model) corresponding to the chart type, and obtaining the data source of the chart through the GetData model. Further, determine the color coordinates in the chart to be processed according to the preset color classification, and determine the position of the color in the picture to be processed according to the color coordinates; determine the type of the chart (for example, a bar chart or a line chart) according to the position of the color. For example, if the same color has a long continuity in the vertical direction and a short continuity in the horizontal direction, that is, the same color constitutes a rectangular pixel matrix distributed longitudinally, then determine that the chart type is a bar chart. Another example is that if the same color has a short continuity in the vertical direction and a long continuity in the horizontal direction, that is, the same color constitutes a linear pixel matrix distributed horizontally, then determine that the type of the chart is a line chart. Obtain the corresponding chart generation function according to the type of the chart, and generate the initial table data based on the chart generation function and the data source of the chart.
[0054] S1300, adjust the initial graphic data based on the display information in the target display area to obtain graphic data adapted to the target display area.
[0055] The target display area is the display area of the extracted graphic data in the target file. The target file can be a Word file, an Excel file, or other files that can display graphic data, and no specific limitation is made here.
[0056] In a possible implementation, the target display area is selected in the form of a selection box. For example, when the control for selecting the target display area is touched, a selection tool will be pushed and displayed. In this way, the user can form a selection box in the opened target file by dragging the selection tool to select the target display area through the selection box.
[0057] In a possible implementation, the display information of the target display area may include at least one of the background color and the display size. When the selection of the target display area is completed, obtain the size of the current selection box as the display size of the target display area; at the same time, obtain a screenshot of the target display area to use the background color recognized in the screenshot as the background color of the target display area.
[0058] In a possible implementation, when identifying the background color in a screenshot, it includes: determining the color coordinates of each pixel point in the screenshot through the HSV color coordinate system, performing statistics on the color coordinates of all pixel points in the screenshot, and the color corresponding to the pixel points with the most identical color coordinates is the background color.
[0059] In a possible implementation, when adjusting the initial graphic data based on the display information, it includes the step of adjusting the color of the initial graphic data based on the background color of the target display area.
[0060] In this feasible implementation, when adjusting the color of the initial graphic data based on the background color, it includes steps S1310 - S1330.
[0061] S1310, obtain the color of the initial graphic data.
[0062] In a possible implementation, the color coordinates of each pixel point in the initial image data can be determined through the HSV color coordinate system, and based on the color coordinates of each pixel point, the colors in the initial graphic data and the color coordinate ranges of the colors are sorted out.
[0063] In this feasible implementation, the HSV color coordinate system is determined by a red coordinate system, an orange coordinate system, a yellow coordinate system, a green coordinate system, a cyan coordinate system, and a purple coordinate system. Among them, the color coordinate ranges of each coordinate system are as follows:
[0064] Red coordinate system: ([156, 43, 227], [180, 110, 255]), ([156, 111, 46], [180, 255, 234]), ([0, 43, 200], [10, 80, 255]), ([0, 81, 46], [10, 255, 199])
[0065] Orange coordinate system: ([11, 43, 46], [25, 255, 255])
[0066] Yellow coordinate system: ([26, 43, 46], [34, 255, 255])
[0067] Green coordinate system: ([35, 43, 46], [77, 255, 255])
[0068] Cyan coordinate system: ([78, 43, 46], [99, 255, 255])
[0069] Blue coordinate system: ([100, 43, 46], [124, 255, 80]), ([100, 43, 81], [124, 255, 150]), ([100, 43, 151], [124, 255, 255])
[0070] Purple coordinate system: ([125, 43, 46], [155, 255, 255]).
[0071] The color of the initial graphic data can be one kind. For example, table data with a unified background color. It can also be multiple kinds. For example, bar chart data including 3 different colors. Another example is table data including 2 background colors. Here, no specific limitation is made on the number of colors in the initial graphic data.
[0072] In the embodiment where the color of the initial graphic data is multiple kinds, the multiple colors are non - adjacent colors and can be spaced warm and cool color systems. For example, in the pie chart data including 5 different colors, the 5 colors are red, blue, pink, green, and yellow respectively. In this way, the color blocks composed of different colors can be clearly identified.
[0073] S1320, calculate the color difference between the color of the initial graphic data and the background color, and determine whether the color difference is less than the preset color difference threshold.
[0074] In the embodiment where the initial graphic data is one kind, directly calculate the color difference between the initial graphic color and the background color, so that the display effect of the initial graphic data in the target display area can be judged through the color difference. For example, when the color difference is less than the preset color difference threshold, the color of the initial graphic data is close to the background color of the target display area and is not easy to be clearly identified. At this time, it is necessary to adjust the color of the initial graphic data according to the background color of the target display area. When the color difference is greater than the preset color difference threshold, the color of the initial graphic data has a large difference from the background color of the target display area and can be clearly identified. Therefore, there is no need to adjust the color of the initial graphic data, that is, the initial graphic data can be directly used as the graphic data adapted to the target display background color. Among them, the preset color difference threshold can be set according to the specific application scenario and no specific limitation is made here.
[0075] In the embodiment where the color of the initial graphic data is multiple kinds, it is necessary to calculate the color difference between each color and the background color of the target display area respectively, so as to make a targeted adjustment to the color whose color difference is less than the preset color difference threshold.
[0076] S1330, when the color difference is less than the preset color difference threshold, adjust the color of the initial graphic data according to the background color.
[0077] When adjusting the color of the initial graphic data according to the background color, for the color in the initial graphic data whose color difference from the background color of the target display area is less than the preset color difference threshold, it can be replaced with a color whose color differences from both the background color and other colors in the initial graphic data are greater than the preset color difference threshold, thus completing the adjustment of the color of the initial graphic data.
[0078] Through the color adjustment method of this embodiment, the obtained graphic data can be clearly displayed in the target display area, improving the user's viewing experience.
[0079] In a possible implementation manner, when adjusting the initial graphic data based on the display information, it includes the step of adjusting the size of the initial graphic data based on the display size of the target display area.
[0080] In this implementable manner, it is possible to select to automatically adjust the size of the initial graphic data, or to manually adjust the size of the initial image data, which is not specifically limited here.
[0081] In the embodiment where the size of the initial graphic data is selected to be automatically adjusted, when adjusting the size of the initial graphic data based on the size of the target display area, it includes steps S1340 - S1350.
[0082] S1340, obtain the size of the initial graphic data.
[0083] S1350, calculate the ratio of the size of the target display area to the size of the initial graphic data, and adjust the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data.
[0084] In a possible implementation manner, the size of the target display area can be characterized by the area of the display area. Similarly, the size of the initial graphic data can also be characterized by the initial graphic area. At this time, the ratio of the size of the target display area to the size of the initial graphic data is the area ratio. For example, when the size of the target display area is A * B (A is the length, B is the width), and the size of the initial graphic data is C * D (C is the length, D is the width), then the ratio F of the size of the target display area to the size of the initial graphic data = A * B / C * D.
[0085] In a possible implementation manner, when adjusting the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data, it includes steps S1351 - S1352.
[0086] S1351, determine the size relationship between the ratio and the first size threshold. If the ratio is smaller than the first size threshold, then the size of the initial graphic data is larger than the size of the target display area, resulting in the initial graphic data being unable to be completely displayed in the target display area. In this case, it is necessary to reduce the size of the initial graphic data. Among them, the first size threshold can be 1, or it can be set according to the specific application scenario, which is not specifically limited here.
[0087] S1352. When the ratio is less than the first size threshold, calculate a reduction ratio based on the size of the target display area and the size of the initial graphic data, and perform a size reduction process on the initial graphic data based on the reduction ratio.
[0088] For example, if the area of the target display area is 1 and the area of the initial graphic data is 2, then the ratio of the size of the target display area to the size of the initial graphic data is 1 / 2. At this time, reduce the area of the initial graphic data to 2 * 1 / 2 to complete the size reduction process of the initial graphic data.
[0089] In a possible implementation, when the ratio is greater than the first size threshold, steps S1353 - S1354 are further included.
[0090] S1353. Determine the magnitude relationship between the ratio and the second size threshold. If the ratio is greater than the second size threshold, the size of the initial graphic data is relatively small compared to the size of the target display area, resulting in the initial graphic data being unable to be clearly identified in the target display area. In this case, it is necessary to perform an enlargement process on the initial graphic data. Among them, the second size threshold can be set according to the specific application scenario. The second size threshold can be the same as the first size threshold or different from the first size threshold, and no specific limitation is made here.
[0091] S1354. When the ratio is greater than the second size threshold, calculate an enlargement ratio based on the size of the target display area and the size of the initial graphic data, and perform a size enlargement process on the initial graphic data based on the enlargement ratio.
[0092] For example, if the area of the target display area is 2 and the area of the initial graphic data is 1, then the ratio of the size of the target display area to the size of the initial graphic data is 2. At this time, expand the area of the initial graphic data to 1 * 2 to complete the size enlargement process of the initial graphic data.
[0093] In a possible implementation, when the ratio of the size of the target display area to the size of the initial graphic data is greater than or equal to the first size threshold and less than or equal to the second size threshold, the size of the initial graphic data is adapted to the size of the target display area. In this case, there is no need to adjust the size of the initial graphic data, that is, the initial graphic data can be directly used as the graphic data adapted to the size of the target display area.
[0094] In the embodiment where the size of the initial image data is manually adjusted, the user can manually adjust the size of the initial graphic data by dragging the initial graphic data in the target display area so that the size of the initial graphic data is adapted to the size of the target display area.
[0095] In a possible implementation, when the initial graphic data is obtained, the size of the initial graphic data can be adjusted based on the size of the target display area to obtain graphic data adapted to the size of the target display area, and then the color of the graphic data adapted to the size of the target display area can be adjusted based on the background color of the target display area; alternatively, the color of the initial graphic data can be adjusted based on the background color of the target display area to obtain graphic data adapted to the background color of the target display area, and then the graphic data adapted to the background color of the target display area can be adjusted based on the size of the target display area. Among them, the steps of performing size adjustment and color adjustment refer to the above steps and will not be elaborated here. The graphic data obtained by the method of this embodiment can be adapted to both the size and the color of the target display area, so that the obtained graphic data can be clearly and completely displayed in the target display area, improving the user's viewing experience.
[0096] In the present disclosure, after extracting the initial graphic data included in the image to be processed, the initial graphic data is adjusted based on the display information in the target display area to obtain graphic data adapted to the target display area, so that the extracted graphic data can be clearly and completely displayed in the target display area, facilitating user use and viewing.
[0097] <Apparatus Embodiment>
[0098] Figure 2 FIG. shows a schematic block diagram of a graphic processing apparatus according to an embodiment of the present disclosure. As Figure 2 shown, the graphic processing apparatus 100 includes:
[0099] An image information acquisition module 110, configured to acquire an image to be processed and the graphic type of the graphics in the image to be processed;
[0100] A graphic extraction module 120, configured to obtain a corresponding graphic processing model according to the graphic type, and extract the initial graphic data included in the image to be processed based on the graphic processing model;
[0101] A graphic adjustment module 130, configured to adjust the initial graphic data based on the display information in the target display area to obtain graphic data adapted to the target display area.
[0102] In a possible implementation, the graphic type includes at least one of a chart and a table.
[0103] In a possible implementation, when the graphic adjustment module 130 adjusts the initial graphic data based on the display information, it includes the step of adjusting the color of the initial graphic data based on the background color of the target display area.
[0104] In a possible implementation, when the graphic adjustment module 130 adjusts the color of the initial graphic data based on the background color, it is specifically configured to:
[0105] Obtain the color of the initial graphic data;
[0106] Calculate the color difference between the color of the initial graphic data and the background color, and determine whether the color difference is less than a preset color difference threshold:
[0107] When the color difference is less than the preset color difference threshold, adjust the color of the initial graphic data according to the background color.
[0108] In a possible implementation, when the graphic adjustment module 130 adjusts the initial graphic data based on the display information, it includes the step of adjusting the size of the initial graphic data based on the display size of the target display area.
[0109] In a possible implementation, when the graphic adjustment module 130 adjusts the size of the initial graphic data based on the size of the target display area, it is specifically configured to:
[0110] Obtain the size of the initial graphic data;
[0111] Calculate the ratio of the size of the target display area to the size of the initial graphic data, and adjust the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data.
[0112] In a possible implementation, when the graphic adjustment module 130 adjusts the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data, it is specifically configured to:
[0113] Determine the magnitude relationship between the ratio and the first size threshold:
[0114] When the ratio is less than the first size threshold, calculate the reduction ratio based on the size of the target display area and the size of the initial graphic data, and perform size reduction processing on the initial graphic data based on the reduction ratio.
[0115] In a possible implementation, when the ratio is greater than the first size threshold, the graphic adjustment module 130 is further configured to:
[0116] Determine the magnitude relationship between the ratio and the second size threshold;
[0117] When the ratio is greater than the second size threshold, calculate the enlargement ratio based on the size of the target display area and the size of the initial graphic data, and perform size enlargement processing on the initial graphic data based on the enlargement ratio.
[0118] <Device Embodiment>
[0119] Figure 3 A schematic block diagram of a graphics processing device according to an embodiment of the present disclosure is shown. As Figure 3 shown, the graphics processing device 200 includes a processor 210 and a memory 220 for storing executable instructions of the processor 210. Among them, the processor 210 is configured to implement the graphics processing method described in any one of the foregoing when executing the executable instructions.
[0120] Here, it should be noted that the number of processors 210 can be one or more. At the same time, in the graphics processing device 200 of the embodiment of the present disclosure, an input device 230 and an output device 240 may also be included. Among them, the processor 210, the memory 220, the input device 230, and the output device 240 may be connected through a bus or in other ways, which is not specifically limited here.
[0121] The memory 220, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and various modules, such as: the programs or modules corresponding to the graphics processing method of the embodiment of the present disclosure. The processor 210 executes various functional applications and data processing of the graphics processing device 200 by running the software programs or modules stored in the memory 220.
[0122] The input device 230 can be used to receive input numbers or signals. Among them, the signal can be a key signal related to the user settings and function control of the device / terminal / server. The output device 240 may include a display device such as a display screen.
[0123] The foregoing embodiments of the present disclosure have been described. The above description is exemplary and not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations are obvious to those of ordinary skill in the art in the technical field without departing from the scope and spirit of the described embodiments. The selection of the terms used herein is intended to best explain the principles of the embodiments, the practical application, or the technical improvement of the technology in the market, or to enable other ordinary technical personnel in the technical field to understand the embodiments disclosed herein.
Claims
1. A graphics processing method, characterized in that, Including: Obtain the image to be processed and the graphic type of the graphics in the image to be processed; According to the graphic type, obtain the corresponding graphic processing model, and based on the graphic processing model, extract the initial graphic data included in the image to be processed; Adjust the initial graphic data based on the display information in the target display area to obtain graphic data adapted to the target display area; Wherein, the graphic type includes at least one of charts and tables; When the graphic type of the graphics in the image to be processed is a table, first obtain the graphic processing model corresponding to the table type, and then based on the graphic processing model corresponding to the table type, extract the initial table data included in the image to be processed, where the initial table data is table data consistent with the table style in the image to be processed; The steps of extracting the initial table data included in the image to be processed based on the graphic processing model corresponding to the table type include: inputting the image to be processed into the graphic processing model corresponding to the table type to obtain the table skeleton of the initial table data included in the image to be processed; obtain the region of interest of the cells from the table skeleton; recognize the text content in all cell regions of interest through an optical character recognition model; restore the text content to the table through the table skeleton layout to obtain the first table data; recognize the pixel values of the cell regions of interest in the image to be processed, and determine the background color of each cell according to the pixel values of the cell regions of interest, and set the background color of the first table data based on the background color of each cell to obtain the initial table data; When the graphic type of the graphics in the image to be processed is a chart, first obtain the graphic processing model corresponding to the chart type, and then based on the graphic processing model corresponding to the chart type, extract the initial chart data included in the image to be processed, where the initial chart data is chart data consistent with the chart style in the image to be processed; The steps of extracting the initial chart data included in the image to be processed based on the graphic processing model corresponding to the chart type include: inputting the image to be processed into the GetData model, which is the graphic processing model corresponding to the chart type, and obtaining the data source of the chart through the GetData model. Further, determine the color coordinates in the chart to be processed according to the preset color classification, and determine the position where the color is located in the image to be processed according to the color coordinates; determine the type of the chart according to the position where the color is located. Specifically, if the same color constitutes a rectangular pixel matrix distributed longitudinally, determine that the chart type is a bar chart; if the same color constitutes a linear pixel matrix distributed horizontally, determine that the type of the chart is a line chart; obtain the corresponding chart generation function according to the type of the chart, and generate the initial table data based on the chart generation function and the data source of the chart.
2. The method according to claim 1, wherein When adjusting the initial graphic data based on the display information, it includes the step of adjusting the color of the initial graphic data based on the background color of the target display area.
3. The method according to claim 2, characterized in that, When adjusting the color of the initial graphic data based on the background color, it includes: Obtain the color of the initial graphic data; Calculate the color difference between the color of the initial graphic data and the background color, and determine whether the color difference is less than a preset color difference threshold: When the color difference is less than the preset color difference threshold, adjust the color of the initial graphic data according to the background color.
4. The method according to claim 1, wherein When adjusting the initial graphic data based on the display information, it includes the step of adjusting the size of the initial graphic data based on the display size of the target display area.
5. The method according to claim 4, wherein When adjusting the size of the initial graphic data based on the size of the target display area, it includes: Obtain the size of the initial graphic data; Calculate the ratio of the size of the target display area to the size of the initial graphic data, and adjust the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data.
6. The method according to claim 5, characterized in that When adjusting the size of the initial graphic data based on the ratio of the size of the target display area to the size of the initial graphic data, it includes: Judge the magnitude relationship between the ratio and a first size threshold: When the ratio is less than the first size threshold, calculate a reduction ratio based on the size of the target display area and the size of the initial graphic data, and perform a size reduction process on the initial graphic data based on the reduction ratio.
7. The method according to claim 6, wherein When the ratio is greater than the first size threshold, it further includes: Judge the magnitude relationship between the ratio and a second size threshold; When the ratio is greater than the second size threshold, calculate an enlargement ratio based on the size of the target display area and the size of the initial graphic data, and perform a size enlargement process on the initial graphic data based on the enlargement ratio.
8. A graphics processing device, characterized in that, It includes: A picture information acquisition module, configured to acquire a picture to be processed and the graphic type of the graphic in the picture to be processed; A graphic extraction module, configured to acquire a corresponding graphic processing model according to the graphic type, and extract the initial graphic data included in the picture to be processed based on the graphic processing model; A graphic adjustment module, configured to adjust the initial graphic data based on the display information in the target display area to obtain graphic data adapted to the target display area; Wherein, the graphic type includes at least one of charts and tables; When the graphic type of the graphic in the picture to be processed is a table, first obtain the graphic processing model corresponding to the table type, and then extract the initial table data included in the picture to be processed based on the graphic processing model corresponding to the table type, where the initial table data is table data consistent with the table style in the picture to be processed; The steps of extracting the initial table data included in the image to be processed based on the graphics processing model corresponding to the table type are as follows: input the image to be processed into the graphics processing model corresponding to the table type to obtain the table skeleton of the initial table data included in the image to be processed; obtain the region of interest of the cell from the table skeleton; recognize the text content in all regions of interest of the cells through the optical character recognition model; restore the text content to the table through the layout of the table skeleton to obtain the first table data; recognize the pixel values of the regions of interest of the cells in the image to be processed, determine the background color of each cell based on the pixel values of the regions of interest of the cells, and set the background color of the first table data based on the background color of each cell to obtain the initial table data; When the graphic type of the graphic in the image to be processed is a chart, first obtain the graphics processing model corresponding to the chart type, and then extract the initial chart data included in the image to be processed based on the graphics processing model corresponding to the chart type, where the initial chart data is chart data consistent with the chart style in the image to be processed; The steps of extracting the initial chart data included in the image to be processed based on the graphics processing model corresponding to the chart type are as follows: input the image to be processed into the GetData model, which is the graphics processing model corresponding to the chart type, and obtain the data source of the chart through the GetData model. Further, determine the color coordinates in the chart to be processed according to the preset color classification, and determine the position where the color is located in the image to be processed according to the color coordinates; determine the type of the chart according to the position where the color is located. Specifically, if the same color constitutes a rectangular pixel matrix distributed longitudinally, it is determined that the chart type is a bar chart; if the same color constitutes a linear pixel matrix distributed horizontally, it is determined that the chart type is a line chart; obtain the corresponding chart generation function according to the type of the chart, and generate the initial table data based on the chart generation function and the data source of the chart.
9. A graphics processing device, characterized in that, including: a processor; a memory for storing instructions executable by the processor; wherein, when the processor is configured to execute the executable instructions, the method described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Picture document processing method and device
CN102567300A
Character verification method and apparatus, computer device, and storage medium
WO2021031242A1