Curve coordinate extraction method and device, electronic equipment and storage medium
By preprocessing and curve detection of curve images, the curve coordinates are automatically identified, which solves the problems of low efficiency and large errors in the prior art, and efficient and accurate curve coordinate extraction is achieved.
Patent Information
- Application Number
- CN202411362347.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-07
AI Technical Summary
The existing curve coordinate extraction methods are inefficient, are easily affected by artificial errors, and are difficult to effectively identify complex curves, especially in scenarios where curves are complex or charts are numerous.
By preprocessing the curve image, identifying the target coordinate axis and curve features, determining pixel coordinates using curve detection algorithms, and mapping pixel coordinates based on the coordinate axis features, realizing automated identification and data extraction.
It significantly improves the accuracy and efficiency of data extraction, avoids artificial errors caused by manual operations, and is suitable for extracting discrete coordinates of multiple complex curves.
Smart Images

Figure CN119273932A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for extracting coordinates of a curve. Background Art
[0002] At present, curve graphs are often used to represent variable relationships, and specific coordinate values need to be obtained from the curve graphs, which is usually done by manually reading the curves or using semi-automatic tools. However, when the curves are complex or there are many graphs, the manual data extraction method is time-consuming, resulting in low efficiency and is easily affected by human errors, resulting in low data reading accuracy. Secondly, existing semi-automatic tools are difficult to effectively identify different types of curves and rely on users to manually input coordinate axis information. Therefore, the existing curve coordinate extraction method has great limitations and low data extraction efficiency. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for extracting coordinates of a curve, aiming to improve the efficiency of extracting coordinates from a curve.
[0004] To achieve the above object, a first aspect of an embodiment of the present application proposes a method for extracting coordinates of a curve, the method comprising:
[0005] Get an original image with one or more curves;
[0006] Preprocessing the original image to obtain a target image;
[0007] Identify a target coordinate axis and corresponding coordinate axis features in the target image, wherein the coordinate axis features include coordinate axis scale marks and coordinate axis proportional relationships;
[0008] Performing curve detection on the target image to determine pixel coordinates of the curve, where the pixel coordinates are used to indicate a position of the curve on the target image;
[0009] Based on the coordinate axis feature, the pixel coordinates are mapped to the target coordinate axis to determine the target coordinates on the curve.
[0010] In some embodiments, preprocessing the original image to obtain the target image includes:
[0011] Converting the original image into a grayscale image;
[0012] Performing denoising on the grayscale image;
[0013] The denoised grayscale image is subjected to edge enhancement and binarization to obtain the target image.
[0014] In some embodiments, identifying the target coordinate axis and the corresponding coordinate axis features in the target image includes:
[0015] Performing image cropping on the target image to obtain a regional image having a coordinate axis region, wherein the coordinate axis region includes the target coordinate axis;
[0016] Recognize the regional image using a pre-established OCR recognition model to determine the coordinate axis scale mark of the target coordinate axis, wherein the coordinate axis scale mark includes a first scale range of the first coordinate axis and a second scale range of the second coordinate axis;
[0017] Based on the first scale range and the second scale range, a coordinate axis ratio relationship of the target coordinate axis is determined.
[0018] In some embodiments, before cropping the target image to obtain a regional image having a coordinate axis region, the method includes:
[0019] When it is detected that the target coordinate axis on the target image is tilted or distorted, a straight line and a corresponding straight line feature on the target image are detected by Hough transform, and rotation correction is performed on the target image based on the straight line feature, wherein the straight line feature includes a tilt angle;
[0020] Or, when perspective deformation of the target coordinate axis on the target feature is detected, the target image is corrected by perspective transformation.
[0021] In some embodiments, performing curve detection on the target image to determine pixel coordinates of the curve includes:
[0022] Performing Gaussian smoothing on the target image to obtain an image to be detected;
[0023] Calculating edge features of each pixel in the image to be detected, wherein the edge features include gradient strength and direction;
[0024] Compare the magnitude of the gradient strength between each pixel point and the adjacent pixel point in the direction thereof, and retain the pixel point corresponding to the maximum gradient strength in the direction as the target pixel point;
[0025] Marking the target pixel point whose gradient intensity is greater than a preset first threshold as a strong edge point;
[0026] Marking a target pixel point whose gradient intensity is less than a preset second threshold as a non-edge point, wherein the first threshold is greater than the second threshold;
[0027] Marking a target pixel point whose gradient intensity is between the first threshold and the second threshold as a weak edge point;
[0028] Connecting the strong edge points with the weak edge points to form a curve profile of a curve in the target image;
[0029] Based on the curve profile, the curve and corresponding pixel coordinates are determined.
[0030] In some embodiments, determining the curve and the corresponding pixel coordinates based on the curve profile includes:
[0031] When it is detected that there is only one curve in the target image, the pixel coordinates of the edge points on the curve contour are extracted as the pixel coordinates of the curve;
[0032] When it is detected that there are multiple curves in the target image and the target image is a color image, color clustering is performed on the pixel points on the target image, and the pixel points whose pixel value differences are within a preset pixel range are regarded as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image;
[0033] When it is detected that there are multiple curves in the target image and the target image is a black and white image, line features of the target image are extracted, and pixel points whose difference values of the line features are within a preset feature range are regarded as being located on the same curve contour, so as to extract pixel coordinates on each curve contour as pixel coordinates of the corresponding curve, and form curve data of the target image, wherein the line features include line width and / or morphological features, and the morphological features include virtual and real line features;
[0034] The curve data is used to describe the identification of any curve, the curve characteristics of the curve and the pixel coordinates of the curve, and the curve characteristics include at least one of color, pixel value and line characteristics.
[0035] In some embodiments, mapping the pixel coordinates to the target coordinate axis based on the coordinate axis feature to determine the target coordinates on the curve includes:
[0036] When the curve is detected to be discontinuous, determining whether the change rate of the curve is less than a preset change rate threshold;
[0037] When it is detected that the change rate is less than the change rate threshold, linear interpolation is performed through the target coordinates of any two data points on the curve to determine the target coordinates of the data points of the discontinuous part of the curve;
[0038] When it is detected that the change rate is not less than the change rate threshold, the curve is fitted by a preset spline function model to determine the target coordinates of the data points of the discontinuous part on the curve.
[0039] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a device for extracting coordinates of a curve, the device comprising:
[0040] An image acquisition module, used for acquiring an original image having one or more curves;
[0041] A preprocessing module, used for preprocessing the original image to obtain a target image;
[0042] A coordinate axis recognition module, used to recognize a target coordinate axis in the target image and corresponding coordinate axis features, wherein the coordinate axis features include coordinate axis scale marks and coordinate axis proportional relationships;
[0043] A curve detection module, used to perform curve detection on the target image and determine the pixel coordinates of the curve, wherein the pixel coordinates are used to indicate the position of the curve on the target image;
[0044] A coordinate extraction module is used to map the pixel coordinates to the target coordinate axis based on the coordinate axis feature, and determine the target coordinates on the curve.
[0045] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the coordinate extraction method of the curve described in the first aspect above.
[0046] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the coordinate extraction method of the curve described in the first aspect above.
[0047] The coordinate extraction method, device, electronic device and storage medium of a curve proposed in the present application improve the image quality by preprocessing the original image having one or more curves, thereby facilitating improving the accuracy of subsequent curve detection and coordinate extraction. The method and device perform curve detection on the target image to determine the pixel coordinates of the curve, thereby realizing automatic recognition and data extraction. There is no need to manually read the curve or use semi-automatic tools, thus avoiding human errors caused by manual operation and significantly improving the accuracy and efficiency of data extraction. The target coordinate axis in the target image is then identified to realize pixel mapping of the pixel coordinates on the target coordinate axis. The method is suitable for extracting discrete coordinates of a variety of complex curves and can effectively improve the efficiency of data extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A schematic diagram of a flow chart of a method for extracting coordinates of a curve provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of the image preprocessing process provided in the embodiment of the present application;
[0050] Figure 3 A schematic diagram of the process of coordinate axis identification provided in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of the flow of curve detection provided in an embodiment of the present application;
[0052] Figure 5 A schematic diagram of a process of extracting pixel coordinates provided for an exemplary embodiment of the present application;
[0053] Figure 6 A schematic diagram of the coordinate extraction process provided in the embodiment of the present application;
[0054] Figure 7 A schematic diagram of the structure of a curve coordinate extraction device provided in an embodiment of the present application;
[0055] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0057] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0059] First, some nouns involved in this application are analyzed:
[0060] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, language recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0061] Image Processing: refers to the technology of using computers to analyze images to achieve the desired results, also known as image processing. It is mainly aimed at digital images, that is, two-dimensional arrays obtained by taking pictures with industrial cameras, video cameras, scanners and other equipment. The elements of the array are called pixels, and their values are called grayscale values.
[0062] Image preprocessing: refers to a very critical step in computer vision and image processing. Its main purpose is to eliminate irrelevant information in the image, restore useful real information, enhance the detectability of relevant information, and simplify the data to the maximum extent, thereby improving the reliability of subsequent feature extraction, image segmentation, matching and recognition.
[0063] Pixel: refers to the basic unit of digital images, used to describe the resolution of digital images. It is composed of small squares (or dots) in the image, which contain information such as color, brightness and transparency.
[0064] Pixel Point: refers to the basic element that constitutes a pixel. It is the smallest indivisible unit in a digital image and represents an image unit with a fixed position and a specific color or brightness value.
[0065] Optical Character Recognition (OCR): refers to a technology that converts printed or handwritten text into editable and searchable electronic files through optical devices (such as scanners or digital cameras). This technology uses image processing, pattern recognition and machine learning algorithms to automatically identify and extract text information in images and convert it into computer-recognizable character codes. Optical character recognition includes image preprocessing, text segmentation, text recognition, post-processing, etc.
[0066] Edge detection algorithm: refers to a technology commonly used in digital image processing, mainly used to detect the position of the edge of an object in an image. An edge is an area in an image where the grayscale changes sharply, usually corresponding to the outline of an object. The edge detection algorithm identifies these edge areas by calculating the grayscale difference between a pixel in an image and its neighboring pixels. Edge detection algorithms include the Sobel operator, Prewitt operator, Canny operator, and Laplacian operator.
[0067] Clustering: refers to an unsupervised learning data analysis method, whose main purpose is to divide a collection of physical or abstract objects into multiple classes (or clusters) consisting of similar objects. In the clustering process, objects are usually divided according to their similarity or distance, so that objects in the same class are similar to each other, while objects in different classes are different. Clustering methods include hierarchical clustering, K-means clustering, density-based spatial clustering of applications with noise (DBSCAN), mean shift clustering, etc.
[0068] Linear interpolation: It is a mathematical interpolation method that uses the function values at several known points in a certain interval to make an appropriate specific function (usually a first-order polynomial) and use this specific function to estimate the function values of other points in the interval.
[0069] Spline interpolation: It is a technique widely used in numerical analysis and computer graphics, mainly used to construct smooth curves or surfaces through a series of known data points.
[0070] At present, it is usually achieved by manually reading the curve or using semi-automatic tools to obtain specific discrete coordinate values from the curve chart. However, the manual data extraction method is time-consuming and inefficient, and is easily affected by human errors, resulting in low data reading accuracy, and is difficult to apply to scenes with complex curves or many charts. Secondly, it is difficult to effectively identify different types of curves with the help of semi-automatic tools, and it is necessary to rely on the user to manually input the coordinate axis information. Therefore, the existing curve coordinate extraction method has great limitations and low data extraction efficiency.
[0071] Based on the above problems, the embodiments of the present application provide a method, device, electronic device and storage medium for extracting coordinates of a curve. By performing curve detection on a target image to determine the pixel coordinates of the curve, automatic recognition and data extraction are achieved. By identifying the target coordinate axis in the target image, pixel mapping of the pixel coordinates on the target coordinate axis is achieved. The method is suitable for extracting discrete coordinates of a variety of complex curves, avoiding human errors caused by manual operations, and significantly improving the accuracy and efficiency of data extraction.
[0072] The coordinate extraction method, device, electronic device and storage medium of a curve provided in the embodiments of the present application are specifically described through the following embodiments. First, the coordinate extraction method of a curve in the embodiments of the present application is described.
[0073] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0074] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0075] The coordinate extraction method of the curve provided in the embodiment of the present application relates to the field of image processing technology. The coordinate extraction method of the curve provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or it can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the coordinate extraction method of the curve, etc., but is not limited to the above forms.
[0076] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0077] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0078] Figure 1 A schematic diagram of a flow chart of a method for extracting coordinates of a curve provided in an embodiment of the present application, Figure 1 The method may include but is not limited to steps S101 to S105.
[0079] S101. Acquire an original image having one or more curves.
[0080] It should be noted that the present application is applied to images with curves, which may contain one curve or multiple curves. The curve coordinate extraction method of the present application can be applied to scenes with complex curves and a large number of charts, and can realize automatic recognition of any curve on the image and extraction of discrete coordinates from the curve. It has a relatively wide range of applications, and the method of the present application can improve the stability of data extraction.
[0081] S102: Preprocess the original image to obtain a target image.
[0082] In the present application, the preprocessing of the original image includes but is not limited to grayscale transformation, denoising, image enhancement, binarization, filtering, smoothing, sharpening, normalization, histogram equalization, geometric transformation, etc. The image preprocessing of the present application can improve the image quality and facilitate the improvement of the accuracy of subsequent curve detection and coordinate extraction.
[0083] S103, identifying a target coordinate axis and corresponding coordinate axis features in the target image, wherein the coordinate axis features include coordinate axis scale marks and coordinate axis proportional relationships.
[0084] In the present application, data and text in the target image can be recognized by text recognition methods such as OCR recognition to extract coordinate axis scale marks and coordinate axis proportional relationships (i.e., target coordinate values corresponding to each pixel). The target coordinate axis can be a coordinate system composed of an X-axis and a Y-axis.
[0085] S104: Perform curve detection on the target image to determine pixel coordinates of the curve, where the pixel coordinates are used to indicate a position of the curve on the target image.
[0086] In the present application, curve detection is used to extract the curve contour in the image using edge detection and other algorithms, and then automatically identify the curve by extracting the edge points on the curve contour and their pixel coordinates. Among them, the pixel coordinates can be used to identify the position of the pixel corresponding to the curve in the image. Therefore, the present application avoids human errors caused by manual operation by automatically identifying the curve in the image without manually reading the curve or using semi-automatic tools, and significantly improves the accuracy and efficiency of data extraction.
[0087] S105 . Map the pixel coordinates to the target coordinate axis based on the coordinate axis feature, and determine the target coordinates on the curve.
[0088] In this application, based on the proportional relationship of the coordinate axes, the pixel coordinates of the curve in the image are converted into coordinate values in the target coordinate system (i.e., target coordinates), so as to automatically extract discrete coordinate values from the curve, and improve the accuracy and efficiency of data extraction by identifying the coordinate axes and pixel mapping.
[0089] The curve coordinate extraction method provided in the present embodiment improves the image quality by preprocessing the original image having one or more curves, thereby facilitating improving the accuracy of subsequent curve detection and coordinate extraction. Curve detection is performed on the target image to determine the pixel coordinates of the curve, thereby realizing automatic recognition and data extraction. There is no need to manually read the curve or use semi-automatic tools, thus avoiding human errors caused by manual operation and significantly improving the accuracy and efficiency of data extraction. Subsequently, pixel mapping of pixel coordinates on the target coordinate axis is realized by identifying the target coordinate axis in the target image. The method is suitable for extracting discrete coordinates of a variety of complex curves and can effectively improve the efficiency of data extraction.
[0090] In some embodiments, see Figure 2 This embodiment provides an image preprocessing method, that is, step S102 may include but is not limited to steps S201 to S203.
[0091] S201, converting the original image into a grayscale image.
[0092] In this embodiment, the color image is converted into a grayscale image to make the image processing algorithm more efficient. Specifically, by converting the color image into a single-channel grayscale image, the amount of data can be reduced and the edge of the curve can be made more obvious. Exemplarily, the color-to-grayscale formula: Gray = 0.299R + 0.587G + 0.114B can be used for weighted grayscale conversion to ensure that the brightness information is retained, where Gray represents the grayscale value, R represents the red channel value, G represents the green channel value, and B represents the blue channel value. The weight of the red channel can be 0.299, the weight of the green channel can be 0.587, and the weight of the blue channel can be 0.114.
[0093] S202: Perform denoising processing on the grayscale image.
[0094] In this embodiment, the target image may contain background noise (such as grid lines or noise generated by image scanning), and the denoising process is used to improve the recognizability of the curve. Specifically, Gaussian filtering or median filtering can be used to remove noise points in the image while maintaining the edge information of the curve. Among them, Gaussian filtering can smooth the image, while median filtering is good at removing noise.
[0095] S203, performing edge enhancement and binarization processing on the grayscale image after denoising to obtain a target image.
[0096] In this embodiment, in order to ensure that the curve can be accurately identified in the image, the curve contour is highlighted by edge enhancement. Specifically, a convolution kernel is used for edge enhancement, for example, the gradient of the image is calculated by a Sobel operator or a Laplacian operator to highlight the curve portion. Then, a clearer curve contour can be obtained by combining the gradients in the horizontal direction and the vertical direction.
[0097] For the binarization process, the edge-enhanced grayscale image is converted into a binary image to facilitate subsequent curve contour extraction. Exemplarily, an adaptive threshold algorithm (such as Otsu threshold method) is used to automatically determine the optimal threshold according to the image content to effectively separate the curve and the background.
[0098] Therefore, this embodiment effectively improves the image quality through image preprocessing such as graying, noise removal, edge enhancement, and binarization, that is, image noise is removed, and the contour edge of the curve is effectively enhanced, so as to improve the accuracy and efficiency of subsequent curve detection.
[0099] In some embodiments, see Figure 3 This embodiment provides a method for identifying coordinate axes, that is, step S103 may include but is not limited to steps S301 to S303.
[0100] S301, performing image cropping on the target image to obtain a regional image having a coordinate axis region, wherein the coordinate axis region includes a target coordinate axis;
[0101] S302, using a pre-established OCR recognition model to recognize the regional image, and determining a coordinate axis scale mark of the target coordinate axis, wherein the coordinate axis scale mark includes a first scale range of the first coordinate axis and a second scale range of the second coordinate axis;
[0102] S303: Determine a coordinate axis ratio relationship of the target coordinate axis based on the first scale range and the second scale range.
[0103] In this embodiment, the regional image about the target coordinate axis in the target image is extracted by image cropping, so as to reduce interference such as background in the text recognition process and effectively improve the recognition efficiency. Then, the OCR recognition model is used to recognize the numbers and text in the regional image, especially the scale marks of the coordinate axes, that is, the coordinate axis scale marks, such as the scale marks of the first coordinate axis (such as the X-axis) and the scale marks of the second coordinate axis (such as the Y-axis). Further, based on the coordinate axis scale marks (such as the scale range), the minimum and maximum scales of the first coordinate axis and the second coordinate axis that can be identified can be used to calculate the proportional relationship of the coordinate axes (that is, the actual coordinate value corresponding to each pixel).
[0104] Optionally, for a nonlinear scale axis (such as a logarithmic axis), a specific mathematical model may be introduced to perform proportional conversion.
[0105] Therefore, this embodiment identifies the coordinate axes in the image to improve the automation and efficiency of subsequent pixel mapping and coordinate extraction. There is no need to manually read the curve or use semi-automatic tools, which avoids human errors caused by manual operation, significantly improves the accuracy and efficiency of data extraction, and is suitable for scenarios with a variety of complex curves.
[0106] In some embodiments, when the coordinate axis is tilted, twisted, or has perspective deformation, before step S301, the following steps are further included:
[0107] When it is detected that the target coordinate axis on the target image is tilted or distorted, a straight line and a corresponding straight line feature on the target image are detected by Hough transform, and rotation correction is performed on the target image based on the straight line feature, wherein the straight line feature includes a tilt angle;
[0108] Or, when perspective deformation of the target coordinate axis on the target feature is detected, the target image is corrected by perspective transformation.
[0109] In this embodiment, when the target image contains a tilted or distorted coordinate axis, the straight line (representing the coordinate axis) and the straight line features in the image are detected by Hough Transform, and image rotation correction is performed according to the straight line features (such as the tilt angle of the straight line, the degree of distortion, etc.). It should be noted that Hough Transform is a feature extraction technology widely used in image analysis, computer vision and digital image processing. Its basic principle is to detect specific shapes in the image, such as straight lines, circles, etc., by calculating the local maximum of the cumulative results in the parameter space.
[0110] In addition, when the target image contains a perspective-deformed coordinate axis, the target image is corrected by perspective transformation. It should be noted that perspective transformation utilizes the condition that the perspective center, image point, and target point are collinear, and according to the law of perspective rotation, the image receiving surface (perspective surface) is rotated by a certain angle around the trace line (perspective axis), thereby changing the viewing angle and shape of the image. Mathematically, this transformation is implemented through a 3x3 transformation matrix, which acts on each pixel coordinate of the image to perform coordinate mapping transformation. The characteristic of perspective transformation is that a straight line remains a straight line after transformation, but parallel straight lines may intersect after transformation.
[0111] Therefore, this embodiment performs coordinate system correction on tilted or distorted coordinate axes through Hough transform processing, and performs coordinate system correction on coordinate axes with perspective deformation through perspective transformation, thereby improving the accuracy of coordinate axis recognition, being suitable for a variety of complex image scenes, improving the applicability of the method of the present application, and facilitating improving the accuracy of coordinate extraction.
[0112] In some embodiments, see Figure 4 This embodiment provides a curve detection method, that is, step S104 may include but is not limited to steps S401 to S408.
[0113] S401, performing Gaussian smoothing processing on the target image to obtain an image to be detected;
[0114] S402, calculating edge features of each pixel in the image to be detected, wherein the edge features include gradient strength and direction;
[0115] S403, comparing the magnitude of the gradient strength between each pixel point and the adjacent pixel point in the direction thereof, and retaining the pixel point corresponding to the maximum gradient strength in the direction as the target pixel point;
[0116] S404, marking the target pixel point whose gradient intensity is greater than a preset first threshold as a strong edge point;
[0117] S405, marking the target pixel point whose gradient intensity is less than a preset second threshold as a non-edge point, wherein the first threshold is greater than the second threshold;
[0118] S406, marking the target pixel point whose gradient intensity is between the first threshold and the second threshold as a weak edge point;
[0119] S407, connecting the strong edge point and the weak edge point to form a curve profile of the curve in the target image;
[0120] S408: Determine the curve and corresponding pixel coordinates based on the curve profile.
[0121] In this embodiment, the Canny operator (i.e., the Canny edge detection algorithm) is used to perform curve detection on the target image. Specifically, a Gaussian filter is used to perform Gaussian smoothing on the image to reduce image noise and improve the accuracy of subsequent gradient calculations. Subsequently, the Sobel operator can be used to calculate the gradient strength and direction of each pixel in the image, where the gradient strength indicates the strength of the edge, and the direction indicates the direction of the edge.
[0122] Furthermore, non-maximum suppression is performed. Specifically, by comparing the gradient strength of each pixel with its adjacent pixel in the gradient direction, only the pixel with the largest gradient strength in the gradient direction is retained as the target pixel (i.e., edge point), so as to refine the edge and eliminate the blur effect on the edge.
[0123] Furthermore, double threshold processing is performed. Specifically, a first threshold (i.e., a high threshold) and a second threshold (i.e., a low threshold) are set to classify the pixels into three categories: strong edge points, weak edge points, and non-edge points. When the gradient intensity of a pixel is higher than the first threshold, it is classified as a strong edge point. When the gradient intensity of a pixel is lower than the second threshold, it is classified as a non-edge point. When the gradient intensity of a pixel is between the first threshold and the second threshold, it is classified as a weak edge point. Thus, by utilizing the continuity of the edge, the weak edge points are connected by strong edge points to form a complete edge, thereby realizing the extraction of the curve contour of the curve in the image. In this way, the pixel coordinates of the curve are determined by extracting the pixel coordinates of the curve contour.
[0124] Therefore, this embodiment extracts the curve of the image through edge detection, realizes automatic recognition of the curve, and improves the accuracy of curve detection, so as to improve the accuracy and efficiency of coordinate extraction.
[0125] In some embodiments, step S408 may include the following steps:
[0126] When it is detected that there is only one curve in the target image, the pixel coordinates of the edge points on the curve contour are extracted as the pixel coordinates of the curve;
[0127] When it is detected that there are multiple curves in the target image and the target image is a color image, color clustering is performed on the pixel points on the target image, and the pixel points whose pixel value differences are within a preset pixel range are regarded as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image;
[0128] When it is detected that there are multiple curves in the target image and the target image is a black and white image, line features of the target image are extracted, and pixel points whose difference values of the line features are within a preset feature range are regarded as being located on the same curve contour, so as to extract pixel coordinates on each curve contour as pixel coordinates of the corresponding curve, and form curve data of the target image, wherein the line features include line width and / or morphological features, and the morphological features include virtual and real line features;
[0129] The curve data is used to describe the identification of any curve, the curve characteristics of the curve and the pixel coordinates of the curve, and the curve characteristics include at least one of color, pixel value and line characteristics.
[0130] In this embodiment, when there is one curve or multiple curves in the target image, the number of curves in the image is detected, and the pixel coordinates of the curves are extracted accordingly, thereby improving the accuracy of curve recognition and being applicable to scenes with a variety of complex curves.
[0131] For example, see Figure 5 A schematic diagram of a process for extracting pixel coordinates provided for an exemplary embodiment of the present application includes the following steps:
[0132] S501, detecting whether there are multiple curves in the target image;
[0133] S502, when it is detected that there is only one curve in the target image, extracting the pixel coordinates of the edge points on the curve contour as the pixel coordinates of the curve;
[0134] S503, when it is detected that there are multiple curves in the target image, detecting whether the target image is a color image;
[0135] S504, when the target image is a color image, color clustering is performed on the pixel points on the target image, and the pixel points whose pixel value differences are within a preset pixel range are regarded as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image;
[0136] S505. When the target image is a black and white image, the line features of the target image are extracted, and the pixel points whose difference values of the line features are within a preset feature range are regarded as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image.
[0137] In this embodiment, optionally, when there is only one curve in the target image, the pixel coordinates of the curve are determined according to the pixel coordinates of the data points on the curve contour. Optionally, when there are multiple curves in the target image, for the chromaticity image, different curves are distinguished by color segmentation, and then color clustering (such as K-means clustering) is used to treat pixel points with similar pixel values (i.e., the difference in pixel values is within the pixel range) as the same curve. In this way, the pixel coordinates on the contour of each curve are extracted as the pixel coordinates of the curve. For black and white images, different line features (such as dotted lines, solid lines, width, etc.) are used for classification, and the width and morphological features of the lines (continuous lines or dotted lines) are statistically identified to identify different curves, and their coordinate values are extracted respectively. For example, pixels with similar widths can be regarded as being located on the same curve.
[0138] In this embodiment, facing an image of multiple curves, curve data can be generated to describe any curve in the image and the curve name identification, curve characteristics and pixel coordinates of the curve, which is conducive to improving the efficiency of data processing.
[0139] In addition, for complex images, the target detection algorithm in deep learning (such as Mask R-CNN) is used to classify different curves in the image and extract their curve contours and pixel coordinates.
[0140] Therefore, this embodiment realizes recognition processing of a variety of complex curves by distinguishing and analyzing the target image containing one or more curves and extracting the pixel coordinates of the curves accordingly, thereby improving the stability and accuracy of curve recognition.
[0141] In some embodiments, see Figure 6 , this embodiment provides a method for extracting coordinates, that is, step S105 may include but is not limited to steps S601 to S603.
[0142] S601, when it is detected that the curve is discontinuous, determining whether the change rate of the curve is less than a preset change rate threshold;
[0143] S602: when it is detected that the change rate is less than the change rate threshold, linear interpolation is performed through the target coordinates of any two data points on the curve to determine the target coordinates of the data points of the discontinuous part of the curve;
[0144] S603: When it is detected that the change rate is not less than the change rate threshold, the curve is fitted by a preset spline function model to determine the target coordinates of the data points of the discontinuous part on the curve.
[0145] In the present application, illustratively, based on the obtained coordinate axis ratio relationship, a linear mapping is used to convert the pixel coordinates (x, y) of the curve into the target coordinates (X, Y), and the following conversion formula can be used:
[0146] X=X_min+((x-x_min) / (x_max-x_min))*(X_max-X_min)
[0147] Y=Y_min+((y_max-y) / (y_max-y_min))*(Y_max-Y_min)
[0148] Among them, x_min, x_max, y_min, y_max are the pixel positions of the coordinate axes in the image, that is, x_min represents the pixel position of the minimum scale of the X coordinate axis in the image, x_max represents the pixel position of the maximum scale of the X coordinate axis in the image, y_min represents the pixel position of the minimum scale of the Y coordinate axis in the image, and y_max represents the pixel position of the maximum scale of the Y coordinate axis in the image. X_max, X_min, Y_max, and Y_min are the numerical ranges of the target coordinate axes, that is, X_min represents the minimum scale of the X coordinate axis in the image, X_max represents the maximum scale of the X coordinate axis in the image, Y_min represents the minimum scale of the Y coordinate axis in the image, and Y_max represents the maximum scale of the Y coordinate axis in the image.
[0149] In this embodiment, in the case of discontinuous pixels on the curve, in order to improve data accuracy, for a relatively smooth curve (i.e., a curve with a change rate less than a change rate threshold), linear interpolation can be used through known adjacent points. For a curve with a large change (i.e., a change rate not less than a change rate threshold), a spline interpolation method can be used to fit the curve using a spline function.
[0150] Therefore, this embodiment fills in the target coordinates of the data points of the discontinuous part on the curve by linear interpolation or spline interpolation, thereby improving the accuracy of extracting discrete coordinates from the curve.
[0151] In some embodiments, after step S105, the method further includes: using Python's pandas library to save the obtained coordinate values in columns or rows into a CSV or Excel file for further analysis and processing, and saving the data in the target coordinate (X, Y) format. For data of multiple curves, the data can be output separately by curve name or color.
[0152] For example, for a static graph (such as a scientific experiment data graph in PDF or PNG format), the image is first preprocessed to remove noise and grayscale. Then, OCR is used to identify the scale range of the X-axis and Y-axis to determine the proportional relationship of the coordinate axes. Next, an edge detection algorithm is used to identify the curve, and the curve is spline fitted and interpolated, and finally the extracted coordinate values are output as an Excel file.
[0153] For example, for a chart containing multiple curves (such as curves with different colors or line styles), color segmentation technology or deep learning algorithms are used to classify each curve. After each curve is identified separately, the discrete coordinate points are extracted using pixel mapping, and the extracted coordinate values are finally output as an Excel file.
[0154] In some embodiments, during the curve detection and data extraction process, there may be abnormal situations, such as noise points, curve breaks, etc., which need to be processed. In this regard, outliers (such as abnormal peaks in a single curve) are detected by setting a reasonable threshold and removed or corrected. Specifically, outliers are filtered out by a curve smoothing algorithm (Savitzky-Golay filter). In addition, for scenes with high requirements for coordinate extraction accuracy, the accuracy of coordinate extraction is improved by adding interpolation points, increasing image resolution, etc.
[0155] See also Figure 7 The embodiment of the present application further provides a curve coordinate extraction device 700, which can implement the above curve coordinate extraction method, and the device includes:
[0156] An image acquisition module 701 is used to acquire an original image having one or more curves;
[0157] A preprocessing module 702 is used to preprocess the original image to obtain a target image;
[0158] A coordinate axis recognition module 703 is used to recognize a target coordinate axis in the target image and corresponding coordinate axis features, wherein the coordinate axis features include coordinate axis scale marks and coordinate axis ratio relationships;
[0159] A curve detection module 704 is used to perform curve detection on the target image and determine the pixel coordinates of the curve, where the pixel coordinates are used to indicate the position of the curve on the target image;
[0160] The coordinate extraction module 705 is used to map the pixel coordinates to the target coordinate axis based on the coordinate axis feature, and determine the target coordinates on the curve.
[0161] In some embodiments, the pre-processing module 702 includes:
[0162] A grayscale unit, used for converting the original image into a grayscale image;
[0163] A denoising processing unit, used for performing denoising processing on the grayscale image;
[0164] The image enhancement and binarization processing unit is used to perform edge enhancement and binarization processing on the grayscale image after denoising to obtain a target image.
[0165] In some embodiments, the coordinate axis identification module 703 includes:
[0166] An image cropping unit, used for cropping the target image to obtain a regional image having a coordinate axis region, wherein the coordinate axis region includes a target coordinate axis;
[0167] A recognition unit, used to recognize the regional image by using a pre-established OCR recognition model, and determine the coordinate axis scale mark of the target coordinate axis, wherein the coordinate axis scale mark includes a first scale range of the first coordinate axis and a second scale range of the second coordinate axis;
[0168] A coordinate axis ratio relationship calculation unit is used to determine the coordinate axis ratio relationship of the target coordinate axis based on the first scale range and the second scale range.
[0169] In some embodiments, the coordinate axis identification module 703 includes:
[0170] A first coordinate axis correction unit is used to detect a straight line and a corresponding straight line feature on the target image by Hough transform when a target coordinate axis on the target image is detected to be tilted or distorted, and to perform rotation correction on the target image based on the straight line feature, wherein the straight line feature includes a tilt angle;
[0171] The second coordinate axis correction unit is used to correct the target image through perspective transformation when it is detected that the target coordinate axis on the target feature has perspective deformation.
[0172] In some embodiments, the curve detection module 704 includes:
[0173] A smoothing processing unit, used for performing Gaussian smoothing processing on the target image to obtain an image to be detected;
[0174] A gradient calculation unit, used to calculate the edge feature of each pixel in the image to be detected, wherein the edge feature includes gradient strength and direction;
[0175] A non-maximum suppression unit, used to compare the magnitude of the gradient strength between each pixel point and the adjacent pixel points in the direction thereof, and retain the pixel point corresponding to the maximum gradient strength in the direction as the target pixel point;
[0176] A first dual-threshold detection unit, used to identify the target pixel point whose gradient intensity is greater than a preset first threshold as a strong edge point;
[0177] A second dual-threshold detection unit, configured to identify a target pixel point whose gradient intensity is less than a preset second threshold as a non-edge point, wherein the first threshold is greater than the second threshold;
[0178] A third dual-threshold detection unit, configured to identify a target pixel point whose gradient strength is between the first threshold and the second threshold as a weak edge point;
[0179] an edge connection unit, configured to connect the strong edge point with the weak edge point to form a curve profile of the curve in the target image;
[0180] The pixel coordinate extraction unit is used to determine the curve and the corresponding pixel coordinates based on the curve profile.
[0181] In some embodiments, the pixel coordinate extraction unit includes:
[0182] A first curve pixel coordinate extraction unit, configured to extract the pixel coordinates of edge points on the curve contour as the pixel coordinates of the curve when detecting that there is only one curve in the target image;
[0183] A second curve pixel coordinate extraction unit is used to perform color clustering on the pixel points on the target image when it is detected that there are multiple curves in the target image and the target image is a color image, and regard the pixel points whose pixel value differences are within a preset pixel range as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image;
[0184] A third curve pixel coordinate extraction unit is used to extract line features of the target image when it is detected that there are multiple curves in the target image and the target image is a black and white image, and regard the pixel points whose difference of the line features is within a preset feature range as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image, wherein the line features include line width and / or morphological features, and the morphological features include virtual and real line features;
[0185] The curve data is used to describe the identification of any curve, the curve characteristics of the curve and the pixel coordinates of the curve, and the curve characteristics include at least one of color, pixel value and line characteristics.
[0186] In some embodiments, the coordinate extraction module 705 includes:
[0187] A change rate judgment unit, used for judging whether the change rate of the curve is less than a preset change rate threshold value when the curve is detected to be discontinuous;
[0188] a linear interpolation unit, configured to perform linear interpolation through the target coordinates of any two data points on the curve to determine the target coordinates of the data points of the discontinuous part on the curve when detecting that the change rate is less than the change rate threshold;
[0189] The spline interpolation unit is used to fit the curve through a preset spline function model to determine the target coordinates of the data points of the discontinuous part on the curve when it is detected that the change rate is not less than the change rate threshold.
[0190] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.
[0191] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the coordinate extraction method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0192] See also Figure 8 , Figure 8 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0193] The processor 801 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0194] The memory 802 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 802, and the processor 801 calls and executes the coordinate extraction method of the embodiment of this application;
[0195] Input / output interface 803, used to implement information input and output;
[0196] The communication interface 804 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0197] A bus 805 that transmits information between the various components of the device (e.g., the processor 801, the memory 802, the input / output interface 803, and the communication interface 804);
[0198] The processor 801 , the memory 802 , the input / output interface 803 and the communication interface 804 are connected to each other in communication within the device via a bus 805 .
[0199] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the coordinate extraction method of the above-mentioned curve is implemented.
[0200] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0201] The curve coordinate extraction method, device, electronic device and storage medium provided in the embodiments of the present application improve image quality by preprocessing the original image having one or more curves, thereby facilitating improving the accuracy of subsequent curve detection and coordinate extraction, and realize automatic recognition and data extraction by performing curve detection on the target image to determine the pixel coordinates of the curve. There is no need to manually read the curve or use semi-automatic tools, thus avoiding human errors caused by manual operation and significantly improving the accuracy and efficiency of data extraction. Subsequently, pixel mapping of pixel coordinates on the target coordinate axis is realized by identifying the target coordinate axis in the target image. This method is suitable for extracting discrete coordinates of a variety of complex curves and can effectively improve the efficiency of data extraction.
[0202] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0203] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0204] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0205] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0206] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0207] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0208] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0209] The units described above 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 on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0210] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0211] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0212] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for extracting coordinates of a curve, characterized in that: The method comprises: Get an original image with one or more curves; Preprocessing the original image to obtain a target image; Identify a target coordinate axis and corresponding coordinate axis features in the target image, wherein the coordinate axis features include coordinate axis scale marks and coordinate axis proportional relationships; Performing curve detection on the target image to determine pixel coordinates of the curve, where the pixel coordinates are used to indicate a position of the curve on the target image; Based on the coordinate axis feature, the pixel coordinates are mapped to the target coordinate axis to determine the target coordinates on the curve.
2. The method for extracting coordinates of a curve according to claim 1, characterized in that: The preprocessing of the original image to obtain the target image includes: Converting the original image into a grayscale image; Performing denoising on the grayscale image; The denoised grayscale image is subjected to edge enhancement and binarization to obtain the target image.
3. The method for extracting coordinates of a curve according to claim 1 or 2, characterized in that: The identifying the target coordinate axis and the corresponding coordinate axis features in the target image includes: Performing image cropping on the target image to obtain a regional image having a coordinate axis region, wherein the coordinate axis region includes the target coordinate axis; Recognize the regional image using a pre-established OCR recognition model to determine the coordinate axis scale mark of the target coordinate axis, wherein the coordinate axis scale mark includes a first scale range of the first coordinate axis and a second scale range of the second coordinate axis; Based on the first scale range and the second scale range, a coordinate axis ratio relationship of the target coordinate axis is determined.
4. The method for extracting coordinates of a curve according to claim 3, characterized in that: Before cropping the target image to obtain a regional image having a coordinate axis region, the method includes: When it is detected that the target coordinate axis on the target image is tilted or distorted, a straight line and a corresponding straight line feature on the target image are detected by Hough transform, and rotation correction is performed on the target image based on the straight line feature, wherein the straight line feature includes a tilt angle; Or, when perspective deformation of the target coordinate axis on the target feature is detected, the target image is corrected by perspective transformation.
5. The method for extracting coordinates of a curve according to claim 3, characterized in that: The performing curve detection on the target image to determine the pixel coordinates of the curve includes: Performing Gaussian smoothing on the target image to obtain an image to be detected; Calculating edge features of each pixel in the image to be detected, wherein the edge features include gradient strength and direction; Compare the magnitude of the gradient strength between each pixel point and the adjacent pixel point in the direction thereof, and retain the pixel point corresponding to the maximum gradient strength in the direction as the target pixel point; Marking the target pixel point whose gradient intensity is greater than a preset first threshold as a strong edge point; Marking a target pixel point whose gradient intensity is less than a preset second threshold as a non-edge point, wherein the first threshold is greater than the second threshold; Marking a target pixel point whose gradient intensity is between the first threshold and the second threshold as a weak edge point; Connecting the strong edge points with the weak edge points to form a curve profile of a curve in the target image; Based on the curve profile, the curve and corresponding pixel coordinates are determined.
6. The method for extracting coordinates of a curve according to claim 5, characterized in that: The determining the curve and the corresponding pixel coordinates based on the curve profile includes: When it is detected that there is only one curve in the target image, the pixel coordinates of the edge points on the curve contour are extracted as the pixel coordinates of the curve; When it is detected that there are multiple curves in the target image and the target image is a color image, color clustering is performed on the pixel points on the target image, and the pixel points whose pixel value differences are within a preset pixel range are regarded as being located on the same curve contour, so as to extract the pixel coordinates on each curve contour as the pixel coordinates of the corresponding curve, and form the curve data of the target image; When it is detected that there are multiple curves in the target image and the target image is a black and white image, line features of the target image are extracted, and pixel points whose difference values of the line features are within a preset feature range are regarded as being located on the same curve contour, so as to extract pixel coordinates on each curve contour as pixel coordinates of the corresponding curve, and form curve data of the target image, wherein the line features include line width and / or morphological features, and the morphological features include virtual and real line features; The curve data is used to describe the identification of any curve, the curve characteristics of the curve and the pixel coordinates of the curve, and the curve characteristics include at least one of color, pixel value and line characteristics.
7. The method for extracting coordinates of a curve according to claim 6, characterized in that: The step of mapping the pixel coordinates to the target coordinate axis based on the coordinate axis feature to determine the target coordinates on the curve includes: When the curve is detected to be discontinuous, determining whether the change rate of the curve is less than a preset change rate threshold; When it is detected that the change rate is less than the change rate threshold, linear interpolation is performed through the target coordinates of any two data points on the curve to determine the target coordinates of the data points of the discontinuous part of the curve; When it is detected that the change rate is not less than the change rate threshold, the curve is fitted by a preset spline function model to determine the target coordinates of the data points of the discontinuous part on the curve.
8. A device for extracting coordinates of a curve, characterized in that: include: An image acquisition module, used for acquiring an original image having one or more curves; A preprocessing module, used for preprocessing the original image to obtain a target image; A coordinate axis recognition module, used to recognize a target coordinate axis in the target image and corresponding coordinate axis features, wherein the coordinate axis features include coordinate axis scale marks and coordinate axis proportional relationships; A curve detection module, used to perform curve detection on the target image and determine the pixel coordinates of the curve, wherein the pixel coordinates are used to indicate the position of the curve on the target image; A coordinate extraction module is used to map the pixel coordinates to the target coordinate axis based on the coordinate axis feature, and determine the target coordinates on the curve.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the coordinate extraction method of a curve according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the coordinate extraction method of a curve according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Circular center detection method based on Gaussian fitting sub-pixel edge detection and improved RANSAC algorithm
CN108986126A
Color curve bitmap vectorization method, computer equipment and storage medium
CN110874846A
Lane line fitting method and device and computer readable storage medium
CN114882145A
Fold line / curve data extraction system and method based on image processing
CN114998428A
Curve data extraction method and device, computer equipment and storage medium
CN116152844A
Cited By
Water turbine operation characteristic curve data extraction method
CN121564372A
A method for extracting data of operation characteristic curve of a hydraulic turbine
CN121564372B