A data processing method and apparatus

By converting image data to grayscale and calculating coordinate values, the method automates data extraction from graphs and charts, improving efficiency and accuracy over manual methods.

CN115439537BActive Publication Date: 2025-07-15BANG DAO TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211009116.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-22
Publication Date
2025-07-15
Estimated Expiration
2042-08-22

AI Technical Summary

Technical Problem

In the prior art, the efficiency of extracting data from pictures with line charts through manual identification is low, and it cannot meet the needs of the enterprise's batch data processing.

Method used

By obtaining the grayscale image of the target data image, the position information of the first coordinate axis in the grayscale image is determined, the data value per unit length of the second coordinate axis is calculated based on the included angle and color value, and the coordinate value of the data point in the second coordinate axis is determined, so as to realize automatic data acquisition.

Benefits of technology

The coordinate values of data points can be extracted efficiently without manual intervention, which improves data processing efficiency and avoids the problem of low accuracy that may be caused by manual extraction methods. It is suitable for batch data extraction scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115439537B_ABST
    Figure CN115439537B_ABST
Patent Text Reader

Abstract

The present invention provides a data processing method and apparatus, which can obtain a grayscale image corresponding to a target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis with an included angle of a first included angle, and the color value of each data point is a first color value; determine the position information of the first coordinate axis in the grayscale image; based on the position information of the first coordinate axis and the first included angle, determine the data value per unit length of the second coordinate axis; in the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one data point on the second coordinate axis. The present invention can effectively determine the coordinate values corresponding to at least one data point on the second coordinate axis in the target data graph, can realize data extraction in the target data graph, and effectively improve the data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular, to a data processing method and apparatus. Background Art

[0002] With the development of computer science and technology, data acquisition technology has been continuously improved.

[0003] In the daily business of enterprises, pictures with statistical data such as line charts are often encountered, and the data in these pictures may be closely related to the enterprise business. To ensure the normal operation of the business, enterprises need to extract data from these pictures.

[0004] However, the existing technology extracts data from the above pictures through manual recognition, and the processing efficiency is relatively low. Summary of the Invention

[0005] The present invention provides a data processing method and apparatus to solve the defect of extracting data from pictures through manual recognition in the existing technology, realize automatic acquisition of data in pictures, and effectively improve data processing efficiency.

[0006] In a first aspect, the present invention provides a data processing method, including:

[0007] Obtaining a grayscale image corresponding to a target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is a first included angle, and the color value of each data point is a first color value;

[0008] Determining the position information of the first coordinate axis in the grayscale image;

[0009] Based on the position information of the first coordinate axis in the grayscale image and the first included angle, determining the data value per unit length of the second coordinate axis;

[0010] In the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determining the coordinate value of at least one of the data points on the second coordinate axis.

[0011] In a second aspect, the present invention further provides a data processing apparatus, including: a first obtaining unit, a first determining unit, a second determining unit, and a third determining unit; wherein:

[0012] The first obtaining unit is configured to obtain a grayscale image corresponding to a target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, an included angle between the first coordinate axis and the second coordinate axis is a first included angle, and color values of all the data points are a first color value;

[0013] The first determining unit is configured to determine position information of the first coordinate axis in the grayscale image;

[0014] The second determining unit is configured to determine a data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle;

[0015] The third determining unit is configured to determine coordinate values of at least one of the data points in the second coordinate axis in the target data image based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis.

[0016] In a third aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the steps of any one of the above data processing methods are implemented.

[0017] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above data processing methods are implemented.

[0018] In a fifth aspect, the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of any one of the above data processing methods are implemented.

[0019] The data processing method and device provided by the present invention can obtain a grayscale image corresponding to a target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is a first included angle, and the color value of each data point is a first color value; determine the position information of the first coordinate axis in the grayscale image; based on the position information of the first coordinate axis in the grayscale image and the first included angle, determine the data value per unit length of the second coordinate axis; in the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one data point on the second coordinate axis. The present invention can effectively determine at least one data point in the target data graph and the corresponding coordinate values of the at least one data point on the second coordinate axis, that is, it can effectively extract the data information of the data points in the target data graph without extracting data through manual extraction, which can effectively improve the data extraction efficiency and avoid the problem of relatively low data accuracy that may exist in the manual extraction method. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0021] Figure 1 is one of the flow diagrams of the data processing method provided by the embodiment of the present invention;

[0022] Figure 2 is the second flow diagram of the data processing method provided by the embodiment of the present invention;

[0023] Figure 3 is the third flow diagram of the data processing method provided by the embodiment of the present invention;

[0024] Figure 4 is the structural diagram of the data processing device provided by the embodiment of the present invention;

[0025] Figure 5 is the structural diagram of the electronic device provided by the embodiment of the present invention.

[0026] REFERENCE SIGNS

[0027] 101: First obtaining unit; 102: First determining unit; 103: Second determining unit; 104: Third determining unit;

[0028] 210: Processor; 220: Communication Interface; 230: Memory; 240: Communication Bus. Detailed Implementation Manner

[0029] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the accompanying drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0030] The following will describe Figures 1 - 3 the data processing method proposed in the embodiments of the present invention.

[0031] As Figure 1 shown, the first data processing method proposed in the embodiments of the present invention may include the following steps:

[0032] S101. Obtain a grayscale image corresponding to the target data image; wherein, the target data image is an image of the target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each data point is the first color value;

[0033] Among them, the grayscale image may be an image generated after performing grayscale processing on the target data image. Specifically, in the present invention, after obtaining the target data image, the chromaticity of the target data image can be converted into corresponding black-and-white chromaticity by performing grayscale processing on the target data image to obtain the corresponding grayscale image.

[0034] Among them, the two-dimensional coordinate system may be a rectangular coordinate system or other non-rectangular two-dimensional coordinate systems. The two-dimensional coordinate system may include a first coordinate axis and a second coordinate axis. When the included angle between the first coordinate axis and the second coordinate axis, that is, the first included angle, is 90 degrees, the two-dimensional coordinate system may be a rectangular coordinate system; when the first included angle is non-90 degrees (such as 45 degrees), the two-dimensional coordinate system may be a two-dimensional plane coordinate system of a non-rectangular coordinate system.

[0035] Among them, the target data graph may include a curve graph or a bar graph composed of one or more data points in the two-dimensional coordinate system. For example, the target data graph may include a line graph composed of multiple data points in the two-dimensional coordinate system; for another example, the target data graph may include a bar graph composed of multiple data points in the two-dimensional coordinate system.

[0036] It can be understood that the present invention can establish an image coordinate system belonging to the plane rectangular coordinate system based on two adjacent sides of the target data image, and use the coordinate axis information in the image coordinate system, that is, the horizontal axis coordinate and the vertical axis coordinate, to identify the position of points or lines in the target data image.

[0037] Moreover, the present invention can also use two adjacent sides of the grayscale image as the horizontal axis and the vertical axis respectively to establish the image coordinate system of the grayscale image, and use the coordinate information to identify the position of points or lines in the grayscale image.

[0038] Among them, the image coordinate system of the grayscale image and the image coordinate system of the target data image can be exactly the same. Specifically, for any point, the position of the point in the target data image and the position of the point after grayscale processing in the grayscale image can be the same.

[0039] It should be noted that the image coordinate system of the target data image and the image coordinate system of the grayscale image can be the same coordinate system, but can be different from the two-dimensional coordinate system.

[0040] Specifically, when the two-dimensional coordinate system is the plane rectangular coordinate system, the first coordinate axis of the two-dimensional coordinate system can be the horizontal axis, and the second coordinate axis can be the vertical axis. At this time, the first coordinate axis can be parallel to the horizontal axis in the image coordinate axis, and the second coordinate axis can be parallel to the vertical axis in the image coordinate axis.

[0041] Specifically, when the two-dimensional coordinate system is the plane rectangular coordinate system, the first coordinate axis is the horizontal axis, and the second coordinate axis is the vertical axis, the first coordinate axis can also be non-parallel to the horizontal axis in the image coordinate axis, and there can be a small angle between the two, that is, the first coordinate axis is slightly inclined relative to the horizontal axis in the image coordinate axis.

[0042] Among them, the first color value can be the color value of each data point in the target data graph. The present invention does not limit the specific color type of the first color value. For example, the first color value can be green.

[0043] Optionally, after obtaining a certain data image, such as after obtaining the target data image, the present invention can first preprocess the data image according to the preprocessing method to eliminate the differences in image format and size parameters of different data images, unify the formats and size parameters of different data images, avoid the influence of different image formats and size parameters on the subsequent step processing, and effectively ensure the image processing efficiency.

[0044] Specifically, after obtaining a certain data image, the present invention can read it in the RGB format of OpenCV, and process the data image according to the predefined image size parameters to obtain a processed image, and then perform grayscale processing on the processed image.

[0045] S102. Determine the position information of the first coordinate axis in the grayscale image;

[0046] Specifically, the position information of the first coordinate axis in the grayscale image can be the position information of the first coordinate axis in the image coordinate system of the grayscale image.

[0047] It can be understood that the position information of the first coordinate axis in the image coordinate system of the grayscale image can include the horizontal axis coordinate and the vertical axis coordinate in the image coordinate system.

[0048] Optionally, in the second data processing method proposed in the embodiment of the present invention, step S102 may include steps S201 and S202, where:

[0049] S201. Perform statistical probabilistic Hough line transform function processing on the grayscale image to divide each line of the target data graph into at least one line segment in the grayscale image, and respectively determine the position information of the two endpoints of each line segment in the corresponding direction of the first coordinate axis in the grayscale image; where the position information of the endpoints includes the horizontal axis coordinate and the vertical axis coordinate of the endpoints in the grayscale image;

[0050] S202. Based on the position information of the two endpoints of each line segment in the corresponding direction of the first coordinate axis in the grayscale image, determine the position information of the first coordinate axis in the grayscale image.

[0051] Specifically, the statistical probabilistic Hough line transform function processing can be the cv2.HoughLinesP statistical probabilistic Hough line transform function processing.

[0052] Specifically, by performing statistical probabilistic Hough line transform function processing on the grayscale image, the present invention can divide each line including the first coordinate axis, the second coordinate axis, and the data lines connected by data points in the target data graph into at least one line segment respectively. For example, the first coordinate axis can be divided into multiple small line segments. Among them, there may be overlapping parts or no overlapping parts between the line segments.

[0053] Specifically, the present invention can find out each line segment in the corresponding direction of the first coordinate axis from all the divided line segments. For example, when the first coordinate axis is horizontal and parallel to the horizontal axis in the grayscale image, the present invention can find out the line segments with a horizontal direction from all the divided line segments.

[0054] Specifically, after finding each line segment in the corresponding direction of the first coordinate axis, the present invention can respectively determine the position information of the two endpoints of each line segment in the grayscale image. For example, for the first line segment and the second line segment found in the horizontal direction, the present invention can determine the position information of the two endpoints of the first line segment in the grayscale image and determine the position information of the two endpoints of the second line segment in the grayscale image.

[0055] Among them, the position information of one endpoint may include the horizontal axis coordinate and the vertical axis coordinate of the endpoint in the image coordinate system of the grayscale image.

[0056] Specifically, the present invention can determine the position information of the first coordinate axis in the grayscale image according to the position information of each endpoint in each line segment in the corresponding direction of the determined first coordinate axis.

[0057] In practical applications, when the first coordinate axis is a horizontal axis with a small inclination angle and not in a completely horizontal direction, the present invention can still find each line segment in the corresponding direction of the first coordinate axis by searching in the horizontal direction. After that, the present invention can still respectively determine the position information of the two endpoints of each found line segment in the grayscale image, and determine the position information of the first coordinate axis in the grayscale image according to the determined position information of each endpoint.

[0058] Optionally, after obtaining the grayscale image, the present invention can first perform canny edge detection on the grayscale image, preview the edge detection effect by selecting different threshold parameters, and use the threshold parameter that meets the edge detection standard as the final set parameter to perform edge detection conversion on the grayscale image to obtain the edge-detected image; then, the present invention can determine the position information of the first coordinate axis in the image coordinate system of the edge-detected image in the edge-detected image.

[0059] Optionally, in other data processing methods proposed in the embodiments of the present invention, the above step S202 may include:

[0060] Among the vertical axis coordinates of the two endpoints of each line segment in the corresponding direction of the first coordinate axis, determine the median or mode of all vertical axis coordinates as the target vertical axis coordinate;

[0061] Based on the target vertical axis coordinate, generate a target vertical axis coordinate interval; wherein, the target vertical axis coordinate interval is an interval not less than the first value and not greater than the second value, the first value is the value obtained by subtracting the preset floating value from the target vertical axis coordinate, and the second value is the value obtained by adding the preset floating value to the target vertical axis coordinate;

[0062] Among the line segments in the corresponding direction of the first coordinate axis, the line segments with the vertical axis coordinates of both endpoints located within the target vertical axis coordinate interval are determined as the segments of the first coordinate axis.

[0063] Based on the position information of the two endpoints of each segment, the position information of the first coordinate axis in the grayscale image is determined.

[0064] Among them, when the first coordinate axis is a horizontal coordinate axis with a small inclination angle and not in a completely horizontal direction, there is a small angle between the first coordinate axis and the horizontal axis in the image coordinate system of the grayscale image. At this time, the first coordinate axis can be within a certain vertical axis coordinate interval in the image coordinate system. At this time, the present invention can calculate the median of the vertical axis coordinates of the endpoints of each line segment in the corresponding direction of the first coordinate axis after determining the vertical axis coordinates of the endpoints of each line segment in the corresponding direction of the first coordinate axis, determine the median as the target vertical axis coordinate, generate a corresponding target vertical axis coordinate interval based on the target vertical axis coordinate and a preset floating value, and determine all the line segments belonging to the segments of the first coordinate axis among the line segments in the corresponding direction of the first coordinate axis based on the target vertical axis coordinate interval, and determine the position information of the first coordinate axis in the grayscale image based on the position information of all these line segments.

[0065] Among them, the preset floating value can be a value set by those skilled in the art according to the actual situation, and the present invention does not limit this.

[0066] It should be noted that when dividing the lines in the grayscale image into line segments, the same line will be divided into multiple line segments with overlapping parts. At this time, when the present invention determines the position information of each line segment in the corresponding direction of the first coordinate axis, there are line segments with overlapping parts among these line segments. When the present invention determines the vertical axis coordinates of the line segments with overlapping parts, since the inclination between the line segments with overlapping parts is small, the difference in the vertical axis coordinate values of the endpoints between the line segments with overlapping parts is extremely small. Without extremely high precision, the vertical axis coordinate values of the endpoints between the line segments with overlapping parts can be the same. At this time, the present invention can determine the vertical axis coordinate value that appears the most times among the vertical axis coordinate values of the endpoints of each line segment corresponding to the first coordinate axis, that is, the mode of the vertical axis coordinate values of the endpoints of each line segment, and determine the mode as the target vertical axis coordinate. Then, the present invention can generate a target vertical axis coordinate interval based on the target vertical axis coordinate, and further determine the segments of the first coordinate axis among the line segments in the corresponding direction of the first coordinate axis, and determine the position information of the first coordinate axis in the grayscale image.

[0067] Optionally, when the first coordinate axis is a horizontal abscissa axis in a completely horizontal direction, the first coordinate axis can be parallel to the horizontal axis in the image coordinate system of the grayscale image. At this time, among the line segments in the corresponding direction of the first coordinate axis, the vertical axis coordinates of the endpoints can be the same, and the target vertical axis coordinate is the vertical axis coordinate of each endpoint. At this time, the preset floating value can be 0 or other values, and the target vertical axis coordinate is the vertical axis coordinate where the first coordinate axis is located in the grayscale image. The present invention can determine the target vertical axis coordinate interval based on the target vertical axis coordinate, and further determine the position information where the first coordinate axis is located in the grayscale image.

[0068] S103. Determine the data value per unit length of the second coordinate axis based on the position information where the first coordinate axis is located in the grayscale image and the first included angle;

[0069] It should be noted that the data values of the scales on the second coordinate axis can be evenly distributed, and there can be a linear relationship, such as a direct proportional relationship, between the data value of a scale and the length of the scale from the zero point. For example, on the second coordinate axis, the length of the first scale from the zero point is 1, the data value of the first scale is 10, the length of the second scale from the zero point is 2, the data value of the second scale is 20, the length of the third scale from the zero point is 3, and the data value of the third scale is 30.

[0070] Among them, the data value per unit length can be the data value corresponding to each unit length on the second coordinate axis.

[0071] Specifically, after the present invention determines the position information where the first coordinate axis is located in the grayscale image, it can determine the data value per unit length of the second coordinate axis based on the position information where the first coordinate axis is located in the grayscale image and the first included angle.

[0072] Optionally, step S103 may include:

[0073] Perform numerical contour detection on the grayscale image to detect each numerical contour in the grayscale image;

[0074] Based on the position information where the first coordinate axis is located in the grayscale image and the first included angle, determine the position information of the second coordinate axis in the grayscale image;

[0075] Based on the position information of the second coordinate axis in the grayscale image, determine at least one numerical contour on the second coordinate axis from each numerical contour of the grayscale image;

[0076] Based on at least one numerical contour on the second coordinate axis, determine the data value per unit length of the second coordinate axis.

[0077] Among them, the numerical contour can be a contour of a certain shape used to identify a certain numerical value in the grayscale image, such as a rectangular frame.

[0078] Specifically, the present invention can perform numerical contour detection in the grayscale image and detect the numerical contours of each numerical value in the grayscale image.

[0079] It can be understood that the present invention can use the position information and the first included angle of the determined first coordinate axis in the grayscale image to determine the position information of the second coordinate axis in the grayscale image.

[0080] Specifically, the present invention can, according to the position information of the second coordinate axis in the grayscale image, determine at least one numerical contour on the second coordinate axis from the detected numerical contours of each numerical value in the grayscale image. Then, the present invention can determine the data value per unit length on the second coordinate axis based on at least one numerical contour on the determined second coordinate axis.

[0081] Optionally, the above determining at least one numerical contour on the second coordinate axis from the numerical contours of each numerical value in the grayscale image based on the position information of the second coordinate axis in the grayscale image may include:

[0082] Based on the position information of the second coordinate axis in the grayscale image, determine the initial scale contour on the second coordinate axis from the numerical contours of each numerical value in the grayscale image;

[0083] The above determining the data value per unit length of the second coordinate axis based on at least one numerical contour on the second coordinate axis may include:

[0084] Determine the position information of the initial scale contour in the grayscale image;

[0085] Identify the numerical values in the initial scale contour;

[0086] Determine the position information of the zero point on the second coordinate axis;

[0087] Based on the position information of the initial scale contour in the grayscale image and the position information of the zero point on the second coordinate axis, determine the length of the initial scale from the zero point on the second coordinate axis;

[0088] Divide the numerical values in the initial scale contour by the length, and determine the obtained value as the data value per unit length.

[0089] Among them, the initial scale contour can be the contour of the first scale value on the second coordinate axis except the zero point. It can be understood that the first scale value on the second coordinate axis can be the difference between adjacent scale values, that is, the scale interval value. For example, if the first scale value on the second coordinate axis is 20, the scale interval value can be 20. At this time, it can be deduced that the second scale value on the second coordinate axis is 40, and the third scale value is 60.

[0090] Specifically, after obtaining the grayscale image, the present invention can perform contour detection on the grayscale image to detect the contours of each value in the grayscale image, that is, each value contour.

[0091] It can be understood that the starting point of the first coordinate axis can be the zero point of the two-dimensional coordinate system. The present invention can determine the position information of the two-dimensional coordinate system in the grayscale image based on the position information of the first coordinate axis in the grayscale image and the first included angle. After that, the present invention can, based on the position information of the second coordinate axis in the grayscale image, determine the numerical contour closest to the zero point of the two-dimensional coordinate system in the direction of the second coordinate axis from each value contour as the initial scale contour.

[0092] Specifically, after determining the initial scale contour, the present invention can determine the position information of the initial scale contour in the grayscale image, identify the value in the initial scale contour, that is, the coordinate value of the initial scale on the second coordinate axis, that is, the initial scale value; based on the position information of the initial scale contour in the grayscale image, the first included angle, and the position information of the second coordinate axis in the grayscale image, determine the position information of the initial scale on the second coordinate axis in the grayscale image. After that, based on the position information of the initial scale in the grayscale image and the position information of the zero point on the second coordinate axis in the grayscale image, calculate the length of the initial scale on the second coordinate axis from the zero point; then, divide the identified initial scale value by this length, and determine the value obtained by the division as the above data value per unit length.

[0093] Optionally, the above determining the initial scale contour on the second coordinate axis from each value contour of the grayscale image based on the position information of the second coordinate axis in the grayscale image may include:

[0094] Determine all the value contours in the area where the first value contour in the direction of the second coordinate axis is located from each value contour of the grayscale image;

[0095] Among all the value contours in the area where the first value contour is located, determine the value contour with the largest contour area as the initial scale contour.

[0096] It should be noted that when the present invention performs contour detection on a grayscale image, for any value composed of multiple digits, multiple numerical contours corresponding to the value can be detected. For example, for the value 20 in the grayscale image, when the present invention performs contour detection, the contour of the digit 2 corresponding to the value, the contour corresponding to the digit 0, and the contour of 20 can be detected.

[0097] It can be understood that for a certain value, when the value is composed of multiple digits, since the distances between the digits in the value are relatively close, there will be overlapping parts between the respective numerical contours corresponding to the value. Moreover, among all the contours corresponding to a certain value, the complete contour of the value can be the one with the largest area. For example, the value 20 can correspond to the contour of the digit 2, the contour corresponding to the digit 0, and the contour of 20, and the contour of 20 can be the one with the largest area among these three contours. The present invention can determine the complete contour including all the digits of the value from all the contours corresponding to a value according to the area size.

[0098] Specifically, when the present invention needs to detect the initial scale contour, after detecting each numerical contour in the grayscale image, it can first determine the first numerical contour in the second coordinate axis direction, and then determine all the numerical contours having overlapping parts with the first numerical contour from each numerical contour, and determine the numerical contour with the largest contour area from all these numerical contours, and determine the numerical contour with the largest contour area as the initial scale contour.

[0099] Specifically, in the process of determining the position information of the initial scale contour in the grayscale image, the present invention can first determine its vertical axis coordinate. Specifically, the present invention can first determine the vertical axis coordinate of the top of the initial scale contour in the grayscale image, determine the vertical axis coordinate of the bottom of the initial scale contour in the grayscale image, and then determine the mean value of the vertical axis coordinates of the top and the bottom as the vertical axis coordinate of the initial scale contour in the grayscale image. Similarly, the present invention can determine the horizontal axis coordinate of the initial scale contour in the grayscale image. At this time, the present invention can determine the position information of the initial scale contour in the grayscale image.

[0100] Specifically, after obtaining the initial scale contour, the present invention can use the trained contour numerical recognition model to recognize the value in the initial scale contour, that is, the initial scale value.

[0101] Optionally, the contour value recognition model can be a trained k-nearest neighbor (knn) model. It should be noted that the present invention can utilize the knn model to be trained provided by opencv, load the samples required for the knn model, read the sample values with opencv, convert them into 600-dimensional vectors, and send them into the knn model to be trained to obtain a trained knn model.

[0102] Specifically, the present invention can utilize the trained knn model to recognize the values in the initial scale contour, obtain the nearest neighbor value output by the knn model, and determine the nearest neighbor value as the initial scale value.

[0103] Optionally, after obtaining the grayscale image, the present invention can first perform binarization processing on the grayscale image, such as performing cv2.adaptiveThreshold binarization processing, filtering out the invalid information in the grayscale image, retaining the valid information including the values in the grayscale image, and then performing contour detection on the grayscale image.

[0104] S104. In the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one data point in the second coordinate axis.

[0105] Specifically, after determining the data value per unit length of the second coordinate axis, the present invention can determine the coordinate values of one or more data points in the target data image in the second coordinate axis based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis.

[0106] Optionally, as Figure 2 shown, in the third data processing method proposed in the embodiment of the present invention, step S104 may include steps S301, S302, and S303. Among them:

[0107] S301. Perform multi-point division on the first coordinate axis in the target data image;

[0108] Specifically, after determining the position information of the first coordinate axis in the grayscale image, the present invention can locate the first coordinate axis in the target data image according to the position information.

[0109] Specifically, after locating the first coordinate axis in the target data image, the present invention can perform multi-point division on the first coordinate axis in the target data image.

[0110] Specifically, the present invention can evenly divide the first coordinate axis into line segments of a certain number of parts. For example, the present invention can evenly divide the first coordinate axis into 40 line segments.

[0111] Specifically, the present invention can divide the first coordinate axis non-equally, that is, the lengths of the divided line segments can be not the same value.

[0112] Specifically, after dividing the first coordinate axis, the present invention can obtain multiple divided line segments and record the position information of the endpoints of each line segment.

[0113] S302. Obtain the position information of multiple division points in the target data image;

[0114] Wherein, the division points are the endpoints of the line segments divided by dividing the first coordinate axis.

[0115] Specifically, the present invention respectively obtains the position information of the endpoints of each divided line segment in the target data image.

[0116] S303. Based on the first included angle, the first color value, the position information of each division point, and the data value per unit length of the second coordinate axis, respectively obtain the coordinate values of the data points corresponding to each division point on the second coordinate axis.

[0117] Specifically, after determining the position information of each division point and the data value per unit length of the second coordinate axis, the present invention can, based on the first included angle, the first color value, the position information of each division point, and the data value per unit length of the second coordinate axis, obtain the coordinate values of the data points corresponding to each division point on the second coordinate axis.

[0118] Optionally, step S303 may include:

[0119] For the position information of any division point: based on the first included angle, the first color value, and the position information of the division point, determine the position information of the target data point corresponding to the division point in the target data image. Based on the position information of the division point in the target data image and the position information of the target data point in the target data image, determine the length between the division point and the target data point, multiply the length by the data value per unit length, and determine the product obtained by multiplication as the coordinate value of the target data point on the second coordinate axis.

[0120] Specifically, for any division point, the present invention can locate the data point with the first color value in the target data image in the direction extending from the division point and forming the first included angle with the first coordinate axis, determine the data point as the target data point, obtain the position information of the target data point in the target data image. Then, the present invention can calculate the length between the division point and the target data point based on the position information of the division point in the target data image and the position information of the target data point in the target data image, multiply the length by the above-mentioned data value per unit length, and determine the product obtained by multiplication as the coordinate value of the target data point on the second coordinate axis.

[0121] Optionally, step S303 described above may specifically include:

[0122] In the target data image, in the direction extending from the division point and making a first angle with the first coordinate axis, find each pixel point with the first color value, obtain the position information of each pixel point in the target data image, based on the position information of each pixel point in the target data image, determine the position information of the target data point in the target data image, based on the position information of the division point in the target data image and the position information of the target data point in the target data image, determine the length between the division point and the target data point, multiply the length by the data value per unit length, and determine the product obtained by the multiplication as the coordinate value of the target data point on the second coordinate axis.

[0123] Specifically, for any division point, the present invention can locate each pixel point with the first color value in the target data image in the direction extending from the division point and making a first angle with the first coordinate axis, respectively obtain the position information of each pixel point in the target data image, and based on the position information of each pixel point in the target data image, determine the position information of the target data point in the target data image. Among them, the present invention can first determine the vertical axis coordinates of each pixel point in the target data image, then calculate the average value of the vertical axis coordinates of each pixel point, and determine the average value as the vertical axis coordinate of the target data point in the target data image. Similarly, the present invention can determine the horizontal axis coordinate of the target data point in the target data image.

[0124] It should be noted that when the two-dimensional coordinate system is a rectangular coordinate system, the first coordinate axis is the horizontal axis, the second coordinate axis is the vertical axis, and the first coordinate axis is parallel to the horizontal axis in the image coordinate system, the present invention can determine at least one data point in the target data image and the corresponding coordinate value of the at least one data point on the second coordinate axis according to the above steps S101 to S104;

[0125] When the two-dimensional coordinate system is a rectangular coordinate system, the first coordinate axis is the horizontal axis, the second coordinate axis is the vertical axis, and there is a small inclination angle between the first coordinate axis and the horizontal axis in the image coordinate system, the present invention can also determine at least one data point in the target data image and the corresponding coordinate value of the at least one data point on the second coordinate axis according to the above steps S101 to S104;

[0126] In addition, when the two-dimensional coordinate system is a non-rectangular coordinate system, such as a coordinate system composed of two coordinate axes with an included angle of 45 degrees, and the first coordinate axis is parallel to the horizontal axis in the image coordinate system or has a small inclination angle, the present invention can determine at least one data point in the target data graph and the corresponding coordinate value of the at least one data point on the second coordinate axis according to the above steps S101 to S104.

[0127] It should also be noted that through the above steps S101 to S104, the present invention can effectively determine at least one data point in the target data graph and the coordinate value of the data point on the second coordinate axis, that is, it can effectively realize the extraction of the data information of the data points in the target data graph, obtain structured data and save it, without the need for manual extraction, which can effectively improve the data extraction efficiency and avoid the problem of relatively low data accuracy that may exist in the manual extraction method.

[0128] Specifically, when the coordinate values on the first coordinate axis in the two-dimensional coordinate system have periodic change characteristics, such as time (multiple weeks or multiple months), by executing steps S101 to S104, the present invention can determine the data information corresponding to each period on the second coordinate axis by extracting the coordinate values of multiple data points on the second coordinate axis in multiple target data graphs, so as to determine the data change characteristics within each period.

[0129] It should also be noted that the present invention can extract data from the images of different data graphs according to steps S101 to S104 to achieve batch data extraction and further improve the data extraction efficiency.

[0130] It should also be noted that in the prior art during the data extraction process from data images, the curve in the picture can be fitted first, and then the value of the ordinate can be determined according to the position of the ordinate. However, this method is relatively cumbersome. Some data in the graph need to be obtained in advance, and some key indicators need to be manually input. Moreover, the fitting effect for line graphs is not good because line graphs are not smooth curves. Although when there are enough data points, it can approximate a smooth curve, but in real life, line graphs do not have a very large number of points. Therefore, there is a large gap between the fitted curve and the curve in the original line graph, and when too many parameters are input, automated data collection cannot be achieved, and the data extraction efficiency may be relatively low.

[0131] In addition, the prior art can extract the coordinate information of data points in a data image through a vision algorithm. Specifically, the prior art can use the HoughCircles circle detection in a vision library for data extraction. This algorithm can identify circles in an image according to different parameters, including points and large and small circles, and calculate the true values of the data points based on the horizontal and vertical coordinates of the detected points in the picture. This method can collect all data points in the picture, but it has certain requirements for the data points. If the data points are too small, the Hough circle detection is very likely to miss this point, resulting in problems such as misdetection and missed detection of data points, and it also has relatively high requirements for the image quality. It is necessary to continuously try all parameters in the Hough circle detection to find the parameters that best meet the detection requirements, and the data extraction efficiency is relatively low;

[0132] Moreover, the prior art can perform data extraction by using a graphic conversion tool. This tool requires manual determination of the horizontal and vertical coordinates and needs to perform manual anchoring, and then convert it into structured data for export. This tool is suitable for scenarios where precise values of some pictures need to be obtained in thesis writing. The amount of manual processing involved is relatively large, and the data extraction efficiency is relatively low. It cannot be applied to business scenarios that require batch data extraction, and it cannot be integrated into the business processing platform, suffering from the problems of weak practicality and a small range of application scenarios.

[0133] It can be understood that, compared with the above prior art, the present invention can extract data in a target data image through steps S101 to S104, obtain structured data and save it, reduce the amount of work that requires manual participation, is applicable to batch data extraction scenarios, can effectively improve the data processing efficiency, has relatively strong practicality, and has a relatively large range of applicable application scenarios.

[0134] The data processing method proposed by the present invention can obtain a grayscale image corresponding to the target data image; wherein, the target data image is an image of the target data map, the target data map includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each data point is the first color value; determine the position information of the first coordinate axis in the grayscale image; based on the position information of the first coordinate axis in the grayscale image and the first included angle, determine the data value per unit length of the second coordinate axis; in the target data image, based on the first included angle, the first color value and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one data point on the second coordinate axis. The present invention can effectively determine at least one data point in the target data map and the corresponding coordinate values of the at least one data point on the second coordinate axis, that is, it can effectively realize the extraction of data information of the data points in the target data map, without the need for manual extraction, which can effectively improve the data extraction efficiency and avoid the problem of relatively low data accuracy that may exist in the manual extraction method.

[0135] Based on the above data processing method, as Figure 3 shown, the fourth data processing method is proposed in an embodiment of the present invention, and the method may include the following steps:

[0136] S401. Obtain the original image including the target data map;

[0137] S402. Perform standardization processing on the original image to obtain a grayscale image; wherein, the standardization processing includes unified processing of the image format and size parameters, and also includes grayscale processing of the obtained target data image after unified processing; wherein, the target data image is an image of the target data map, the target data map includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each data point is the first color value;

[0138] S403. Perform canny edge detection on the grayscale image to obtain the image after edge detection;

[0139] S404. Perform processing using the cv2.HoughLinesP statistical probability Hough line transform function on the image after edge detection to divide each line in the grayscale image into multiple line segments;

[0140] S405. In the line segment set composed of the divided multiple line segments, screen and locate the first coordinate axis in the grayscale image, and determine the position information of the first coordinate axis in the grayscale image;

[0141] S406. Divide the first coordinate axis into equally-spaced points in the grayscale image according to the position information of the first coordinate axis in the grayscale image to obtain multiple division points, and determine the position information of each division point in the target data image;

[0142] S407. Obtain a Knn model for identifying contour values through training;

[0143] S408. Perform binary processing on the grayscale image using cv2.adaptiveThreshold to filter out invalid information in the grayscale image;

[0144] S409. Perform contour detection on the binary-processed grayscale image to determine each numerical contour in the grayscale image;

[0145] S410. Perform contour screening and positioning among each numerical contour to determine the initial scale contour;

[0146] S411. Use the trained Knn model to predict and identify the values in the initial scale contour, that is, the coordinate values of the initial scale contour on the second coordinate axis, that is, the ordinate values corresponding to the initial scale contour in the target data image, and determine this coordinate value as the data value per unit length of the second coordinate axis;

[0147] S412. Based on the first included angle, the first color value, the data value per unit length of the second coordinate axis, and the position information of each division point in the target data image, respectively determine the data points corresponding to each division point, determine the position information of each data point in the target data image, and the data values of each data point on the second coordinate axis;

[0148] S412. Return the structured data composed of the position information of each data point in the target data image and the data values on the second coordinate axis.

[0149] It should be noted that the specific processing procedures and the resulting technical effects of the above steps S401 to S412 have been described in the above data processing method, and will not be elaborated here.

[0150] The data processing method proposed in this embodiment can effectively achieve data extraction of data points in the target data map, and can effectively improve the efficiency of data extraction and acquisition.

[0151] Based on Figure 1 , the fifth data processing method is proposed in the embodiment of the present invention, and this data processing method may further include step S501. Wherein:

[0152] S501. Determine the coordinate values of at least one data point on the first coordinate axis.

[0153] It is understandable that the present invention can determine the coordinate values of at least one data point on the first coordinate axis by referring to the method of determining the coordinate values of at least one data point on the second coordinate axis.

[0154] Optionally, when the present invention determines the data points in the target data graph according to the division points, after determining each division point, it can refer to the methods such as contour detection, contour positioning, contour value recognition, and coordinate value calculation used in determining the scale information of the second coordinate axis above to determine the coordinate values of each division point on the first coordinate axis. At this time, the present invention can determine the coordinate value of a certain division point on the first coordinate axis as the coordinate value of the data point corresponding to this division point on the first coordinate axis.

[0155] It should be noted that the present invention can determine the abscissa information and ordinate information of at least one data point in the two-dimensional coordinate system in the target data graph, realize the complete extraction of the coordinate information of each data point in the target data graph, and ensure the integrity of data extraction.

[0156] The data processing method proposed by the present invention can determine the abscissa information and ordinate information of at least one data point in the two-dimensional coordinate system in the target data graph, realize the complete extraction of the coordinate information of each data point in the target data graph, and ensure the integrity of data extraction.

[0157] Corresponding to Figure 1 the method shown, as Figure 4 shown, an embodiment of the present invention proposes a data processing device. The data processing device may include: a first obtaining unit 101, a first determining unit 102, a second determining unit 103, and a third determining unit 104; where:

[0158] The first obtaining unit 101 is configured to obtain a grayscale image corresponding to the target data image; where the target data image is an image of the target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is a first included angle, and the color value of each data point is a first color value;

[0159] The first determining unit 102 is configured to determine the position information of the first coordinate axis in the grayscale image;

[0160] The second determining unit 103 is configured to determine the data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle;

[0161] The third determining unit 104 is configured to determine the coordinate values of at least one data point on the second coordinate axis in the target data image based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis.

[0162] It should be noted that for the specific processing procedures of the first acquisition unit 101, the first determination unit 102, the second determination unit 103, and the third determination unit 104 and the technical effects brought thereby, reference can be respectively made to the relevant descriptions of steps S101 to S104 in this invention Figure 1 and details are not elaborated herein.

[0163] Optionally, the first determination unit 102 includes: a first processing unit, a fourth determination unit, and a fifth determination unit;

[0164] The first processing unit is configured to perform a statistical probability Hough line transform function processing on the grayscale image, so as to divide each line of the target data graph into at least one line segment in the grayscale image;

[0165] The fourth determination unit is configured to respectively determine the position information of the two endpoints of each line segment in the corresponding direction of the first coordinate axis in the grayscale image; wherein, the position information of the endpoint includes the horizontal axis coordinate and the vertical axis coordinate of the endpoint in the grayscale image;

[0166] The fifth determination unit is configured to determine the position information of the first coordinate axis in the grayscale image based on the position information of the two endpoints of each line segment in the corresponding direction of the first coordinate axis in the grayscale image.

[0167] Optionally, the fifth determination unit includes: a sixth determination unit, a first generation unit, a segmentation determination unit, and a seventh determination unit;

[0168] The sixth determination unit is configured to determine the median or mode of all vertical axis coordinates among the vertical axis coordinates of the two endpoints of each line segment in the corresponding direction of the first coordinate axis as the target vertical axis coordinate;

[0169] The first generation unit is configured to generate a target vertical axis coordinate interval based on the target vertical axis coordinate; wherein, the target vertical axis coordinate interval is an interval not less than the first value and not greater than the second value, the first value is the value obtained by subtracting a preset floating value from the target vertical axis coordinate, and the second value is the value obtained by adding the preset floating value to the target vertical axis coordinate;

[0170] The segmentation determination unit is configured to determine, among each line segment in the corresponding direction of the first coordinate axis, the line segments whose vertical axis coordinates of the two endpoints are both within the target vertical axis coordinate interval as the segments of the first coordinate axis;

[0171] The seventh determination unit is configured to determine the position information of the first coordinate axis in the grayscale image based on the position information of the two endpoints of each segment.

[0172] Optionally, the second determination unit 103 includes: a detection unit, a first information determination unit, a first contour determination unit, and a first data value determination unit; where:

[0173] The detection unit is configured to perform numerical contour detection on the grayscale image to detect each numerical contour in the grayscale image;

[0174] The first information determination unit is configured to determine the position information of the second coordinate axis in the grayscale image based on the position information of the first coordinate axis in the grayscale image and the first included angle;

[0175] The first contour determination unit is configured to determine at least one numerical contour on the second coordinate axis from each numerical contour in the grayscale image based on the position information of the second coordinate axis in the grayscale image;

[0176] The first data value determination unit is configured to determine the data value per unit length of the second coordinate axis based on at least one numerical contour on the second coordinate axis.

[0177] Optionally, the first contour determination unit is configured to determine the initial scale contour on the second coordinate axis from each numerical contour in the grayscale image based on the position information of the second coordinate axis in the grayscale image;

[0178] The first data value determination unit includes: a second information determination unit, a numerical recognition unit, a third information determination unit, a first length determination unit, and a second data value determination unit; where:

[0179] The second information determination unit is configured to determine the position information of the initial scale contour in the grayscale image;

[0180] The numerical recognition unit is configured to recognize the numerical values in the initial scale contour;

[0181] The third information determination unit is configured to determine the position information of the zero point on the second coordinate axis;

[0182] The first length determination unit is configured to determine the length from the initial scale on the second coordinate axis to the zero point based on the position information of the initial scale contour in the grayscale image and the position information of the zero point on the second coordinate axis;

[0183] The second data value determination unit is configured to divide the numerical value in the initial scale contour by the length, and determine the obtained value as the data value per unit length.

[0184] Optionally, the first contour determination unit includes: a second contour determination unit and a third contour determination unit;

[0185] A second contour determination unit, configured to determine all numerical contours in the region where the first numerical contour in the second coordinate axis direction is located from the respective numerical contours of the grayscale image;

[0186] A third contour determination unit, configured to determine the numerical contour with the largest contour area as the initial scale contour from all the numerical contours in the region where the first numerical contour is located.

[0187] Optionally, the third determination unit 104 includes: a division unit, a second obtaining unit, and a third obtaining unit;

[0188] The division unit is configured to perform multi-point division on the first coordinate axis in the target data image;

[0189] The second obtaining unit is configured to obtain the position information of multiple division points in the target data image;

[0190] The third obtaining unit is configured to respectively obtain the coordinate values of the data points corresponding to the respective division points on the second coordinate axis based on the first included angle, the first color value, the position information of each division point, and the data value per unit length of the second coordinate axis.

[0191] Optionally, the third obtaining unit is configured to, for the position information of any division point: based on the first included angle, the first color value, and the position information of the division point, determine the position information of the target data point corresponding to the division point in the target data image, based on the position information of the division point in the target data image and the position information of the target data point in the target data image, determine the length between the division point and the target data point, multiply the length by the data value per unit length, and determine the product obtained by the multiplication as the coordinate value of the target data point on the second coordinate axis.

[0192] Optionally, the third obtaining unit is configured to, for the position information of any division point: in the target data image, in the direction extending from the division point and forming the first included angle with the first coordinate axis, find the respective pixel points with the first color value, obtain the position information of each pixel point in the target data image, based on the position information of each pixel point in the target data image, determine the position information of the target data point in the target data image, determine the length between the division point and the target data point, multiply the length by the data value per unit length, and determine the product obtained by the multiplication as the coordinate value of the target data point on the second coordinate axis.

[0193] Optionally, the data processing device further includes: an eighth determination unit;

[0194] The eighth determination unit is configured to determine the coordinate values of at least one data point on the first coordinate axis.

[0195] The data processing device proposed in this embodiment can obtain the grayscale image corresponding to the target data image. Among them, the target data image is the image of the target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each data point is the first color value. Determine the position information of the first coordinate axis in the grayscale image. Based on the position information of the first coordinate axis in the grayscale image and the first included angle, determine the data value per unit length of the second coordinate axis. In the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one data point on the second coordinate axis. The present invention can effectively determine at least one data point in the target data graph and the corresponding coordinate values of the at least one data point on the second coordinate axis, that is, it can effectively realize the extraction of the data information of the data points in the target data graph, without the need for manual extraction, which can effectively improve the data extraction efficiency and avoid the problem of relatively low data accuracy that may exist in the manual extraction method.

[0196] On the other hand, the present invention also provides an electronic device, which may include: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements any of the above data processing methods.

[0197] Figure 5 An entity structure diagram of an electronic device is exemplified, as Figure 5 shown, the electronic device may include: a processor 210, a communication interface 220, a memory 230, and a communication bus 240.

[0198] Among them, the processor 210, the communication interface 220, and the memory 230 complete mutual communication through the communication bus 240. The processor 210 can call the logical instructions in the memory 230 to execute the data processing method, and the data processing method may include:

[0199] Obtain the grayscale image corresponding to the target data image. Among them, the target data image is the image of the target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each data point is the first color value.

[0200] Determine the position information of the first coordinate axis in the grayscale image.

[0201] Determine the data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle.

[0202] In the target data image, determine the coordinate values of at least one data point on the second coordinate axis based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis.

[0203] In addition, when the logic instructions in the above-mentioned memory 230 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0204] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the data processing methods provided by the above-mentioned various methods, which may include:

[0205] Obtain the grayscale image corresponding to the target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each data point is the first color value;

[0206] Determine the position information of the first coordinate axis in the grayscale image;

[0207] Determine the data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle.

[0208] In the target data image, determine the coordinate values of at least one data point on the second coordinate axis based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis.

[0209] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the data processing method provided by the above-mentioned various methods, which may include:

[0210] Obtain a grayscale image corresponding to the target data image; wherein, the target data image is an image of the target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is a first included angle, and the color value of each data point is a first color value;

[0211] Determine the position information of the first coordinate axis in the grayscale image;

[0212] Based on the position information of the first coordinate axis in the grayscale image and the first included angle, determine the data value per unit length of the second coordinate axis;

[0213] In the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one data point on the second coordinate axis.

[0214] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative labor.

[0215] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiments.

[0216] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention. These are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

Claims

1. A data processing method, characterized in that, Including: Obtain a grayscale image corresponding to the target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is a first included angle, and the color value of each data point is a first color value; Determine the position information of the first coordinate axis in the grayscale image; Based on the position information of the first coordinate axis in the grayscale image and the first included angle, determine the data value per unit length of the second coordinate axis; In the target data image, based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis, determine the coordinate values of at least one of the data points on the second coordinate axis; The determining the data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle includes: Perform numerical contour detection on the grayscale image to detect each numerical contour in the grayscale image; Based on the position information of the first coordinate axis in the grayscale image and the first included angle, determine the position information of the second coordinate axis in the grayscale image; Based on the position information of the second coordinate axis in the grayscale image, determine at least one numerical contour on the second coordinate axis from each numerical contour of the grayscale image; Based on at least one numerical contour on the second coordinate axis, determine the data value per unit length of the second coordinate axis.

2. The data processing method according to claim 1, wherein The determining the position information of the first coordinate axis in the grayscale image includes: Perform a statistical probability Hough line transform function process on the grayscale image to divide each line of the target data graph into at least one line segment in the grayscale image, and respectively determine the position information of the two endpoints of each line segment in the direction corresponding to the first coordinate axis in the grayscale image; wherein, the position information of the endpoint includes the horizontal axis coordinate and the vertical axis coordinate of the endpoint in the grayscale image; Based on the position information of the two endpoints of each line segment in the direction corresponding to the first coordinate axis in the grayscale image, determine the position information of the first coordinate axis in the grayscale image.

3. The data processing method according to claim 2, wherein The determining the position information of the first coordinate axis in the grayscale image based on the position information of the two endpoints of each line segment in the direction corresponding to the first coordinate axis in the grayscale image includes: Among the vertical axis coordinates of the two endpoints of each line segment in the direction corresponding to the first coordinate axis, determine the median or mode of all vertical axis coordinates as the target vertical axis coordinate; Generate a target vertical axis coordinate interval based on the target vertical axis coordinate; wherein, the target vertical axis coordinate interval is an interval not less than a first value and not greater than a second value, the first value is a value obtained by subtracting a preset floating value from the target vertical axis coordinate, and the second value is a value obtained by adding the preset floating value to the target vertical axis coordinate; Among the line segments in the corresponding direction of the first coordinate axis, determine the line segments whose vertical axis coordinates of both endpoints are within the target vertical axis coordinate interval as the segments of the first coordinate axis; Determine the position information of the first coordinate axis in the grayscale image based on the position information of the two endpoints of each segment; 4. The data processing method according to claim 1, wherein The determining at least one numerical contour on the second coordinate axis from the numerical contours of the grayscale image based on the position information of the second coordinate axis in the grayscale image includes: Determine an initial scale contour on the second coordinate axis from the numerical contours of the grayscale image based on the position information of the second coordinate axis in the grayscale image; The determining the data value per unit length of the second coordinate axis based on at least one numerical contour on the second coordinate axis includes: Determine the position information of the initial scale contour in the grayscale image; Identify the numerical values in the initial scale contour; Determine the position information of the zero point on the second coordinate axis; Determine the length from the zero point of the initial scale distance on the second coordinate axis based on the position information of the initial scale contour in the grayscale image and the position information of the zero point on the second coordinate axis; Divide the numerical values in the initial scale contour by the length, and determine the obtained value as the data value per unit length; 5. The data processing method according to claim 4, wherein The determining the initial scale contour on the second coordinate axis from the numerical contours of the grayscale image based on the position information of the second coordinate axis in the grayscale image includes: Determine all the numerical contours in the area where the first numerical contour in the direction of the second coordinate axis is located from the numerical contours of the grayscale image; Among all the numerical contours in the area where the first numerical contour is located, determine the numerical contour with the largest contour area as the initial scale contour; 6. The data processing method according to claim 1, wherein The determining the coordinate values of at least one of the data points on the second coordinate axis in the target data image based on the first included angle, the first color value and the data value per unit length of the second coordinate axis includes: Perform multi-point division on the first coordinate axis in the target data image to obtain the position information of multiple division points in the target data image; Based on the first included angle, the first color value, the position information of each division point and the data value per unit length of the second coordinate axis, respectively obtain the coordinate values of the data points corresponding to each division point on the second coordinate axis.

7. The data processing method according to claim 6, wherein Based on the first included angle, the first color value, the position information of each of the division points, and the data value per unit length of the second coordinate axis, obtaining the coordinate values of the data points corresponding to each of the division points in the second coordinate axis respectively includes: For the position information of any one of the division points: Based on the first included angle, the first color value, and the position information of the division point, determining the position information of the target data point corresponding to the division point in the target data image; based on the position information of the division point in the target data image and the position information of the target data point in the target data image, determining the length between the division point and the target data point; multiplying the length by the data value per unit length; and determining the product obtained by the multiplication as the coordinate value of the target data point in the second coordinate axis.

8. The data processing method according to claim 7, wherein The determining, based on the first included angle, the first color value, and the position information of the division point, of the position information of the target data point corresponding to the division point in the target data image includes: In the target data image, searching for each pixel point with the color of the first color value in the direction extending from the division point and forming the first included angle with the first coordinate axis, and obtaining the position information of each of the pixel points in the target data image; Based on the position information of each of the pixel points in the target data image, determining the position information of the target data point in the target data image.

9. A data processing device, characterized in that, Including: A first obtaining unit, a first determining unit, a second determining unit, and a third determining unit; wherein: The first obtaining unit is configured to obtain a grayscale image corresponding to the target data image; wherein, the target data image is an image of a target data graph, the target data graph includes a two-dimensional coordinate system and at least one data point, the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the included angle between the first coordinate axis and the second coordinate axis is the first included angle, and the color value of each of the data points is the first color value; The first determining unit is configured to determine the position information of the first coordinate axis in the grayscale image; The second determining unit is configured to determine the data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle; The third determining unit is configured to determine the coordinate values of at least one of the data points in the second coordinate axis in the target data image based on the first included angle, the first color value, and the data value per unit length of the second coordinate axis; The determining of the data value per unit length of the second coordinate axis based on the position information of the first coordinate axis in the grayscale image and the first included angle includes: Performing numerical contour detection on the grayscale image to detect each numerical contour in the grayscale image; Determine the position information of the second coordinate axis in the grayscale image based on the position information of the first coordinate axis in the grayscale image and the first included angle; Based on the position information of the second coordinate axis in the grayscale image, determine at least one numerical contour on the second coordinate axis from each of the numerical contours of the grayscale image; Based on at least one numerical contour on the second coordinate axis, determine the data value per unit length of the second coordinate axis.

Citation Information

Patent Citations

  • Color conversion parameter determining method, color conversion parameter determining apparatus and color conversion parameter determination program

    JP2003244462A

  • Image processing method and apparatus, device, and storage medium

    WO2022087846A1