Next Article in Journal
RA-XTNet: A Novel CNN Model to Predict Rheumatoid Arthritis from Hand Radiographs and Thermal Images: A Comparison with CNN Transformer and Quantum Computing
Previous Article in Journal
Genetics, Pathophysiology, and Current Challenges in Von Hippel–Lindau Disease Therapeutics
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Paper-Recorded ECG Digitization Method with Automatic Reference Voltage Selection for Telemonitoring and Diagnosis

1
School of Advanced Manufacturing, Fuzhou University, Quanzhou 362200, China
2
The Department of Microelectronics, College of Physics and Information Engineering, Fuzhou University, Fuzhou 350108, China
3
College of Biological Science and Engineering, Fuzhou University, Fuzhou 350108, China
4
Department of Electronic Engineering, Feng Chia University, Taichung 40724, Taiwan
5
Department of Electronic Engineering, National Cheng Kung University, Tainan 70101, Taiwan
6
The Department of Electronic Engineering, Chung Yuan Christian University, Taoyuan 32023, Taiwan
7
The Department of Information Systems and Computer Science, Ateneo de Manila University, Quezon City 1108, Philippines
*
Authors to whom correspondence should be addressed.
Diagnostics 2024, 14(17), 1910; https://doi.org/10.3390/diagnostics14171910
Submission received: 23 July 2024 / Revised: 24 August 2024 / Accepted: 26 August 2024 / Published: 29 August 2024
(This article belongs to the Special Issue Recent Advances in Cardiac Imaging: 2024)

Abstract

:
In electrocardiograms (ECGs), multiple forms of encryption and preservation formats create difficulties for data sharing and retrospective disease analysis. Additionally, photography and storage using mobile devices are convenient, but the images acquired contain different noise interferences. To address this problem, a suite of novel methodologies was proposed for converting paper-recorded ECGs into digital data. Firstly, this study ingeniously removed gridlines by utilizing the Hue Saturation Value (HSV) spatial properties of ECGs. Moreover, this study introduced an innovative adaptive local thresholding method with high robustness for foreground–background separation. Subsequently, an algorithm for the automatic recognition of calibration square waves was proposed to ensure consistency in amplitude, rather than solely in shape, for digital signals. The original signal reconstruction algorithm was validated with the MIT–BIH and PTB databases by comparing the difference between the reconstructed and the original signals. Moreover, the mean of the Pearson correlation coefficient was 0.97 and 0.98, respectively, while the mean absolute errors were 0.324 and 0.241, respectively. The method proposed in this study converts paper-recorded ECGs into a digital format, enabling direct analysis using software. Automated techniques for acquiring and restoring ECG reference voltages enhance the reconstruction accuracy. This innovative approach facilitates data storage, medical communication, and remote ECG analysis, and minimizes errors in remote diagnosis.

1. Introduction

Cardiovascular diseases (CVD), which have surpassed the mortality rate of cancer, tend to affect the younger population and have become a huge social burden [1,2]. Given the inevitable uneven distribution of medical resources, a contradiction exists between the scarcity of high-quality physician resources in underdeveloped areas and the overburdened medical capacity in densely populated areas; this phenomenon is reflected in the remarkably high proportion of CVD mortality in less developed areas [3,4,5].
Electrocardiogram (ECG), as a non-invasive approach, is extensively utilized in the diagnosis of cardiovascular diseases [6]. With the penetration of the internet and the advancement of artificial intelligence algorithms, a significant number of researchers have focused on developing algorithms for the diagnosis of cardiovascular diseases based on ECGs, including arrhythmia classification [7,8,9,10], atrial fibrillation detection [11,12], and myocardial infarction detection [13,14,15]. The development of intelligent diagnostic algorithms based on ECGs has, to some extent, enhanced the accuracy of electrocardiographic diagnoses and alleviated the issue of the uneven distribution of medical resources. Furthermore, many researchers are exploring other applications of ECGs, such as biometric identification [16,17,18] and emotion recognition [19,20,21]. Fundamentally, such research requires huge numerical data records with manual labels.
However, the difference in the storage mode of ECG data makes it difficult to ensure high data utilization. The lack of easily available ECG data for research purposes is still a common problem [22]. Tracing back to the source, the uneven allocation of resources and the encryption of patient data lead to the failure of forming a unified communicable ECG storage format, which further leads to the contradiction between the increasingly perfect ECG diagnosis algorithm and the clinical needs of patients. Clinically, most doctors rely on special analysis software that can import the collected electronic documents of patients’ physiological signals to make a diagnosis efficiently and accurately. By contrast, in most cases of data storage systems of community medical institutions and large public hospitals, only medical explanations or at most raster images storing ECG waveforms are retained unless some ECG management systems exist [23,24]. In addition, the degree of information sharing and recognition among hospitals remains in doubt because the archiving of source data information distributed in hospitals in different regions is often scattered in several systems rather than transmitted to the central electronic medical record system.
Paper-recorded ECGs, which are used for data exchange and individual retrospective analysis, remain the main storage form for patients to keep records of their case. Under the premise of obtaining the authorization of patients, paper ECG waveforms must be converted into one-dimensional digital signals and stored as electronic files for the establishment of specific databases and individual risk assessments of long-term heart disease. A method of digitizing paper ECGs, which can be regarded as a bridge for data sharing, is expected. At the same time, patients can also better store the digitized ECG data for long-term use of ECG records in different hospitals, therefore avoiding the problem that the original sampling data cannot be circulated due to encryption.
Many scholars have found a suitable digital method and obtained relevant research results, in which optical scanning is the first representative digital method [25,26,27,28]. Lobodzinski et al. [25] used optical scanning to acquire textual information and waveform images on paper ECGs. Mitra et al. [26] used a flatbed scanner to form an image database of each 12-lead ECG signal. Karsikas et al. [27] used an optical flatbed scanner to digitize the data on paper, and set a threshold to remove the red grid lines from the paper data. Ravichandran et al. [28] used a scanner to digitize paper data and used OCR technology to extract patient-related information from paper ECGs. In recent years, research in this field has been extended to more dimensions [29,30,31]. Hao et al. [29] used a machine learning method to classify diseases from paper ECGs, which can avoid the problem of the original ECG data being difficult to obtain. Kavak et al. [30] used a convolutional neural network to obtain the characteristic information of ECG signals from paper ECGs and complete the location of myocardial infarction. In these methods, standard image data can be obtained by scanning, which can solve the issue of the recognition of some cardiovascular diseases.
However, methods based on optical scanning images are limited by the scanning equipment available, which hinders their widespread application among a large patient population. With the expansion of image sensor areas and advancements in fidelity, cameras embedded in mobile devices now ensure a high degree of digital image restoration. Capturing ECG images using cameras has thus become a more convenient approach, though it also introduces additional challenges in the digitization process.
To convert an ECG image from cameras into amplitude signal data, the process primarily involves three aspects: image distortion correction, binarization, and the digitization of ECG curves [32,33].
In research into distortion correction, Math et al. [34] used Hough transform to calculate the tilt angle of the plane. This method is limited to the tilt correction of the plane image and cannot correct the distortion of the three-dimensional space. For binarization, the methods proposed by different scholars on gridline removal are nearly all based on thresholding [26,28,29,34]. For the digitization of ECG curves, Li et al. [35] proposed a method of converting printed ECG data into digital ECG signals. In this study, for different paper ECGs, we need to redetermine the voltage and time corresponding to the pixel value. However, in recent research into digitization algorithms, almost no one has looked for or attached importance to a suitable reference to ensure the effectiveness of the amplitude voltage [32]. In other words, the current research [35,36,37,38] can only ensure the similarity of the waveform shape, but not the amplitude consistency of the recovered one-dimensional signal.
The contributions of the algorithm proposed in this study can be summarized as the following points:
  • This study departs from the traditional approach of digitizing ECG data based on optical scanning images, instead utilizing more readily accessible camera images for the digitization of ECG data;
  • We have observed the distinctive characteristic of ECGs within the Hue Saturation Value (HSV) color space and have adeptly applied it to the removal of grid lines;
  • The integration of gamma transformation with the OTSU algorithm [39] is introduced, and an innovative adaptive local thresholding algorithm is proposed for the extraction of ECG curves with enhanced precision;
  • An innovative algorithm for the automatic recognition of calibration square waves is proposed to ensure amplitude consistency in the restored signals, rather than merely morphological similarity;
  • The results based on the MIT-BIH normal sinus rhythm database and PTB diagnostic ECG database demonstrate that the proposed method has a higher correlation coefficient than most other methods and can recover the original sampling data perfectly. This algorithm can provide a standard and low-noise input for remote monitoring and diagnosis based on deep learning technology.
The remainder of this paper is organized as follows: Section 2 describes the method of denoising a paper ECG and reconstructing it into the original ECG sampling signal; the evaluation of the experiment results of the reconstruction algorithm and discussion are set out in Section 3; and finally, Section 4 concludes this study.

2. Materials and Methods

The scheme of the proposed system is shown in Figure 1. This chapter is divided into three research priorities: In the first part, the use of a projection distortion correction algorithm for digital ECG images is proposed with the goal of identifying the four vertices of the ECG waveform from the complex background. The flattened image without geometric distortion is obtained by combining the four coordinates with perspective transformation. Secondly, a targeted improvement of the Otsu algorithm and a postprocessing algorithm are designed to obtain the ECG curve information. This method can effectively solve the problem caused by uneven illumination and considerably improve the success rate of separation in real scenes. After the correct binarization of the image, in the third part, a robust algorithm for converting multi-lead curve 2D images to 1D time-series data is proposed. In this algorithm, the benchmark information is obtained automatically. In contrast to the current research, a novel conversion benchmark is introduced in the digital phase, thereby significantly improving the conversion accuracy.

2.1. Adaptive Location and Distortion Correction of ECG

To preprocess the image, it needs resized to 800 px × 600 px and filtered with a Gaussian filter to reduce noise. The edges within the image were detected using the Canny algorithm [40]. Firstly, the gradient magnitude and direction at each point in the image were computed using the Sobel operator, as described by the following equations:
G x = 1 0 1 2 0 2 1 0 1 A ,
G y = 1 2 1 0 0 0 1 2 1 A ,
where A denotes the original image. The horizontal and vertical gradients at each point in the image are represented by G x and G y , respectively. Consequently, the gradient magnitude (i.e., edge strength) and gradient direction (i.e., edge orientation) can be determined as follows:
G = G x 2 + G y 2 ,
α = arctan G y G x .
Based on the angle α , the edge directions in the image are categorized into eight discrete directions: 0, 45, 90, 135, 180, 225, 270, and 315 degrees, which correspond to the vertical, horizontal, and diagonal directions. Among neighboring points with the same edge direction, only the points with the maximum edge strength are retained.
Subsequently, the low and high threshold parameters are set to 100 and 200, respectively, to determine whether each point is a true edge. Points with an edge strength exceeding the high threshold are considered strong edge points and are preserved. Points with edge strength below the low threshold are deemed non-edge points and are discarded. Points with an edge strength between the low and high thresholds are retained as strong edge points if they are connected to any strong edge points; otherwise, they are discarded. Through these steps, the edges of the image are delineated.
Based on the candidate edges, the Hough Transform algorithm [41] is employed for line detection. A line in the image space (i.e., Cartesian coordinate system) can be uniquely determined by a pair ( r ,   θ ) and is represented as:
y = cos θ sin θ x + r sin θ .
For any point ( x 1 ,   y 1 ) , there is a corresponding curve in the parameter space (i.e., polar coordinate system) given by:
r = x 1 cos θ + y 1 sin θ .
If two points lie on the same straight line, their corresponding curves in the parameter space will converge to a single point   ( r ,   θ ) . The greater the number of points intersecting at the point r ,   θ , the more points there are in the image space that lie on the straight line determined by r ,   θ . In addition, the θ is evenly divided into 180 intervals. As long as the value θ 1 of the intersection point ( r 1 , θ 1 ) of the curves falls within the interval θ a , θ a + π 180 , the points in the image space corresponding to the curves in the parameter space are considered to lie on the same straight line. Furthermore, only when more than 100 edge points intersect in the parameter space are these edge points determined to lie on a single straight line. Moreover, the number of intersection points corresponds to the length of the straight edge. The shorter edge other than the two edges with consistent orientation will be removed. The orientation is judged by the cosine of the angle between the straight lines as a standard, as expressed in the formula:
cos l 1 , l 2 = x 1 x 2 + y 1 y 2 x 1 2 + y 1 2 x 2 2 + y 2 2 .
If the cosine value exceeds 0.85 (i.e., corresponding to an angle of 31.79°), the two lines are deemed to have a consistent orientation. Given that ECG images are approximately rectangular, our goal was to extract the outer vertical and horizontal edges of the ECG image, and any other candidate edges aligned with these needed be removed. Additionally, the edge lines inside the ECG image are mostly parallel to the edges of the ECG. We conducted an experiment involving 20 participants, each capturing 20 images of ECGs from different environments and angles. Our statistical analysis revealed that almost all lines originating from the background formed angles less than 20° (i.e., corresponding to a cosine similarity of 0.94) with the ECG edges. To further enhance the robustness of the proposed algorithm, the cosine value threshold of 0.85 was determined.
Finally, to avoid comparing ECG edges with the same direction (i.e., vertical or horizontal), we divided the image into four comparison regions, namely, top, bottom, left, and right, based on the center of the image. In each region, we determined one final edge, which corresponds to the ECG edge. The intersections of these edge lines were then used to determine the four vertices: bottom-left, top-left, bottom-right, and top-right.
The current detected coordinate position is not the actual vertex position of the original image due to the resizing step in the preprocessing stage. Thus, the four coordinates are converted to the percentage position coordinates in the image and then remapped to the original image so that the original coordinates are finally calculated.
The four two-dimensional coordinate vertices are first introduced and mapped to a three-dimensional space; these vertices are expressed in mathematical formulas as follows:
x ,   y ,   w = u ,   v , 1 a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 = u ,   v , 1 A .
The 3 × 3 matrix mentioned above A is the perspective transformation matrix, ( u , v ) is the original two-dimensional plane coordinates, and ( x   , y , w ) is the coordinates mapped to the three-dimensional space. The coordinates after the perspective transformation are:
x = x w = a 11 u + a 21 v + a 31 a 13 u + a 23 v + a 33 ,
y = y w = a 12 u + a 22 v + a 32 a 13 u + a 23 v + a 33 .
Therefore, based on the coordinates of the four vertices, the perspective transformation matrix can be computed, which subsequently allows for the determination of the coordinates ( x , y ) on the two-dimensional plane. One of the advantages of this algorithm is that it can automatically calculate the correct aspect ratio of the corrected image.

2.2. ECG Curve Extraction Algorithm

The focus of this section is on how to separate the curve of the ECG from the image. The aim is to retain the effective original ECG information, including the ECG waveform curves and ECG lead markers while filtering out the background grid and other text records which are significant data to which doctors refer for their diagnoses. The challenges of this lie in the noise caused by uneven illumination, color deviation, and noise in real scenes which constitute the main discussion of this section.
The success of the image separation algorithm depends on the selection of the threshold value. However, after analyzing the histogram after directly graying the red–green–blue (RGB) color mode image in the same scale, the gray difference between the curve and the background grid is not evident, which may lead to the failure of separation caused by many meshes or noises. The color adjustment layer added before the curve extraction in this section focuses on widening the difference between the curve and the grid. The algorithm introduces the use of the hue saturation value (HSV) color space transformation to realize the enhancement algorithm that can adjust the saturation of the specified hue. Compared with adjusting the values directly in the RGB space, one of the advantages of adjusting the values in the HSV color space is that the distribution range of colors can be quantified concretely. In addition, the RGB space is in a color space with significant adjustment limitation because it consists of three discrete channels.
The hue and saturate channels in the HSV color space are used in the proposed algorithm. The lower and upper limits of the hue channel range are 0° and 180°, respectively, which are connected end-to-end in a ring. The ECG images confirm that the red grid to be adjusted corresponds to the hue channel between the [156, 180] and [0, 10] intervals [42] in which all points would be identified. To remove the grid, pixels with hue values within the interval can be converted to white by setting their saturation to zero. The completed process is illustrated in Figure 2.
It is important to note that the hue channel range [156, 180] and [0, 10] specified is tailored for red grids, which are the most common grid color in ECG images. If the grid is of a different color, the hue channel range should be adjusted accordingly. For example, blue grids correspond to a hue range of [100, 124].
To further isolate the electrocardiographic curve from the image, this study proposed an improved OTSU algorithm. The OTSU algorithm automatically determines the optimal threshold value by maximizing the between-class variance, which simplifies the thresholding process and eliminates the need for manual intervention [39]. It has been widely adopted in various fields [43,44,45].
Assuming an image of size   M × N with an optimal binarization threshold T that divides the image into foreground and background regions. The number of pixels in the foreground and background is N 0   and N 1 , respectively, with proportions of ω 0 and ω 1   (i.e., 1 ω 0 ) relative to the entire image. The mean grayscale values of the foreground and background are μ 0 and μ 1 , respectively. Additionally, the mean grayscale value of the entire image is μ , which can be expressed as:
μ = μ 0 × N 0 + μ 1 × N 1 M × N = μ 0 ω 0 + μ 1 ω 1 .
The between-class variance of the background and foreground, which is the critical component of the OTSU algorithm, is computed using the following formula:
σ 2 = ω 0 μ 0 μ 2 + ω 1 μ 1 μ 2 .
Alternatively, it can be expressed as:
σ 2 = ω 0 ω 1 μ 0 μ 1 2 .
The larger the between-class variance, the greater the difference in gray-level distributions between the foreground and background. The OTSU algorithm iterates through each value from 0 to 255, treating each as a potential threshold to calculate the between-class variance. It ultimately outputs a threshold that maximizes the between-class variance. This threshold is regarded as the optimal threshold to separate the foreground from the background.
However, the traditional OTSU algorithm is not suitable for ECG images obtained through cameras due to its global thresholding approach, which assumes a uniform distribution of pixel intensities. To overcome this limitation, the proposed algorithm divides the image into 4 × 4 equal parts and applies a gamma transform [46] to stretch the low-gray region and compress the high-gray region.
The gray value range of most real images is analyzed, after which a conclusion is drawn. No very low or very high gray value is found in the real image, and its concentration range is in the middle and low gray areas. Such concentrated gray distribution can easily lead to the reduction of fault tolerance of the segmentation threshold. Stretching the peak position of the foreground and background classes is one approach to improve this method. Therefore, the algorithm adds a gamma transform before binarization to achieve a nonlinear grayscale transformation. The transformation can be summarized as follows:
g o u t = A g i n γ ,
where A is utilized to adjust the overall brightness of the output image. The value γ used in this study is 0.8.
Among them, g i n and g o u t are the input and output gray values and g i n with the range in [0, 1]. After the normalization of the gray matrix, the gamma transform is conducted, and the gray matrix is remapped into a new grayscale matrix. Finally, 16 image segments are processed using the OTSU algorithm to obtain local threshold values T1–T16, as shown in Figure 3. After each region has been independently binarized, the resulting binary images are stitched to produce a complete binarized ECG image.
Following the binarization process, the regions within the image that possess a grayscale value of 0 correspond to the electrocardiographic curve. In addition, the skeleton thinning algorithm [47] is used to refine the curve to 1 pixel.

2.3. The Digitization of ECG Curve

Column-wise scanning is employed to extract the curve information, resulting in a two-dimensional array A r r   that records the coordinate positions of each point on the ECG curve.
Due to ECG signals being output in a specific layout format, the ECG signal of each lead has a fixed position on the ECG report sheet, making it feasible to predefine the coordinates for extraction. In the ECG sheet, it is divided into six leads on the left-half plane (i.e., I, II, III, aVR, aVL, aVF) and six leads on the right-half plane (i.e., V1, V2, V3, V4, V5, V6) which is separated by a vertical line in the middle of the signal, and an additional II-lead at the bottom. Since the acquisition time is fixed (e.g., 5 s for each lead), the complete segment of the signal was reconstructed and subsequently allocated to the respective leads. To avoid data confusion, a small portion of data (i.e., only 0.1 s) at the critical boundary position was discarded.
Additionally, our strategy involves scanning from bottom to top in columns. Text labels are positioned above the effective ECG curves, ensuring that the first detected valid point is from the ECG curve rather than the text label.
The array contains two main parts: the reference square wave signal and the ECG signal. The former is used as the reference source for the latter to convert into the original ECG amplitude sequence. This study employs a second-order Butterworth high-pass filter with a cutoff frequency of 100 Hz to identify the square wave components within the signal. The frequency range of ECG signals is approximately 0.05–100 Hz. Consequently, after applying a high-pass filter with a cutoff frequency of 100 Hz, the ECG signal is significantly suppressed, while the higher frequency signal at the transitions of square waves is retained, as illustrated in Figure 4b. For a square wave with a high level of 1 mV, the waveform produced after high-pass filtering exhibits a peak amplitude of about 0.25 mV. By taking the absolute value of the filtered signal and setting amplitudes below 0.2 mV to zero, the signal depicted in Figure 4c was obtained. Moreover, the peaks of this signal coincide with the transition points of the square wave levels. The durations of the high level and the low level in the square wave are equal. Therefore, according to the high-level width of the square wave, the starting recording point of the physiological data is at the end point of the square wave signal. Ultimately, an ECG signal data, denoted as D a t , can be acquired subsequent to the exclusion of the square wave component from the array A r r .
It is important to note that due to variations in image resolution, both the high level of the square wave and the peak amplitude of the filtered waveform will be proportionally scaled. Consequently, the threshold for peak detection must be adjusted accordingly.
The position and significance of the key points of the square wave and the signal are illustrated in Figure 5. The most important information from a square wave is the difference between its high-level and low-level voltage coordinates in the image. It represents the actual recorded standard voltage difference of 1 mV (the sensitivity is ×1 level), and the value of this ordinate difference is also in effect equal to the abscissa width of the sampling duration of 0.4 s (the paper speed is 25 mm/s). Should there be an alteration in the sensitivity of the calibration square wave or the paper speed of the electrocardiogram, it is imperative that the corresponding computational formulas be scaled proportionately.
Thus, the amplitude conversion ratio θ between the Y-axis pixel and the actual voltage amplitude of the image and the sampling conversion ratio β between the X-axis pixel and the actual sampling time length can be calculated as:
θ = 1 Δ   mV / pixel ,
β = 0.4 Δ   s / pixel ,
Δ = y h i g h y l o w ,
where y h i g h and y l o w   denote, respectively, the ordinate values corresponding to the high and low voltage levels of the square wave. Additionally, the abscissa value at the initial point of the signal is designated as   x b e g i n , and the amplitude of the signal at the low voltage points of the square wave is recorded as 0 mV.
Subsequently, the coordinate values,   x i and y i , within D a t   can be iteratively converted into actual ECG signal amplitudes using the following formula:
y i = θ y i y l o w ,
x i = β x i x b e g i n .
The Y-axis direction of the image coordinate system is vertical and downward, which is opposite to the direction of the voltage amplitude from low to high. Thus, the number of the result as the actual voltage should be opposite.
Finally, Table 1 summarizes the steps and parameters of the proposed approach.

3. Results and Discussion

3.1. Results for Image Distortion Correction

The algorithm tests the effect of distortion correction in different shooting environments and backgrounds and selects a representative to show the effect of the algorithm from Figure 6a–c. In Figure 6a, the algorithm takes the images taken in the monotonous environment as the extraction object. The example in this shooting scene can be used as the embodiment of the performance of the correction algorithm in the general background. Figure 6b shows an ECG drawing immersed in a pure white background, which may result in a lack of edge detection. However, the algorithm in this study also corrects the drawing well. Figure 6c is used as the verification of ECG drawing interception and correction under a complex background. The outer outline of the drawing is connected to many invalid edges and some of the edges are connected to the white part of the background, leading to redundancy or missing contours. Nevertheless, the algorithm still accurately identifies the four vertices of the drawing and corrects them, thereby demonstrating the robustness of the core vertex search algorithm.
Combining the experiments, this study obtained the following conclusions: Unless under extreme shooting conditions, the algorithm can identify well the ECG thermal paper in a scene where the overall brightness of the image is dim or bright. The accuracy of the data after distortion correction is still a content of quantitative analysis in the experiment, which makes a more detailed analysis and a more quantitative conclusion in the third section of this chapter.

3.2. Results for ECG Image Binarization

Figure 7 and Figure 8 show that the original images captured by mobile devices in four different cases are used as experimental objects for the extraction of representative curve images in a specific environment. In the group picture in Figure 7a, a multi-lead ECG has a bad effect under the binarization method of the global threshold because the foreground is too close to the background after it is grayed out. This situation becomes even more evident in the single-lead ECG of the group picture in Figure 7b. Nevertheless, this problem can be easily solved by the algorithm proposed in this study because the algorithm itself can stretch the relative difference between the curve and the other parts.
In addition, Figure 7b and Figure 8a show that the image loses information due to having a weak or strong uneven light distribution after binarization. The phenomenon of image loss in Figure 8a is the most serious case since it was specially photographed in an environment with uneven light. The algorithm proposed in this study, which is capable of independently obtaining local separation thresholds for both high-brightness and low-brightness regions in images, can correctly extract the curves in the inhomogeneous illumination image shown in Figure 8a. Figure 8b is a special group because it is part of the complete 10 s clinical ECG thermal paper captured by the mobile phone after distortion correction. The result after OTSU with global threshold processing had many background grids that were mistakenly regarded as part of the ECG curve, which is disastrous for subsequent digitization algorithms. The proposed algorithm can effectively extract the correct and complete multi-lead ECG curve with a pure background.
The performance of the above experimental results can prove that the binarization algorithm in this study is a robust and effective algorithm for ECG curve extraction in real scenes and is regarded as a key link in the digitization of ECG signals.

3.3. Results for ECG Image Digitization

To verify the general applicability of the algorithm, the MIT-BIH Normal Sinus Rhythm Database [48] and PTB Diagnostic ECG Database [48,49] were selected as the source of the test dataset, and the data were printed into paper ECG according to the hospital ECG format. From the MIT-BIH Normal Sinus Rhythm Database, we took 15 records, for which the sample rate is 128 Hz. From the PTB Diagnostic ECG Database, we selected data according to different cardiovascular disease categories, and we selected 4–5 records for each type of disease from different patients randomly. In this database, the sample rate is 1000 Hz. For each record, we randomly intercepted 10 s of data for the experiment.
Given that the original sampling data of ECG paper are usually archived as an electronic version, the original physiological signals cannot be verified. Therefore, we simulated the entire digitization process including printing the original data on paper to measure the performance of our digital algorithm. The overall design is presented in Figure 9. The validation process can be divided into three stages. In the first part of the test set preparation, a reference square wave generator is designed to have the ECG to print the raw data into a realistic common ECG data pattern. The difference between the high and low level of the generator is 1 mV. Given that the width of the square wave does not contain the reference information, its width is designed as 0.2 s. In the second module, the generated square wave signal and the original ECG signal are concatenated and traced on paper. Moreover, ECG images captured by a camera are reconstructed into digital signals using the algorithm proposed in this study. Finally, the reconstructed signal is compared to the original signal, and a correlation analysis is conducted.
Figure 10 shows a sample comparison of waveforms which intuitively show the actual difference between the recover signal represented by the purple dashed line and the original signal represented by the pink line. The difference between the two is hardly noticeable and the consistency is high.
To quantify this difference further, the time-lagged cross-correlation method with the Pearson coefficient as the correlation coefficient is introduced as the correlation verification method. If the elements of original signal and recovered signal are named x and y , then the Pearson coefficient R is expressed as:
r = i = 1 n x i x ¯ y i y ¯ i = 1 n x i x ¯ 2 i = 1 n y i y ¯ 2 ,
where n is the sequence length, i represents the element in the data sequence, and x ¯ and y ¯ denote the average values.
The ECG Pearson correlation coefficients are listed in Table 2 and Table 3. The overall mean timing similarity reaches 0.97 and 0.98, which implies an excellent performance for the ultralong original ECG sequence and stable performance on different data sets. Additionally, the mean absolute error (MAE) metric was used to quantify the similarity, with the average MAE values for the MIT-BIH Arrhythmia Database and the PTB Diagnostic ECG Database being 0.0324 and 0.0241, respectively. This error corresponds to approximately one-third or one-fourth of a small grid (1 mm × 1 mm) on an ECG.
Table 4 lists a comparison of the correlation values of the current research with those in other literature. The proposed algorithm is better than the results in most of the literature. All the above analysis data indicate that our digitization method is a data reconstruction algorithm with a high degree of recovery and minimal fluctuation of timing and amplitude.
Based on the aforementioned experiments and results, it is evident that the proposed digitization algorithm for paper-based ECGs demonstrates high robustness and accuracy. This advancement facilitates the integration of state-of-the-art intelligent diagnostic algorithms into paper-based ECGs, while also offering new methods for the storage and integration of valuable ECG data.
While our approach has demonstrated outstanding performance in digitizing paper-recorded ECGs, several limitations remain to be addressed. Firstly, the processes of image distortion correction and binarization still partially depend on the quality of the captured photographs. In general, photographs taken in bright, evenly lit, and unobstructed environments are more amenable to image correction and binarization, ultimately yielding better digitized ECG signals compared to those taken in dim or unevenly lit conditions. Additionally, the algorithm requires prior determination of the positions of each lead signal within the ECG image, which is necessary for image segmentation to individually recover each lead’s information. Although the positions of each lead produced in each hospital are typically consistent, we aim to investigate more robust methods in the future to automatically determine the positions of each lead signal in the image, thereby accommodating a wider variety of ECG images.

4. Conclusions

This study aimed to convert paper-based records of ECG curves into digital signals to provide standardized, low-noise inputs for remote monitoring and diagnostic systems based on deep learning technology. For the image quality, the study conducted research considering the main concerns and proposing more suitable techniques such as image distortion correction, an image separation algorithm of pure curve, 1D data extraction, and original data reconstruction. The improved Otsu algorithm was used to effectively separate the ECG waveform from the complex background. In the process of digital transformation, an algorithm for the automatic extraction of benchmark information was proposed. This algorithm can greatly improve the accuracy of the ECG waveform conversion. The entire algorithm was validated on the MIT-BIH database and the PTB database and the results were compared in terms of the two aspects of overall sequence validity and physiological data reconstruction analysis. For the correlation analysis of the entire sequence, an average Pearson coefficient of 0.975 was still obtained. Given the results above, the overall reconstruction algorithm achieved high accuracy and robustness.

Author Contributions

L.-H.W.: Funding acquisition, Resources, Formal analysis, Writing—review & editing, Project administration, Software, Supervision, Validation, Investigation; C.-X.X.: Conceptualization, Data curation, Formal analysis, Methodology, Project administration, Investigation, Software, Supervision, Validation, Visualization, Writing—original draft, Writing—review & editing; T.Y., H.-X.T. and M.-H.F.: Software, Validation, Investigation, Data curation, Writing—original draft; Z.-J.L., P.-C.H. and I.-C.K.: Supervision, Investigation, Formal analysis, Writing—review & editing; T.-Y.C., S.-L.C. and P.A.R.A.: Formal analysis, Writing—review & editing. All authors have read and agreed to the published version of the manuscript.

Funding

This study was funded by the National Natural Science Foundation of China, and the Major Project and innovation platform of the Science and Technology Agency of Fujian Province under Grant Nos. 61971140, 2020IM010200, and 2021H6003, 2021D036, 2022J01549, respectively.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The MIT-BIH Normal Sinus Rhythm Database is available at https://www.physionet.org/content/nsrdb/1.0.0/ (accessed on 4 August 2020); PTB database is available at https://www.physionet.org/content/ptbdb/1.0.0/ (accessed on 4 August 2020).

Acknowledgments

The authors are grateful to Fuzhou University, Intelligence Health System and Biologic Integrated Circuits Development International (Hong Kong, Macao and Taiwan) Joint Laboratory on Fuzhou University, and Fujian Provincial Hospital, for technical support and clinical consultation.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Naghavi, M.; Abajobir, A.A.; Abbafati, C.; Abbas, K.M.; Abd-Allah, F.; Abera, S.F.; Aboyans, V.; Adetokunboh, O.; Afshin, A.; Agrawal, A.; et al. Global, Regional, and National Age-Sex Specific Mortality for 264 Causes of Death, 1980–2016: A Systematic Analysis for the Global Burden of Disease Study 2016. Lancet 2017, 390, 1151–1210. [Google Scholar] [CrossRef]
  2. D’Souza, M.J.; Li, R.C.; Gannon, M.L.; Wentzien, D.E. 1997–2017 Leading Causes of Death Information Due to Diabetes, Neoplasms, and Diseases of the Circulatory System, Issues Cautionary Weight-Related Lesson to the US Population at Large. In Proceedings of the 2019 International Conference on Engineering, Science, and Industrial Applications (ICESI), Tokyo, Japan, 22–24 August 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 1–6. [Google Scholar]
  3. Jagannathan, R.; Patel, S.A.; Ali, M.K.; Narayan, K.M.V. Global Updates on Cardiovascular Disease Mortality Trends and Attribution of Traditional Risk Factors. Curr. Diab. Rep. 2019, 19, 44. [Google Scholar] [CrossRef]
  4. Cross, S.H.; Mehra, M.R.; Bhatt, D.L.; Nasir, K.; O’Donnell, C.J.; Califf, R.M.; Warraich, H.J. Rural-Urban Differences in Cardiovascular Mortality in the US, 1999–2017. Jama 2020, 323, 1852. [Google Scholar] [CrossRef]
  5. Shah, A.J.; Vaccarino, V.; Janssens, A.C.J.W.; Flanders, W.D.; Kundu, S.; Veledar, E.; Wilson, P.W.F.; Soliman, E.Z. An Electrocardiogram-Based Risk Equation for Incident Cardiovascular Disease From the National Health and Nutrition Examination Survey. JAMA Cardiol. 2016, 1, 779. [Google Scholar] [CrossRef] [PubMed]
  6. Zhang, D.; Yang, S.; Yuan, X.; Zhang, P. Interpretable Deep Learning for Automatic Diagnosis of 12-Lead Electrocardiogram. iScience 2021, 24, 102373. [Google Scholar] [CrossRef]
  7. Katal, N.; Gupta, S.; Verma, P.; Sharma, B. Deep-Learning-Based Arrhythmia Detection Using ECG Signals: A Comparative Study and Performance Evaluation. Diagnostics 2023, 13, 3605. [Google Scholar] [CrossRef] [PubMed]
  8. Ullah, H.; Heyat, M.B.B.; Akhtar, F.; Muaad, A.Y.; Ukwuoma, C.C.; Bilal, M.; Miraz, M.H.; Bhuiyan, M.A.S.; Wu, K.; Damaševičius, R.; et al. An Automatic Premature Ventricular Contraction Recognition System Based on Imbalanced Dataset and Pre-Trained Residual Network Using Transfer Learning on ECG Signal. Diagnostics 2022, 13, 87. [Google Scholar] [CrossRef] [PubMed]
  9. Ansari, Y.; Mourad, O.; Qaraqe, K.; Serpedin, E. Deep Learning for ECG Arrhythmia Detection and Classification: An Overview of Progress for Period 2017–2023. Front. Physiol. 2023, 14, 1246746. [Google Scholar] [CrossRef] [PubMed]
  10. Nahak, S.; Pathak, A.; Saha, G. Fragment-Level Classification of ECG Arrhythmia Using Wavelet Scattering Transform. Expert Syst. Appl. 2023, 224, 120019. [Google Scholar] [CrossRef]
  11. Aldughayfiq, B.; Ashfaq, F.; Jhanjhi, N.Z.; Humayun, M. A Deep Learning Approach for Atrial Fibrillation Classification Using Multi-Feature Time Series Data from ECG and PPG. Diagnostics 2023, 13, 2442. [Google Scholar] [CrossRef]
  12. Wan, X.; Liu, Y.; Mei, X.; Ye, J.; Zeng, C.; Chen, Y. A Novel Atrial Fibrillation Automatic Detection Algorithm Based on Ensemble Learning and Multi-Feature Discrimination. Med. Biol. Eng. Comput. 2024, 62, 1809–1820. [Google Scholar] [CrossRef]
  13. Ogunpola, A.; Saeed, F.; Basurra, S.; Albarrak, A.M.; Qasem, S.N. Machine Learning-Based Predictive Models for Detection of Cardiovascular Diseases. Diagnostics 2024, 14, 144. [Google Scholar] [CrossRef] [PubMed]
  14. Kolhar, M.; Kazi, R.N.A.; Mohapatra, H.; Al Rajeh, A.M. AI-Driven Real-Time Classification of ECG Signals for Cardiac Monitoring Using i-AlexNet Architecture. Diagnostics 2024, 14, 1344. [Google Scholar] [CrossRef] [PubMed]
  15. Liu, K.; Liu, T.; Wen, D.; Zang, M.; Zhou, S.; Liu, C. SRTNet: Scanning, Reading, and Thinking Network for Myocardial Infarction Detection and Localization. Expert Syst. Appl. 2024, 240, 122402. [Google Scholar] [CrossRef]
  16. Bak, E.; Choi, G.-H.; Pan, S.B. ECG-Based Human Identification System by Temporal-Amplitude Combined Feature Vectors. IEEE Access 2020, 8, 42217–42230. [Google Scholar] [CrossRef]
  17. Uwaechia, A.N.; Ramli, D.A. A Comprehensive Survey on ECG Signals as New Biometric Modality for Human Authentication: Recent Advances and Future Challenges. IEEE Access 2021, 9, 97760–97802. [Google Scholar] [CrossRef]
  18. Ingale, M.; Cordeiro, R.; Thentu, S.; Park, Y.; Karimian, N. ECG Biometric Authentication: A Comparative Analysis. IEEE Access 2020, 8, 117853–117866. [Google Scholar] [CrossRef]
  19. Muhammad, F.; Hussain, M.; Aboalsamh, H. A Bimodal Emotion Recognition Approach through the Fusion of Electroencephalography and Facial Sequences. Diagnostics 2023, 13, 977. [Google Scholar] [CrossRef]
  20. Hsu, Y.-L.; Wang, J.-S.; Chiang, W.-C.; Hung, C.-H. Automatic ECG-Based Emotion Recognition in Music Listening. IEEE Trans. Affect. Comput. 2020, 11, 85–99. [Google Scholar] [CrossRef]
  21. Fan, T.; Qiu, S.; Wang, Z.; Zhao, H.; Jiang, J.; Wang, Y.; Xu, J.; Sun, T.; Jiang, N. A New Deep Convolutional Neural Network Incorporating Attentional Mechanisms for ECG Emotion Recognition. Comput. Biol. Med. 2023, 159, 106938. [Google Scholar] [CrossRef]
  22. Xu, X.; Xu, H.; Wang, L.; Zhang, Y.; Xaio, F. Hygeia: A Multilabel Deep Learning-Based Classification Method for Imbalanced Electrocardiogram Data. IEEE/acm Trans. Comput. Biol. Bioinform. 2023, 20, 2480–2493. [Google Scholar] [CrossRef] [PubMed]
  23. Sassi, R.; Bond, R.R.; Cairns, A.; Finlay, D.D.; Guldenring, D.; Libretti, G.; Isola, L.; Vaglio, M.; Poeta, R.; Campana, M.; et al. PDF–ECG in Clinical Practice: A Model for Long–Term Preservation of Digital 12–Lead ECG Data. J. Electrocardiol. 2017, 50, 776–780. [Google Scholar] [CrossRef] [PubMed]
  24. Badilini, F.; Young, B.; Brown, B.; Vaglio, M. Archiving and Exchange of Digital ECGs: A Review of Existing Data Formats. J. Electrocardiol. 2018, 51, S113–S115. [Google Scholar] [CrossRef]
  25. Lobodzinski, S.M.; Teppner, U.; Laks, M. State of the Art Techniques for Preservation and Reuse of Hard Copy Electrocardiograms. J. Electrocardiol. 2003, 36, 151–155. [Google Scholar] [CrossRef]
  26. Mitra, S.; Mitra, M.; Chaudhuri, B.B. Generation of Digital Time Database from Paper ECG Records and Fourier Transform-Based Analysis for Disease Identification. Comput. Biol. Med. 2004, 34, 551–560. [Google Scholar] [CrossRef]
  27. Karsikas, M.; Huikuri, H.; Perkiömäki, J.S.; Lehtola, L.; Seppänen, T. Influence of Paper Electrocardiogram Digitizing on T Wave and QRS Complex Morphology Parameters. Ann. Noninvasive Electrocardiol. 2007, 12, 282–290. [Google Scholar] [CrossRef]
  28. Ravichandran, L.; Harless, C.; Shah, A.J.; Wick, C.A.; Mcclellan, J.H.; Tridandapani, S. Novel Tool for Complete Digitization of Paper Electrocardiography Data. IEEE J. Transl. Eng. Health Med. 2013, 1, 1800107. [Google Scholar] [CrossRef] [PubMed]
  29. Hao, P.; Gao, X.; Li, Z.; Zhang, J.; Wu, F.; Bai, C. Multi-Branch Fusion Network for Myocardial Infarction Screening from 12-Lead ECG Images. Comput. Methods Programs Biomed. 2020, 184, 105286. [Google Scholar] [CrossRef] [PubMed]
  30. Kavak, S.; Chiu, X.-D.; Yen, S.-J.; Chen, M.Y.-C. Application of CNN for Detection and Localization of STEMI Using 12-Lead ECG Images. IEEE Access 2022, 10, 38923–38930. [Google Scholar] [CrossRef]
  31. Tripathi, P.M.; Kumar, A.; Kumar, M.; Komaragiri, R. Multilevel Classification and Detection of Cardiac Arrhythmias with High-Resolution Superlet Transform and Deep Convolution Neural Network. IEEE Trans. Instrum. Meas. 2022, 71, 4006113. [Google Scholar] [CrossRef]
  32. Waits, G.S.; Soliman, E.Z. Digitizing Paper Electrocardiograms: Status and Challenges. J. Electrocardiol. 2017, 50, 123–130. [Google Scholar] [CrossRef] [PubMed]
  33. Khleaf, H.K.; Bin Gazali, K.H.; Abdalla, A.N.; Raheema, M.N.M. ECG Trace Digitization Using Image Processing Techniques. Int. J. Sci. Eng. Res. 2015, 6, 1113–1116. [Google Scholar]
  34. Math, U.; Akkasaligar, P.T. Digitized ECG Image Analysis. In Proceedings of the 2017 International Conference On Smart Technologies For Smart Nation (SmartTechCon), Bangalore, India, 17–19 August 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 801–804. [Google Scholar]
  35. Li, Y.; Qu, Q.; Wang, M.; Yu, L.; Wang, J.; Shen, L.; He, K. Deep Learning for Digitizing Highly Noisy Paper-Based ECG Records. Comput. Biol. Med. 2020, 127, 104077. [Google Scholar] [CrossRef] [PubMed]
  36. Ghodake, S.; Ghumbre, S.; Deshmukh, S. Optimized Cardiovascular Disease Detection and Features Extraction Algorithms from ECG Data. Int. J. Adv. Comput. Sci. Appl. 2020, 11, 200–206. [Google Scholar] [CrossRef]
  37. Gautam, P.; Sunkaria, R.K.; Sharma, L.D. Digitisation of Paper-ECG Using Column Wise-Median Approach. Int. J. Comput. Appl. Technol. 2021, 66, 231. [Google Scholar] [CrossRef]
  38. Wang, S.; Zhang, S.; Li, Z.; Huang, L.; Wei, Z. Automatic Digital ECG Signal Extraction and Normal QRS Recognition from Real Scene ECG Images. Comput. Methods Programs Biomed. 2020, 187, 105254. [Google Scholar] [CrossRef]
  39. Otsu, N. A Threshold Selection Method from Gray-Level Histograms. IEEE Trans. Syst. Man Cybern. 1979, 9, 62–66. [Google Scholar] [CrossRef]
  40. Canny, J. A Computational Approach to Edge Detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, PAMI-8, 679–698. [Google Scholar] [CrossRef]
  41. Duda, R.O.; Hart, P.E. Use of the Hough Transformation to Detect Lines and Curves in Pictures. Commun. Acm 1972, 15, 11–15. [Google Scholar] [CrossRef]
  42. He, L.; Cheng, X.; Jiwa, A.; Li, D.; Fang, J.; Du, Z. Zanthoxylum Bungeanum Fruit Detection by Adaptive Thresholds in HSV Space for an Automatic Picking System. IEEE Sensors J. 2023, 23, 14471–14486. [Google Scholar] [CrossRef]
  43. Bangare, S.L.; Dubal, A.; Bangare, P.S.; Patil, S.T. Reviewing Otsu’s Method for Image Thresholding. Int. J. Appl. Eng. Res. 2015, 10, 21777–21783. [Google Scholar] [CrossRef]
  44. Srinivas, C.H.V.V.S.; Prasad, M.V.R.V.; Sirisha, M. Remote Sensing Image Segmentation Using OTSU Algorithm. Int. J. Comput. Appl. 2019, 178, 46–50. [Google Scholar] [CrossRef]
  45. Haqqiman Radzali, M.; Ashikin Mohamad Kamal, N.; Mat Diah, N. Measuring Leaf Area Using Otsu Segmentation Method (LAMOS). Indian J. Sci. Technol. 2016, 9, 1–6. [Google Scholar] [CrossRef]
  46. Tang, X.; Wang, X.; Hou, J.; Wu, H.; He, P. Research on Improved Gamma Transform Face Image Preprocessing Fusion Algorithm under Complex Lighting Conditions. Recent Adv. Comput. Sci. Commun. 2022, 15, e220322186189. [Google Scholar] [CrossRef]
  47. Zhang, T.Y.; Suen, C.Y. A Fast Parallel Algorithm for Thinning Digital Patterns. Commun. Acm 1984, 27, 236–239. [Google Scholar] [CrossRef]
  48. Goldberger, A.L.; Amaral, L.A.N.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.-K.; Stanley, H.E. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation 2000, 101, E215–E220. [Google Scholar] [CrossRef]
  49. Bousseljot, R.; Kreiseler, D.; Schnabel, A. Nutzung Der EKG-Signaldatenbank CARDIODAT Der PTB Über Das Internet. Biomed. Tech./Biomed. Eng. 2009, 40, 317–318. [Google Scholar] [CrossRef]
  50. Baydoun, M.; Safatly, L.; Abou Hassan, O.K.; Ghaziri, H.; El Hajj, A.; Isma’eel, H. High Precision Digitization of Paper-Based ECG Records: A Step Toward Machine Learning. IEEE J. Transl. Eng. Health Med. 2019, 7, 1900808. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Scheme of paper-recorded ECG digitization system for telemonitoring and diagnosis.
Figure 1. Scheme of paper-recorded ECG digitization system for telemonitoring and diagnosis.
Diagnostics 14 01910 g001
Figure 2. Targeted color adjustment algorithm: the original ECG image is converted and split into hue (H), saturate (S), and value (V) channels. The difference between the grid and the ECG curves is expanded at the most moderate level.
Figure 2. Targeted color adjustment algorithm: the original ECG image is converted and split into hue (H), saturate (S), and value (V) channels. The difference between the grid and the ECG curves is expanded at the most moderate level.
Diagnostics 14 01910 g002
Figure 3. The image was divided into 4 × 4 equal parts and each part has a local threshold value.
Figure 3. The image was divided into 4 × 4 equal parts and each part has a local threshold value.
Diagnostics 14 01910 g003
Figure 4. The recognition of the reference square wave based on the Butterworth filter. (a) The original signal; (b) The signal after second-order Butterworth high-pass filter with a cutoff frequency of 100 Hz; (c) The signal after threshold processing and peak detection.
Figure 4. The recognition of the reference square wave based on the Butterworth filter. (a) The original signal; (b) The signal after second-order Butterworth high-pass filter with a cutoff frequency of 100 Hz; (c) The signal after threshold processing and peak detection.
Diagnostics 14 01910 g004
Figure 5. Schematic of benchmark square pulse. The states 1, 2, 3, and 4 refer to the first low-level voltage segment, the high-level voltage segment, the second low-level voltage segment of the square wave, and the ECG signal segment, respectively.
Figure 5. Schematic of benchmark square pulse. The states 1, 2, 3, and 4 refer to the first low-level voltage segment, the high-level voltage segment, the second low-level voltage segment of the square wave, and the ECG signal segment, respectively.
Diagnostics 14 01910 g005
Figure 6. Results for geometric distortion correction. (a) ECG photo taken at random; (b) ECG photo taken with white background; (c) ECG photo taken in a complex background.
Figure 6. Results for geometric distortion correction. (a) ECG photo taken at random; (b) ECG photo taken with white background; (c) ECG photo taken in a complex background.
Diagnostics 14 01910 g006
Figure 7. Results for ECG image binarization. The image is taken in different environments. (a) photo of common ECG paper saved in patient; (b) photo taken from a cardiology book.
Figure 7. Results for ECG image binarization. The image is taken in different environments. (a) photo of common ECG paper saved in patient; (b) photo taken from a cardiology book.
Diagnostics 14 01910 g007
Figure 8. Results for ECG image binarization. The image is taken in different environments. (a) photo with strong uneven illumination interference; (b) photo of clinical 12-lead ECG thermal paper.
Figure 8. Results for ECG image binarization. The image is taken in different environments. (a) photo with strong uneven illumination interference; (b) photo of clinical 12-lead ECG thermal paper.
Diagnostics 14 01910 g008
Figure 9. Validation scheme for 1D ECG signal reconstruction algorithm.
Figure 9. Validation scheme for 1D ECG signal reconstruction algorithm.
Diagnostics 14 01910 g009
Figure 10. Result of comparison between reconstruction signal and original signal.
Figure 10. Result of comparison between reconstruction signal and original signal.
Diagnostics 14 01910 g010
Table 1. Steps and parameters of proposed approach.
Table 1. Steps and parameters of proposed approach.
StepNameValue/Description
InputECG imagesObtained through cameras
1Canny edge detectionLow threshold: 100
High threshold: 200
2Hough line transformAngular resolution: π/180
Threshold: 100
3ECG edge lines decisionThe shorter line was removed
Cosine threshold: 0.85
4Four vertices detectionThe intersection point of lines
5Image distortion correctionBased on perspective transformation
6Red gridlines removalBased on the HSV color space
Hue range: [0, 10], [156, 180]
7Image segmentation4 × 4 equal parts
8Gamma transformationγ: 0.8
9OTSU algorithmApplied to each of 16 parts
10Image stitchingNot applicable
11Column-wise scanningTo extract the curve information
12Reference square wave detectionButterworth high-pass filter Order: 2
Cutoff frequency: 100 Hz
13Amplitude transformationBased on reference square wave
OutputDigitized ECG amplitude signalNot applicable
Table 2. Similarity analysis between extracted 1D signal value and real value of MIT-BIH.
Table 2. Similarity analysis between extracted 1D signal value and real value of MIT-BIH.
RecordPearson rMAE
16,2650.9800.0316
16,2720.9750.0218
16,2730.9420.0574
16,4200.9780.0369
16,4830.9830.0281
16,5390.9690.0385
16,7730.9800.0257
16,7860.9690.0436
16,7950.9770.0277
17,0520.9690.0291
17,4530.9710.0215
18,1770.9770.0334
18,1840.9520.0416
19,0880.9550.0305
19,0900.9710.0188
AVE0.9700.0324
Table 3. Similarity analysis between extracted 1D signal value and real value of PTB diagnostic ECG database.
Table 3. Similarity analysis between extracted 1D signal value and real value of PTB diagnostic ECG database.
Category of DiseaseRecordPearson rMAE
Bundle branch blocks0364lre0.9820.0148
s0404lre0.9840.0329
s0421_re0.9510.0504
s0424_re0.9860.0303
Cardiomyopathys0189_re0.9990.0040
s0200_re0.9840.0252
s0392lre0.9880.0213
s0420_re0.9800.0119
Dysrhythmias0018cre0.9830.0295
s0169_re0.9920.0095
s0211_re0.9700.0309
s0349lre0.9960.0103
s0393lre0.9800.0191
healthys0291lre0.9610.0344
s0303lre0.9780.0251
s0306lre0.9870.0267
s0311lre0.9500.0330
AVE 0.9800.0241
Table 4. Comparison of current research in terms of correlation.
Table 4. Comparison of current research in terms of correlation.
MethodAverage Value of Overall Correlation
Ravichandran’s algorithm [28] 0.85–0.90
Baydoun’s algorithm [50] 0.952
Gautam’s algorithm [37] 0.86
Li’s algorithm [35] 0.916
This work (AVE)0.975
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, L.-H.; Xie, C.-X.; Yang, T.; Tan, H.-X.; Fan, M.-H.; Kuo, I.-C.; Lee, Z.-J.; Chen, T.-Y.; Huang, P.-C.; Chen, S.-L.; et al. Paper-Recorded ECG Digitization Method with Automatic Reference Voltage Selection for Telemonitoring and Diagnosis. Diagnostics 2024, 14, 1910. https://doi.org/10.3390/diagnostics14171910

AMA Style

Wang L-H, Xie C-X, Yang T, Tan H-X, Fan M-H, Kuo I-C, Lee Z-J, Chen T-Y, Huang P-C, Chen S-L, et al. Paper-Recorded ECG Digitization Method with Automatic Reference Voltage Selection for Telemonitoring and Diagnosis. Diagnostics. 2024; 14(17):1910. https://doi.org/10.3390/diagnostics14171910

Chicago/Turabian Style

Wang, Liang-Hung, Chao-Xin Xie, Tao Yang, Hong-Xin Tan, Ming-Hui Fan, I-Chun Kuo, Zne-Jung Lee, Tsung-Yi Chen, Pao-Cheng Huang, Shih-Lun Chen, and et al. 2024. "Paper-Recorded ECG Digitization Method with Automatic Reference Voltage Selection for Telemonitoring and Diagnosis" Diagnostics 14, no. 17: 1910. https://doi.org/10.3390/diagnostics14171910

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop