Electrocardiosignal processing method and electronic equipment

CN119698254APending Publication Date: 2025-03-25HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380058876.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-08-09
Filing Date
2023-05-12
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

Existing wearable devices are easily affected by human body movement, breathing, environmental electromagnetic interference and other factors when collecting ECG signals, resulting in noise in the ECG signal and affecting the accuracy of the signal.

Method used

By preprocessing the ECG data, dividing different areas and using fixed-length and variable-length sliding windows for smoothing, the data points in different areas are integrated to reduce the interference of noise on the ECG signal.

Benefits of technology

Effectively reduce noise interference, improve the accuracy and stability of ECG signals, and enhance the smoothing effect on ECG data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119698254A_ABST
    Figure CN119698254A_ABST
Patent Text Reader

Abstract

The invention provides an electrocardiosignal processing method and electronic equipment, and the method comprises the steps: the electronic equipment carries out the preprocessing of electrocardiosignal data, and obtains first data; the electronic equipment divides data points in the first data into data points of a first-class region, data points of a second-class region and data points of a buffer-class region, wherein the buffer-class region comprises a third-class region and a fourth-class region; the electronic equipment carries out smoothing processing on the data points in the second type region through a plurality of windows with fixed lengths to obtain second data; the electronic equipment performs smoothing processing on the data points in the third-class region through a plurality of windows with fixed lengths to obtain third data; the electronic equipment carries out smoothing processing on the data points in the fourth type region through a plurality of windows with unfixed lengths to obtain fourth data; and the electronic equipment integrates the second data, the third data, the fourth data and the data points of the first type of regions to obtain fifth data after smoothing the electrocardiogram data. In this way, the electronic equipment can conduct smoothing processing on the data in the different areas, and interference of noise on the electrocardiosignals is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Electrocardiogram signal processing method and electronic device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on August 9, 2022, with application number 202210948840.5 and application name “Method and electronic device for processing electrocardiogram signals”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a method for processing electrocardiogram signals and an electronic device. Background Art

[0003] With the development of terminal technology, wearable devices are gradually being used in people's work and life. To meet users' ever-increasing needs for health management, wearable devices can provide a variety of health data monitoring services, such as heart rate monitoring, sleep monitoring, and electrocardiogram signal monitoring.

[0004] Normally, ECG signals are weak. When wearable devices collect ECG signals, they are easily interfered with by factors such as human movement, breathing, and electromagnetic interference in the environment, resulting in noise in the ECG signals collected by wearable devices.

[0005] In a possible implementation, wearable devices can use filters to remove some noise, such as baseline drift and power frequency interference. However, the ECG signal output by the wearable device is still not very accurate.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide an electrocardiogram (ECG) signal processing method and electronic device, which can reduce noise interference on the ECG signal by dividing the ECG data into regions and performing different smoothing processes on different regions.

[0008] In a first aspect, an embodiment of the present application provides a method for processing an electrocardiogram (ECG) signal, which is applied to an electronic device, the method comprising: preprocessing ECG data by the electronic device to obtain first data; dividing data points in the first data into data points in a first region, data points in a second region, and data points in a buffer region; smoothing the data points in the second region using multiple fixed-length windows to obtain second data; smoothing the data points in the third region using multiple fixed-length windows to obtain third data; smoothing the data points in the fourth region using multiple non-fixed-length windows to obtain fourth data; and integrating the second, third, and fourth data with the data points in the first region to obtain fifth data after smoothing the ECG data. In this way, the electronic device uses a fixed-length sliding window to smooth the relatively flat data points in the second and third regions, and uses a variable-length sliding window to smooth the data points in the fourth region, thereby smoothing noise in the ECG signal and reducing interference from the noise on the ECG signal.

[0009] In one possible implementation, when the fourth-category region is a transition zone between the first-category region and the third-category region, the lengths of the multiple non-fixed-length windows gradually increase over time. Alternatively, when the fourth-category region is a transition zone between the third-category region and the first-category region, the lengths of the multiple non-fixed-length windows gradually decrease over time. In this way, the electronic device can set the lengths of the non-fixed-length windows based on the characteristics of the data points between the first-category region and the third-category region, thereby improving the smoothing effect on the data points in the fourth-category region.

[0010] In one possible implementation, the first variability is related to determining data points in a first-category region, data points in a third-category region, and data points in a fourth-category region; the electronic device divides the data points in the first data into data points in the first-category region, data points in the second-category region, data points in the third-category region, and data points in the fourth-category region, including: the electronic device calculates the first variability of the data points in the first data; when the first variability is lower than a first variability threshold, the electronic device determines that the data point in the first data is a data point in the second-category region; or, when the first variability is not lower than the first variability threshold, the electronic device determines that the data point in the first data is a data point in the first-category region, a data point in the third-category region, or a data point in the fourth-category region. In this way, the electronic device can divide the second-category region and the other regions according to the first variability, so that the electronic device can subsequently perform partitioned smoothing processing on the ECG data.

[0011] In one possible implementation, the second variability is related to determining data points in the first category of regions, and the electronic device divides the data points in the first data into data points in the first category of regions, data points in the second category of regions, data points in the third category of regions, and data points in the fourth category of regions. The method also includes: the electronic device calculating the second variability of the data points in the first category of regions, the data points in the third category of regions, or the data points in the fourth category of regions; when the second variability is not less than a second variability threshold, the electronic device determines that the data point in the first data is a data point in the first category of regions; or, when the second variability is less than the second variability threshold, the electronic device determines that the data point in the first data is a data point in the third category of regions or a data point in the fourth category of regions. In this way, the electronic device can divide the first category of regions into the buffer category based on the second variability, so that the electronic device can subsequently perform partitioned smoothing processing on the ECG data.

[0012] In one possible implementation, the first variability M1 satisfies the following formula: M1 = mean(abs(diff(X1))) / (2k+1); where k is a positive integer, the window length selected when calculating M1 is 2k+2, and X1 is the set of 2k+2 first data points in the window. The second variability M2 satisfies the following formula: M2 = mean(abs(diff(X2))) / (2j+1); where j is a positive integer, the window length selected when calculating M2 is 2j+2, and X2 is the set of 2j+2 first data points in the window. In this way, the electronic device can divide the region according to the first variability and the second variability, so that the electronic device can subsequently perform partitioned smoothing processing on the ECG data.

[0013] In one possible implementation, is the data point of the second data at time t, the data point of the second data Satisfies the following formula: Among them, x t is the first data point at time t, x t-H is the first data point at time tH, x t+H is the first data point at time t+H, H is a positive integer and H is a constant, calculate The window length selected is 2H+1. In this way, the electronic device can perform partition smoothing processing on the data points of the second type of area to obtain second data.

[0014] In a possible implementation, the preset length is q, is the data point of the third data at time t, the data point of the third data Satisfies the following formula: Among them, x t-Q is the first data point at time tQ, x t+QThe data point of the first data at time t + Q, where Q is a positive integer and a constant, and Q < H. Calculate The window length selected when calculating is 2Q + 1, and the value range of the window length is [1, q]. In this way, the electronic device can perform partition smoothing processing on the data points in the third type of area to obtain the third data.

[0015] In one possible implementation, The data point of the fourth data at time t. The data points of the fourth data satisfy the following formula: where x t-u is the data point of the first data at time t - u, and x t+u is the data point of the first data at time t + u. u is a positive integer and a variable. Calculate The window length selected when calculating is 2u + 1. In this way, the electronic device can perform partition smoothing processing on the data points in the fourth type of area to obtain the fourth data.

[0016] In one possible implementation, the method further includes: when the electronic device receives a trigger operation for starting electrocardiogram data detection, the electronic device displays the data points of the fifth data. In this way, the electronic device can display the denoised electrocardiogram data.

[0017] In one possible implementation, the electronic device includes a wearable device, and the wearable device includes one or more of the following: a smart watch, a smart bracelet, or smart glasses.

[0018] In a second aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device executes the electrocardiogram signal processing method described in the first aspect or any implementation manner of the first aspect.

[0019] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the computer executes the electrocardiogram signal processing method described in the first aspect or any implementation manner of the first aspect.

[0020] In a fourth aspect, a computer program product includes a computer program. When the computer program is run, the computer executes the electrocardiogram signal processing method described in the first aspect or any implementation manner of the first aspect.

[0021] It should be understood that the second aspect to the fourth aspect of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar and will not be elaborated. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] FIG1 is a schematic diagram of a scenario provided by an embodiment of the present application;

[0023] FIG2 is a schematic structural diagram of a wearable device provided in an embodiment of the present application;

[0024] FIG3 is a schematic diagram of the software structure of a smart watch provided in an embodiment of the present application;

[0025] FIG4 is a schematic diagram of regional division of an electrocardiogram signal provided in an embodiment of the present application;

[0026] FIG5 is a flow chart of a method for processing an electrocardiogram signal according to an embodiment of the present application;

[0027] FIG6 is a schematic diagram of a curve showing the variability of electrocardiogram data provided in an embodiment of the present application;

[0028] FIG7 is a schematic diagram of a scenario of a method for processing an electrocardiogram signal provided in an embodiment of the present application;

[0029] FIG8 is a schematic diagram of a curve of first data and fifth data provided in an embodiment of the present application;

[0030] FIG9 is a schematic structural diagram of an electrocardiogram signal processing device provided in an embodiment of the present application;

[0031] FIG10 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first value and the second value are merely used to distinguish different values ​​and do not limit their order. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit different values.

[0033] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0034] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" 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, b and c, where a, b, c can be single or multiple.

[0035] To meet users' ever-increasing demands for personal health management, wearable devices can provide a variety of health data monitoring services, such as heart rate monitoring, sleep monitoring, and ECG signal monitoring. ECG signals are typically weak and are susceptible to interference from factors such as human movement, breathing, and electromagnetic interference in the environment during the ECG signal collection process. This can result in noise in the ECG signals collected by wearable devices.

[0036] In a possible implementation, wearable devices can use filters to remove some noise, such as baseline drift and power-frequency interference. However, many noise sources (such as myoelectric noise and motion noise) interfere throughout the entire frequency band, are relatively weak, and are difficult to eliminate. For ECG signals, this noise has a more pronounced impact on the weaker, stationary segments of the signal, thereby reducing its accuracy.

[0037] For example, FIG1 is a schematic diagram of a scenario of a method for processing an electrocardiogram signal provided in an embodiment of the present application, as shown in FIG1 :

[0038] The electronic device may be configured with an "ECG" application, which may support the electronic device in measuring the user's ECG signal. The electronic device may display interface a of Figure 1 , which may include an "ECG" icon. When the electronic device detects a touch operation on the "ECG" icon, the terminal device starts the "ECG" application, the user can use the ECG monitoring service, and the electronic device enters the interface shown in Figure 1 b. Interface b of Figure 1 may display the ECG signal collected and processed by the electronic device in real time. The user can view the ECG intuitively. In some embodiments, the electronic device may be a smart watch, which may establish a connection with electronic devices such as mobile phones. In this way, users can understand their own health status and provide users with reasonable health guidance.

[0039] In a possible implementation, electronic devices collect raw ECG signals, filter them through a filter, remove some noise (such as baseline drift and power frequency interference), and then display the processed ECG signals on the electronic device. However, for some noise (such as myoelectric noise and motion noise), the filter has difficulty removing these noises. This noise interference may cause distortion of the ECG trace.

[0040] In view of this, an embodiment of the present application provides a method for processing an ECG signal, wherein an electronic device preprocesses ECG data to obtain first data; the electronic device divides data points in the first data into data points in a first region, data points in a second region, and data points in a buffer region; the electronic device smoothes the data points in the second region using multiple fixed-length windows to obtain second data; the electronic device smoothes the data points in the third region using multiple fixed-length windows to obtain third data; the electronic device smoothes the data points in the fourth region using multiple non-fixed-length windows to obtain fourth data; and the electronic device integrates the second data, third data, fourth data, and data points in the first region to obtain fifth data after smoothing the ECG data. In this way, the electronic device uses a fixed-length sliding window to smooth the relatively flat data points in the second region and the third region, and uses a variable-length sliding window to smooth the data points in the fourth region, thereby smoothing the noise in the ECG signal and reducing the interference of the noise on the ECG signal.

[0041] It will be understood that, in the embodiments of the present application, an electronic device is taken as a smart watch among wearable devices for illustration, and this example does not constitute a limitation on the embodiments of the present application.

[0042] It is understood that the electronic devices in the embodiments of the present application that can support electrocardiogram measurement may include: mobile phones, smart TVs, wearable devices, tablet computers, computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) devices, wireless devices in industrial control (industrial control), and wireless devices in self-driving. Among them, the wearable devices may include: smart watches, smart bracelets, smart gloves, smart glasses, virtual reality (VR) terminal devices, or smart belts.

[0043] The specific forms of the electronic device and the wearable device are not specifically limited in the embodiments of the present application. In order to better understand the embodiments of the present application, the structure of the wearable device of the embodiments of the present application is introduced below. For example, Figure 2 is a schematic diagram of the structure of a wearable device provided in the embodiments of the present application.

[0044] The wearable device may include a processor 110, an internal memory 121, a universal serial bus (USB) interface, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194. The sensor module 180 may include a gyroscope sensor 180B, a barometer 180C, a magnetic sensor 180D, an acceleration sensor 180E, a proximity light sensor 180G, a temperature sensor 180J, a touch sensor 180K, and an ambient light sensor 180L.

[0045] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on wearable devices. In other embodiments of the present application, the wearable device may include more or fewer components than shown, or combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0046] The processor 110 may include one or more processing units. The different processing units may be independent devices or integrated into one or more processors. The processor 110 may also be provided with a memory for storing instructions and data.

[0047] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. The power management module 141 is used to connect the charging management module 140 to the processor 110.

[0048] The wireless communication function of the wearable device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0049] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. The antennas in a wearable device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.

[0050] Mobile communication module 150 can provide solutions for wireless communications, including 2G / 3G / 4G / 5G, for wearable devices. It can include at least one filter, switch, power amplifier, and low-noise amplifier (LNA). Mobile communication module 150 receives electromagnetic waves from antenna 1, filters and amplifies them, and transmits them to a modem processor for demodulation.

[0051] The wireless communication module 160 can provide wireless communication solutions for wearable devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), etc.

[0052] The wearable device implements display functionality through a GPU, display 194, and an application processor. The GPU is a microprocessor for image processing that connects the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering.

[0053] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. In some embodiments, the wearable device may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0054] The wearable device can realize the shooting function through an ISP, a camera 193, a video codec, a GPU, a display 194, and an application processor.

[0055] The camera 193 is used to capture still images or videos. In some embodiments, the wearable device may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0056] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 can include a program storage area and a data storage area.

[0057] The wearable device can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, and the application processor.

[0058] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. Speaker 170A, also known as a "horn," is used to convert audio electrical signals into sound signals. The wearable device can listen to music or make hands-free calls through speaker 170A. Receiver 170B, also known as a "handset," is used to convert audio electrical signals into sound signals. When the wearable device receives a call or voice message, the voice can be heard by placing receiver 170B close to the user's ear.

[0059] The gyro sensor 180B can be used to determine the motion posture of the wearable device. The magnetic sensor 180D includes a Hall sensor.

[0060] The barometer 180C is used to measure air pressure. In some embodiments, the wearable device can calculate altitude using the air pressure value measured by the barometer 180C to assist in positioning and navigation. In embodiments of the present application, the barometer 180C is used to measure the air pressure conditions of the wearable device. For example, the barometer 180C can be used to detect whether the wearable device is underwater.

[0061] The acceleration sensor 180E can detect the magnitude of the acceleration of the wearable device in various directions (generally three axes). In the embodiment of the present application, the acceleration sensor 180E is used to detect whether the wearable device is in motion.

[0062] The proximity light sensor 180G can be used to detect the proximity and distance between the wearable device and an object. The ambient light sensor 180L is used to sense the brightness of the ambient light. The temperature sensor 180J is used to detect the temperature. In the embodiment of the present application, the temperature sensor is used to detect the temperature of the environment in which the wearable device is located.

[0063] The touch sensor 180K is also called a “touch control device.” The touch sensor 180K can be disposed on the display screen 194 . The touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen.”

[0064] Buttons 190 include a power button, a volume button, and other buttons. These buttons can be mechanical or touch-sensitive. The wearable device can receive key inputs and generate key signal inputs related to user settings and function control of the wearable device. Indicator 192 can be an indicator light that can be used to indicate charging status, battery level changes, messages, missed calls, notifications, and the like.

[0065] The software system of the wearable device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture, etc. The embodiment of the present application takes a system with a layered architecture as an example to illustrate the software structure of the wearable device.

[0066] For example, taking the wearable device as a smart watch as an example, FIG3 is a schematic diagram of the software structure of a smart watch provided in an embodiment of the present application.

[0067] As shown in Figure 3, the layered architecture divides the software into several layers, each with clear roles and divisions of labor. Layers communicate with each other via software interfaces. In some embodiments, the smartwatch software architecture can be divided into five layers: application (APP) layer, system service layer, algorithm layer, hardware abstraction layer (HAL), and kernel layer.

[0068] The application layer may include a series of applications, such as a watch face application, a sports record application, a call application, and a workout application.

[0069] The system service layer provides system support for applications in the application layer. For example, the system service layer may include modules such as step counting service, heart rate service, calorie service, and heart health service.

[0070] The algorithm layer provides algorithm support for the system service layer. For example, the algorithm layer may include a heart rate algorithm, a dimming algorithm, a sleep algorithm, and a wearable algorithm. In the embodiment of the present application, the heart rate algorithm, the dimming algorithm, the sleep algorithm, and the wearable algorithm can be used together to support the heart rate service and detect the heart rate characteristics of users in different states.

[0071] In the hardware abstraction layer, any hardware-related operations required by the upper layers of the system require the use of the HAL-related application programming interface (API). The software architecture layer of each hardware device specifies certain functions, which the HAL layer can use to implement.

[0072] The hardware abstraction layer may include: an interface corresponding to a C++ library, a storage interface, a display interface, a touch interface, a Bluetooth interface, and a global positioning system (GPS) interface.

[0073] The kernel layer can be considered the layer between hardware and software. The kernel refers to system software that provides hardware abstraction, disk and file system control, and multitasking. The kernel is the core and most fundamental component of an operating system. It manages system processes, memory, device drivers, files, and network systems, determining system performance and stability. It is the software that provides secure access to computer hardware for numerous applications. This access is limited, and the kernel determines when and for how long a program can operate on certain hardware components.

[0074] The kernel layer may be an operating system kernel (OS kernel).

[0075] The definitions involved in the embodiment of the present application are first explained in the form of a schematic diagram in conjunction with FIG4 , which shows a schematic diagram of the regional division of the electrocardiogram signal in the embodiment of the present application, as shown in FIG4 :

[0076] The embodiment of the present application divides the ECG data into four regions, including: a first-category region, a second-category region, a third-category region, and a fourth-category region. For example, the first-category region, the second-category region, the third-category region, and the fourth-category region can be shown in FIG4 . The first-category region can be a portion of the QRS wave segment in the ECG data, and the first-category region includes the R wave; the second-category region can include the region from the start of the T wave to the end of the P wave; it is understood that there is a buffer region between the first-category region and the second-category region, and the buffer region includes the third-category region and the fourth-category region. The third-category region is a region of a preset length adjacent to the boundary of the second-category region in the buffer region; the fourth-category region is the region in the buffer region excluding the third-category region.

[0077] It should be noted that in the embodiments of the present application, the nth type of region can be a region consisting of data points of different signal characteristics in the ECG data, rather than a fixed region consisting of data points of a fixed time period in the ECG data. For example, if ECG data is measured in time, and an electronic device collects two sets of ECG data, the time periods of the first and second type of regions in the two sets of ECG data are generally different.

[0078] It is understandable that the ECG data may include the QRS band with a larger ECG signal amplitude, as well as the PR band, ST band, T band and U band with smaller ECG signal amplitude. The ECG signal processing method of the embodiment of the present application can define the first type of area as a non-suppression area and the second type of area as a suppression area according to the degree of interference of noise on ECG data of different amplitudes. The non-suppression area can be understood as: the noise has a weaker interference on the ECG signal with a high amplitude. At the same time, smoothing this part of the ECG signal may lose the signal characteristics of the original ECG signal. Therefore, the embodiment of the present application does not suppress the noise of this part of the ECG signal. The suppression area can be understood as: the noise has a stronger interference on the ECG signal with a low amplitude. The ECG signal processing method of the embodiment of the present application is used to suppress the interference of noise on the ECG signal with a low amplitude. Suppression can be understood as reducing the energy amplitude of the noise. Taking ECG data as an example, suppression can be to numerically reduce the size of the noise in the ECG data.

[0079] Furthermore, in order to improve the smoothing effect on the noise in the ECG data, in the embodiment of the present application, the data points of the buffer area are divided into data points of the third area and data points of the fourth area, wherein the third area is an area of ​​preset length adjacent to the boundary of the second area in the buffer area; the fourth area is the area of ​​the buffer area other than the third area. In the embodiment of the present application, the electronic device can divide the ECG data into data points of the first area, the second area, the third area and the fourth area. According to the effect of suppressing the ECG signal noise, the first area can be defined as a non-suppression area, the second area can be defined as a strong suppression area, the third area can be defined as a weak suppression area, and the fourth area can be defined as a non-suppression buffer area.

[0080] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other. For the same or similar concepts or processes, some embodiments may not be described in detail.

[0081] For example, FIG5 shows a flowchart of a method for processing an electrocardiogram signal according to an embodiment of the present application, as shown in FIG5 :

[0082] S501 : The electronic device preprocesses the ECG data to obtain first data; the preprocessing is used to filter out baseline drift and power frequency interference noise in the ECG data.

[0083] In the embodiment of the present application, the electronic device can perform high-pass filtering and low-pass filtering on the ECG data. These two filters can generally filter out noise outside the effective range of the ECG signal. The filtered noise can be baseline drift noise and power frequency interference noise.

[0084] For example, the electronic device may use an n-th order high-pass filter to pre-process the ECG data, and the lower limit of the pre-processing frequency may be F l .

[0085] Electronic devices can use m-order low-pass filters to pre-process ECG data. The upper limit of the pre-processing frequency can be F h Among them, F l With F h Customizable settings.

[0086] The electronic device obtains the filtered first data.

[0087] S502: The electronic device divides the data points in the first data into data points in a first category area, data points in a second category area, and data points in a buffer category area.

[0088] The electronic device can divide the ECG data into different areas based on the amplitude of the data points in the first data, which may include a first-category area, a second-category area, and a buffer-category area. The first-category area can be a portion of the QRS wave band in the ECG data, and the first-category area includes the R wave; the second-category area can include the area from the starting point of the T wave to the end point of the P wave; there is a buffer-category area between the first-category area and the second-category area. The buffer-category area includes a third-category area and a fourth-category area. The third-category area is an area of ​​a preset length adjacent to the boundary of the second-category area in the buffer-category area, and the fourth-category area is the area in the buffer-category area excluding the third-category area.

[0089] It can be understood that the first type of area, the second type of area and the buffer area can appear periodically, and the data points of each type of area have certain characteristics or waveforms. The electronic device can realize the division of each type of area based on the characteristics of each type of data point, or based on the waveform of the electrocardiogram data. The embodiment of the present application does not limit the specific division method of each type of area.

[0090] S503: The electronic device performs smoothing processing on the data points in the second type of area using multiple windows of fixed lengths to obtain second data.

[0091] The window used to process the second type of region can be a sliding window of fixed length. Multiple fixed-length windows can be understood as follows: at the first moment, a window of length a is centered on the first data point; at the second moment, a window of length a is centered on the second data point. ECG data is a discrete set of data points, and the first data point can be the previous data point adjacent to the second data point, with the first moment preceding the second. Similarly, windows at different moments can produce an effect similar to windows sliding over time on ECG data.

[0092] The electronic device can smooth the data points in the window in the second type of area to obtain the processed data points of the second type of area. In the embodiment of the present application, the processed data points of the second type of area can be defined as the second data.

[0093] Among them, the smoothing process can be understood as removing or processing data points such as spikes, etc., so that the values of the smoothed data points form a relatively smooth curve.

[0094] S504. The electronic device smooths the data points in the third type of area through multiple fixed-length windows to obtain the third data; among them, the length of the fixed window used for smoothing the third type of area is less than the length of the fixed window used for smoothing the second type of area.

[0095] The window used for processing the third type of area can be a window with a fixed length. Among them, the window length set in step S504 can be less than the window length set in step S503. The electronic device can smooth the data points in the window in the third type of area to obtain the processed data points of the third type of area. In the embodiment of the present application, the processed data points of the third type of area can be defined as the third data.

[0096] It can be understood that the third type of area is in the buffer area between the first type of area and the second type of area. The amplitude difference between adjacent data points in the third type of area can be slightly higher than the amplitude difference between adjacent data points in the second type of area. The noise interferes strongly with the electrocardiogram signal in the second type of area. Therefore, the electronic device can select a longer fixed-length window to process the electrocardiogram data to make the second type of area achieve a better smoothing effect. And the area covered by the third type of area is small. If the electronic device selects a longer window, it may oversmooth the electrocardiogram data in the third type of area, resulting in the loss of the characteristics of some data points. Therefore, the electronic device can use a shorter fixed window to smooth the electrocardiogram data in the third type of area.

[0097] S505. The electronic device smooths the data points in the fourth type of area through multiple non-fixed-length windows to obtain the fourth data.

[0098] The window used for processing the fourth type of area can be a variable-length sliding window. Multiple non-fixed-length windows can be understood as follows: at the first moment, a window with a length of a has the first data point as the center point; at the second moment, a window with a length of b (b > a or b < a) has the second data point as the center point, and so on.

[0099] Multiple non-fixed-length windows can be set as follows:

[0100] In one possible implementation, when the fourth-category area is a transition area from the first-category area to the third-category area, the lengths of multiple windows of variable lengths gradually increase over time. For example, the window length a at the first moment is smaller than the window length b at the second moment; the window length at the second moment is smaller than the window length c at the third moment, and so on, with the window length gradually increasing over time.

[0101] It is understandable that the amplitude of the ECG data in the first category area is higher, and the amplitude of the ECG data in the third category area is lower; the amplitude of the ECG data in the fourth category area, which transitions from the first category area to the third category area, gradually decreases. When using multiple fixed-length windows to smooth the ECG data in the fourth category area, if the window length is large, the ECG data near the first category area may be over-smoothed, and the ECG signal features may be lost; if the window length is small, the features of the ECG data near the first category area are retained, but the ECG data near the second category area does not achieve a good smoothing effect, and noise may be mistaken for ECG features. Therefore, for the ECG data in the fourth category area, it is difficult for electronic devices to find a fixed-length window that is suitable for the entire fourth category area.

[0102] Based on this, in the embodiment of the present application, the window length can be planned based on the amplitude of the ECG data in the fourth category area. For the fourth category area that transitions from the first category area to the third category area, the amplitude of the ECG data in this area gradually decreases over time, and accordingly, the selected window length can be gradually increased over time.

[0103] In another possible implementation, when the fourth-category area is a transition area from the third-category area to the first-category area, the lengths of multiple windows of variable lengths gradually decrease over time. For example, the window length a at the first moment is greater than the window length b at the second moment; the window length b at the second moment is greater than the window length c at the third moment, and so on, with the window lengths gradually decreasing over time.

[0104] It is understandable that the amplitude of the ECG data of the fourth type area transitioning from the third type area to the first type area gradually increases over time, and a window with a length gradually decreasing over time can be selected to smooth the ECG data of this area.

[0105] S506: The electronic device integrates the second data, the third data, the fourth data, and the data points of the first type of area to obtain fifth data after smoothing the electrocardiogram data.

[0106] The electronic device integrates the processed data points of the second type of area, the processed data points of the third type of area, the processed data points of the fourth type of area and the unprocessed data points of the first type of area to obtain smoothed electrocardiogram data.

[0107] In one possible manner, the electronic device updates the data points of the second category area to data points of the second data; updates the data points of the third category area to data points of the third data; updates the data points of the fourth category area to data points of the fourth data; and the electronic device retains the data points of the first category area, thereby updating the first data to the fifth data.

[0108] In an embodiment of the present application, an electronic device preprocesses ECG data to obtain first data; the electronic device divides data points in the first data into data points in a first region, data points in a second region, and data points in a buffer region; the electronic device smoothes the data points in the second region using multiple fixed-length windows to obtain second data; the electronic device smoothes the data points in the third region using multiple fixed-length windows to obtain third data; the electronic device smoothes the data points in the fourth region using multiple non-fixed-length windows to obtain fourth data; and the electronic device integrates the second data, the third data, the fourth data, and the data points in the first region to obtain fifth data after smoothing the ECG data. In this way, the electronic device uses different windows to smooth the data points in the second region, the third region, and the fourth region, respectively, thereby smoothing the noise in the ECG signal and reducing the interference of the noise on the ECG signal.

[0109] The following describes step S502 in detail in conjunction with steps S601-S606 in the embodiment of the present application. Exemplarily, the electronic device divides the data points in the first data into data points of a first type of area, data points of a second type of area, data points of a third type of area, and data points of a fourth type of area, including:

[0110] The electronic device calculates the variability of a data point in the first data; and determines the region to which the data point belongs based on the variability and a variability threshold. The variability may reflect the relative dispersion of the data points in the first data, and the electronic device may determine the region type of the data point based on the variability of the data point in the first data.

[0111] Illustratively, an embodiment of the present application provides a method for distinguishing data points of a first type of region, a second type of region, a third type of region, and a fourth type of region according to a degree of variation.

[0112] S601: The electronic device calculates a first variability of data points in the first data, wherein the variability includes a first variability and a second variability, and the first variability is related to determining data points of the first type of area, data points of the third type of area, and data points of the fourth type of area.

[0113] In one possible implementation, the electronic device may take a window of length 2k+2 and calculate the first variance M1 of the data points of the first data. The electronic device may calculate the first variance of the data points in the first data to satisfy the following formula: M1=mean(abs(diff(X1))) / (2k+1) (k is a positive integer) (1)

[0114] Where X1=[x t-k-1 ,…,x t ,…x t+k ], X1 can be understood as a window with a length of 2k+2 intercepting 2k+2 adjacent data points on the first data; x t is the first data point at time t; x t-k-1 is the first data point at time tk-1; x t+k The electronic device can use the 2k+2 data points in X1 to calculate the data point x t The first degree of variation.

[0115] The calculation logic of formula (1) is as follows: for data point x t The first variation M1, the electronic device selects the data point x t The first k+1 data points, data point x t and data point x t The last k data points are taken as X1. First, the electronic device performs differential processing on the 2k+2 data points in X1, for example, x t -x t-1 , obtaining the difference between 2k+1 adjacent data points. The electronic device then sums and averages the absolute values ​​of the difference between the 2k+1 adjacent data points to calculate a first degree of variation M1.

[0116] For example, taking k=2 and X1=[1,3,4,2,3,2], the calculation process of M1 is explained.

[0117] diff(X1)=[2,1,-2,1,-1]

[0118] abs(diff(X1))=[|2|,|1|,|-2|,|1|,|-1|]=[2,1,2,1,1]

[0119] mean(abs(diff(X1)))=2+1+2+1+1=7

[0120] M1=mean(abs(diff(X1))) / (2k+1)=1.4

[0121] It can be understood that the above embodiment exemplarily introduces the electronic device calculating a data point x in the first data. t In the corresponding M1 process, the electronic device can use a window of length 2k+2 to traverse all data points in the first data, thereby obtaining the first variation M1 corresponding to each data point. The steps of traversing other data points are similar to step S601 and will not be repeated in this embodiment of the application.

[0122] S602: When the first variation is lower than a first variation threshold, the electronic device determines that a data point in the first data is a data point of a second type of area.

[0123] The first variability threshold is used to obtain data points of the first category of areas, the third category of areas, and the fourth category of areas. The first variability threshold can be C1 (derived based on data statistical experience). In one possible implementation, the first variability threshold can be derived based on a variability characteristic curve of historical ECG data. Exemplarily, the electronic device can obtain data points of historical ECG data, calculate the variability of the data points of the historical ECG data, and define the variability of the boundary points that can distinguish between the second category of areas and other categories of areas (the first category of areas, the third category of areas, and the fourth category of areas) as C1.

[0124] The electronic device may calculate M1 of a data point of the first data. When the value of M1 is lower than C1, it indicates that the data point is located in the second type of area.

[0125] Alternatively, S603: when the first variation is not lower than the first variation threshold, the electronic device determines that the data point in the first data is a data point of the first type of area, a data point of the third type of area, or a data point of the fourth type of area.

[0126] When the value of M1 is not lower than C1, it means that the data point is not located in the second type of area, then the data point can be a data point in the first type of area, the third type of area or the fourth type of area.

[0127] For example, as shown in a of Figure 6 , a of Figure 6 may be a characteristic curve of the first variability M1 of the data points of the first data, and the solid line C1 in a of Figure 6 may be a boundary line between the second category area and other category areas, wherein the data points in the first data whose M1 is below C1 are data points of the second category area, and the data points in the first data whose M1 is above C1 may be data points of other category areas.

[0128] It can be understood that step S602 and step S603 do not have a sequence. Step S602 is a possible implementation method after the electronic device executes step S601; step S603 is another possible implementation method after the electronic device executes step S601. After obtaining the data point of the first data at time t, the electronic device calculates the first variation of the data point. If the first variation is lower than the first variation threshold, then the data point is a data point of the second category area. The electronic device may no longer divide the data point. If the first variation is not lower than the first variation threshold, then the data point is not a data point of the second category area, and the electronic device needs to continue to determine the area to which the data point belongs. After step S603, the electronic device may also execute step S604.

[0129] Exemplarily, at S604 , the electronic device calculates a second degree of variation of the data points of the first type of area, the data points of the third type of area, or the data points of the fourth type of area.

[0130] The electronic device continues to calculate the data points other than the second type of area to obtain a second degree of variation. The second degree of variation is related to the data points that determine the first type of area.

[0131] In one possible implementation, the electronic device may take a window of length 2j+2 and calculate the second variability M2 of the data points of the first data. The electronic device may calculate the second variability of the data points of the first type of area, the third type of area, or the fourth type of area to satisfy the following formula: M2 = mean(abs(diff(X2))) / (2j+1) (j is a positive integer) (2)

[0132] Where X2=[x t-j-1 ,…,x t ,…x t+j ], X2 can be understood as a window of length 2j+2 that intercepts 2j+2 adjacent data points on the data. The electronic device can use the 2j+2 data points in X2 to calculate the data point x t The second degree of variation.

[0133] It can be understood that M2 can be calculated for the data points of the first type of area, the third type of area, or the fourth type of area, the number of data points is less than the number of data points of the first data, and M2 is used to distinguish the first type of area. Therefore, the window for calculating M2 is generally not the same as the window for calculating M1, that is, j may not be equal to k.

[0134] In the embodiment of the present application, the operation logic of formula (2) is similar to that of formula (1), and will not be further illustrated here.

[0135] S605: When the second variation is not lower than the second variation threshold, the electronic device determines that the data point in the first data is a data point of the first type of area.

[0136] The second variability threshold is used to obtain data points of the first category of areas. The second variability threshold can be C2 (derived based on data statistical experience). In one possible implementation, the second variability threshold can be derived based on a variability characteristic curve of historical ECG data. Exemplarily, the electronic device can obtain data points of historical ECG data, calculate the variability of the data points of the historical ECG data, and define the variability of the boundary points that can distinguish between the first category of areas and the buffer category areas (third category areas and fourth category areas) as C2.

[0137] The electronic device may calculate M2 of the data point in the first type of area, the third type of area, or the fourth type of area in step S603. When the value of M2 is not less than C2, it indicates that the data point is located in the first type of area.

[0138] Alternatively, S606: when the second variation is lower than the second variation threshold, the electronic device determines that the data point in the first data is a data point of the third type of area or a data point of the fourth type of area.

[0139] When the value of M2 is lower than C2, it indicates that the data point is located in the third or fourth category area. For example, as shown in FIG6 b, FIG6 b may be a characteristic curve of the data point M2 in the first, third, and fourth category areas in step S604. The dotted line C2 in FIG6 b may be the boundary between the first category area and the buffer area (the third and fourth category areas). Among them, data points with M2 below C2 are data points in the third or fourth category area, and data points with M2 above C2 are data points in the first category area.

[0140] It should be noted that, in order to facilitate the description of the method for dividing regions, the embodiment of the present application exemplarily illustrates the characteristic curve of M1 in step S601 and the characteristic curve of M2 in step S604. In actual operation, the characteristic curves of the two are different, and C1 and C2 have no specific size relationship.

[0141] It is understandable that step S605 and step S606 do not have a sequential order. Step S605 is a possible implementation method after the electronic device executes step S604; step S606 is another possible implementation method after the electronic device executes step S604. In the embodiment of the present application, the electronic device can execute steps S601-S606 for a data point in the first data to determine the type of region to which the data point belongs. Subsequently, the electronic device uses the method provided in the embodiment of the present application to traverse all data points in the ECG data to obtain ECG data divided into different types of regions as shown in Figure 4.

[0142] In order to improve the ECG noise suppression effect of the ECG signal processing method of the embodiment of the present application, the embodiment of the present application further divides the data points of the third category area and the data points of the fourth category area. The division method of the third category area and the fourth category area is explained below.

[0143] In addition to the first and second category areas, the first data also includes a buffer area, which may include third and fourth category areas. In one possible implementation, an embodiment of the present application may intercept an area of ​​a preset length in the buffer area at the boundary between the second category area and the buffer area as a data point for the third category area. The third category area is an area of ​​a preset length in the buffer area adjacent to the boundary between the second category area and the buffer area.

[0144] For example, after the electronic device executes steps S601-S606, it can obtain data points of the first type area, data points of the second type area and data points of the buffer type area. As shown in FIG7 a, the data point x t-1 Located at point A, data point x t Located at point B, where the data point x t With data point x t-1 are two adjacent data points, and the data point x t-1 In the buffer area, data point x t In the second type of area. At this time, the data point x t-1 With data point x t There may be a dividing line between the second type of area and the buffer type area.

[0145] The area of ​​the preset length may be the third type of area as shown in FIG7 b, wherein the preset length q can be customized. The electronic device selects an area of ​​length q from the buffer area at the dividing line to obtain the third type of area. The data points of the third type of area may include [x t-q ,…,x t ).

[0146] For example, as shown in Figure 7c and d, the data point x t Located in the second type of area, the data point x t+1 Located in the buffer zone, data point x t With data point x t+1 are two adjacent data points. At this time, the data point x t+1 With data point x t There may be a boundary line between the buffer area and the second area. The electronic device selects an area of ​​length q in the buffer area from the boundary line to obtain a third area. The data points of the third area may include (x t ,…,x t+q]. It can be understood that the ECG signal can be regarded as a periodic signal, and a single cycle may include two buffer-type areas. The electronic device processes the data points of the buffer-type areas in a similar way. The embodiment of the present application will not provide a detailed description of c and d in Figure 7.

[0147] It is understood that, except for the third type of area, the remaining areas in the buffer area are the fourth type of area. The buffer area is the transition area between the first type of area and the second type of area. The buffer area may include areas with higher amplitudes and areas with lower amplitudes. In this embodiment of the application, this area can be further divided into the third and fourth types of areas to improve the effect of subsequent ECG signal smoothing.

[0148] The above embodiments provide a method for dividing ECG data into regions. The following describes a method for smoothing data points in various regions according to an embodiment of the present application.

[0149] S701: The electronic device does not process the data points in the first type of area.

[0150] After executing step S605, the electronic device can obtain the data points of the first category area, and at this time, the electronic device can execute step S701. Among them, the amplitude of the data points of the first category area is relatively high. If the electronic device performs smoothing processing on the data points of this area, the signal characteristics of the data points of this area may be lost. Therefore, for the data points of this area, the electronic device may not perform smoothing processing on them and directly output the data points of the first category area, that is,

[0151] S702: The electronic device performs smoothing processing on the data points in the second type of area using multiple windows of fixed length to obtain second data.

[0152] After executing step S602, the electronic device may obtain data points for the second type of region, and may then execute step S702. The data points in the second type of region have low and flat amplitudes, and the second type of region covers a larger area. The electronic device may use a fixed-length window to smooth the data points in this region to obtain second data.

[0153] The data point of the second data The following formula can be satisfied:

[0154] Among them, the length of window X3 is 2H+1, and the length of window X3 is fixed, X3=[x t-H ,…,x t ,…,x t+H ], x t is the first data point at time t, x t-His the first data point at time tH, x t+H is the data point of the first data at time t+H.

[0155] It is understood that the window X3 may include data points x t The first H data points and data point x t For the last H data points, 2H+1 data points, the electronic device can sum the data points in window X3 and take the average value to obtain data point x t The corresponding data point of the second data In the embodiment of the present application, the electronic device can achieve the effect of suppressing noise by processing the amplitude of the data point where the noise is located into the average value of the amplitudes of the adjacent data points around the data point.

[0156] S703: The electronic device smoothes the data points of the third type of area using multiple fixed-length windows to obtain third data. The length of the fixed window used for smoothing the third type of area is shorter than the length of the fixed window used for smoothing the second type of area.

[0157] After executing step S606, the electronic device obtains data points for the third-category region, at which point the electronic device may execute step S703. The third-category region is part of the buffer region and is adjacent to the second-category region. The amplitude of the data points in the third-category region varies more gradually, and the electronic device can still use a fixed-length window for smoothing. However, the range covered by the third-category region is smaller than that covered by the second-category region, and the amplitude of the data points in the fourth-category region may be slightly higher. Therefore, the window length used by the electronic device to process the data points in the third-category region may be smaller than the window length used to process the data points in the second-category region.

[0158] The third data point The following formula can be satisfied:

[0159] Among them, the length of window X4 is 2Q+1, and the length of window X4 is fixed, X4=[x t-Q ,…,x t ,…,x t+Q ], x t is the first data point at time t, x t-Q is the first data point at time tQ, x t+Q is the data point of the first data at time t+Q. It can be understood that the third type of area is an area of ​​preset length q. When the electronic device calculates the data points of the third type of area, the selected window length should not exceed the length of the third type of area. Therefore, the length of the window X4 has a value interval of [1, q].

[0160] S704: The electronic device performs smoothing processing on the data points of the fourth type of area using multiple windows of non-fixed lengths to obtain fourth data.

[0161] After executing step S606, the electronic device may obtain data points of the fourth category area. At this time, the electronic device may execute step S704. The fourth category area is part of the buffer category area, and the fourth category area is adjacent to the first category area. The amplitude difference between adjacent data points in the fourth category area may show a gradually increasing or gradually decreasing trend. For example, when the data points of the fourth category area are adjacent to the first category area, the amplitude difference between adjacent data points is large; when the data points of the fourth category area are adjacent to the third category area, the amplitude difference between adjacent data points is small. In view of the characteristics of the data points of the fourth category area, the electronic device may use multiple windows of non-fixed length to smooth the data points of the fourth category area to obtain fourth data.

[0162] The length of the window X5 is 2u+1, and the length of the window X5 is variable, X5=[x t-u ,…,x t ,…,x t+u ], x t is the first data point at time t, x t-u is the first data point at time tu, x t+u The data point of the first data at time t+u.

[0163] For example, one cycle of the ECG data may include two fourth-category areas. The fourth-category area may be an area where the first-category area transitions to the third-category area, or the fourth-category area may be an area where the third-category area transitions to the first-category area.

[0164] In one possible implementation, when the fourth-category region is the transition zone between the first-category region and the third-category region, the amplitude of the data points in the fourth-category region gradually decreases. Therefore, for data points in the fourth-category region that are close to the first-category region, the electronic device may select a shorter window for smoothing; for data points in the fourth-category region that are close to the third-category region, the electronic device may select a longer window for smoothing. The length of window X5 gradually increases. Multiple windows of variable length can be multiple windows whose lengths gradually increase over time. For example, the value of u can be [1, 2, …, Q].

[0165] In another possible implementation, when the fourth-category region is the transition zone from the third-category region to the first-category region, the amplitude of the data points in the fourth-category region gradually increases. Therefore, for data points in the fourth-category region that are close to the first-category region, the electronic device can select a shorter window for smoothing; for data points in the fourth-category region that are close to the third-category region, the electronic device can select a longer window for smoothing. The length of window X5 gradually decreases. Multiple windows of variable length can be multiple windows whose lengths gradually decrease over time. For example, the value of u can be (Q,…,2,1].

[0166] It should be noted that there is no order between steps S701-S704. The electronic device obtains the data point x of the first data. t Then, the region to which the data point belongs can be determined according to steps S601-S606. Correspondingly, the electronic device selects a processing method for the corresponding region based on the region of the data point.

[0167] S705 : The electronic device integrates the second data, the third data, the fourth data, and the data points of the first type of area to obtain fifth data after smoothing the electrocardiogram data.

[0168] The electronic device may integrate the data obtained in steps S701-S704. For example, the electronic device may integrate the data points Data Points Data Points With data points Reconstruct and output the fifth data after smoothing the electrocardiogram data.

[0169] In the embodiment of the present application, the electronic device classifies the data points of the first data and outputs the smoothed fifth data, thereby improving the noise suppression effect in the ECG data and reducing the impact of irregular noise in the ECG data on the ECG signal.

[0170] The following describes the application scenario of the method for processing an electrocardiogram signal provided by the embodiment of the present application in conjunction with FIG8 . As shown in FIG8 :

[0171] When the electronic device receives a trigger operation for starting electrocardiogram signal detection, the electronic device displays a data point of the fifth data.

[0172] Exemplarily, the electronic device receives a trigger operation for enabling ECG signal detection; in response to the trigger operation for enabling ECG signal detection, the electronic device begins collecting ECG data; after collecting each ECG data point, the electronic device pre-processes the data point to obtain a first data point; the electronic device processes the first data point into a fifth data point, and displays the fifth data point on a display screen. After traversing all data points, the electronic device may display the fifth data.

[0173] It is understandable that in the embodiment of the present application, the electronic device can process and display the fifth data after smoothing after collecting the ECG data. In some embodiments, the electronic device can delay the display of the fifth data. Exemplarily, the electronic device divides the area to which the data points of the first data belong and performs smoothing based on the window. Then, when the electronic device calculates a certain data point, it must ensure that there are still n data points after the data point, and the value of n is not less than the maximum value among k, j, H, Q and u, that is, n≥max(k,j,H,Q,u). When the electronic device collects the data point x t+n The fifth data point can be output on the display However, in actual operation, the time taken by the electronic device to collect n data points is very short, which can be regarded as the electronic device displaying the fifth data in real time.

[0174] The curve graph of the ECG signal can be shown in Figure 8, where Figure 8a is the curve graph of the first data, and Figure 8b is the curve graph of the fifth data. It can be seen that when the amplitude of the data point in the first data is low, the ECG signal is greatly affected by noise, and an uneven curve appears. The curve of the fifth data processed by the method of the embodiment of the present application is relatively smooth in the band with lower amplitude. Figure 8c is a comparison diagram of the first data and the fifth data. For the first type of area, the fifth data coincides with the first data, and the ECG signal characteristics of the data points in the first type of area can be more completely retained; for other areas, the fifth data is relatively smoother than the first data, indicating that the ECG signal processing method provided by the embodiment of the present application can effectively suppress the influence of noise on the ECG signal. The curve graph shown in Figure 8b can be displayed on the display screen of the electronic device.

[0175] In one possible implementation, the electronic device may store the original ECG data, the first data, and the fifth data. In another possible implementation, the electronic device may delete the original ECG data after pre-processing the original ECG data to obtain the first data; and after processing the first data to obtain the fifth data, the electronic device may delete the first data. This can reduce the memory occupied by the data. This embodiment of the present application is not limited to this.

[0176] The above describes the method for processing an electrocardiogram signal provided in an embodiment of the present application in conjunction with Figures 1 to 8. The following describes an apparatus for executing the above method provided in an embodiment of the present application.

[0177] Exemplarily, FIG9 shows an electrocardiogram signal processing device 900 provided in an embodiment of the present application, including an acquisition module 901 , a preprocessing module 902 , a region division module 903 , a smoothing processing module 904 and a data reconstruction module 905 .

[0178] The acquisition module 901 is used to acquire original ECG data. For example, the ECG data may be electrocardiogram (ECG) data.

[0179] The preprocessing module 902 is used to execute the steps related to preprocessing in the embodiment of the present application. For example, the preprocessing module can execute step S501 to perform conventional noise reduction processing on the ECG data through high-pass filtering and low-pass filtering to obtain first data.

[0180] The region division module 903 is configured to divide the first data into a first region, a second region, a third region, and a fourth region. For example, the region division module may execute steps S601-S606, and the electronic device may obtain data points for the first region, the second region, the third region, and the fourth region.

[0181] The smoothing processing module 904 is used to smooth the data points in different types of regions using windows of different lengths to obtain second data, third data, and fourth data, respectively. For example, the smoothing processing module can execute steps S701-S704 to obtain smoothed data.

[0182] The data reconstruction module 905 is configured to integrate the second data, the third data, the fourth data, and the data points of the first type of region to obtain fifth data after smoothing the ECG data. For example, the data reconstruction module may execute step S705 to obtain and output the fifth data.

[0183] The following describes an electronic device that performs the above-mentioned method provided in an embodiment of the present application. As shown in Figure 10, Figure 10 is a schematic diagram of the structure of an electronic device that supports the electrocardiogram signal processing method provided in an embodiment of the present application. The electronic device can be a terminal device in an embodiment of the present application, or a chip or chip system within the terminal device.

[0184] As shown in FIG10 , the electronic device 1000 can be used in a communication device, circuit, hardware component, or chip, and includes a display 1001 and a processor 1002. The display 1001 is used to support the electronic device in performing display steps; the processor 1002 is used to support the electronic device in performing information processing steps.

[0185] In a possible implementation, the electronic device 1000 may also include an interface circuit 1003. Specifically, the interface circuit is used to support the electronic device 1000 in executing the steps of sending and receiving data. The interface circuit 1003 may be an input or output interface, pin, or circuit.

[0186] In a possible embodiment, the electronic device may further include a memory 1004. The processor 1002 and the memory 1004 are connected via a circuit. The memory 1004 may be a device in one or more devices or circuits for storing programs or data. The memory 1004 may exist independently and be connected to the processor 1002 of the electronic device via a communication circuit. Alternatively, the memory 1004 may be integrated with the processor 1002.

[0187] The memory 1004 can store computer-executable instructions for the method in the terminal device, so that the processor 1002 executes the method in the above embodiment. The memory 1004 can be a register, a cache, or a RAM, etc. The memory 1004 can be integrated with the processor 1002. The memory 1004 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions. The memory 1004 can be independent of the processor 1002.

[0188] In the above embodiment, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory or downloaded and installed in the memory in the form of software.

[0189] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include magnetic media (e.g., floppy disk, hard disk or tape), optical media (e.g., digital versatile disc (DVD)), or semiconductor media (e.g., solid state disk (SSD)).

[0190] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part via software, hardware, firmware, or any combination thereof. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one location to another. The storage medium can be any target medium that can be accessed by a computer.

[0191] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; computer-readable media may include magnetic disk storage or other magnetic disk storage devices. Moreover, any connecting line may also be appropriately referred to as a computer-readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while discs reproduce data optically using lasers.

[0192] The above combinations are also included within the scope of computer-readable media. The above are only specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for processing an electrocardiogram signal, characterized in that: Applied to electronic equipment, the method includes: The electronic device preprocesses the ECG data to obtain first data; the preprocessing is used to filter out baseline drift and power frequency interference noise in the ECG data; The electronic device divides the data points in the first data into data points of a first-category area, data points of a second-category area, and data points of a buffer-category area, wherein the first-category area is a portion of a QRS wave segment in the electrocardiogram data, and the first-category area includes an R wave; the second-category area includes an area from a starting point of a T wave to an end point of a P wave; the buffer-category area includes a third-category area and a fourth-category area, wherein the third-category area is an area of ​​a preset length adjacent to a boundary of the second-category area in the buffer-category area; and the fourth-category area is an area in the buffer-category area excluding the third-category area. The electronic device performs smoothing processing on the data points in the second type of area using a plurality of windows of fixed lengths to obtain second data; The electronic device smoothes the data points in the third type of area using a plurality of windows of fixed lengths to obtain third data; wherein the length of the fixed window used for smoothing the third type of area is smaller than the length of the fixed window used for smoothing the second type of area; The electronic device performs smoothing processing on the data points in the fourth type of area using a plurality of windows of unfixed lengths to obtain fourth data; The electronic device integrates the second data, the third data, the fourth data, and the data points of the first type of area to obtain fifth data after smoothing the electrocardiogram data.

2. The method according to claim 1, characterized in that When the fourth type of area is a transition area from the first type of area to the third type of area, the lengths of the multiple windows of non-fixed lengths gradually increase over time; Alternatively, when the fourth type of area is a transition area from the third type of area to the first type of area, the lengths of the multiple windows of non-fixed lengths gradually decrease over time.

3. The method according to claim 1 or 2, characterized in that The first degree of variation is related to determining data points of the first category area, data points of the third category area, and data points of the fourth category area; the electronic device classifies the data points in the first data into data points of the first category area, data points of the second category area, data points of the third category area, and data points of the fourth category area, including: The electronic device calculates the first variability of the data points in the first data; When the first variability is lower than a first variability threshold, the electronic device determines that the data point in the first data is a data point of the second type of area; Alternatively, when the first variability is not lower than the first variability threshold, the electronic device determines that the data point in the first data is a data point of the first type of area, a data point of the third type of area, or a data point of the fourth type of area.

4. The method according to claim 3, characterized in that The second degree of variation is related to determining the data points of the first type of area, and the electronic device divides the data points in the first data into data points of the first type of area, data points of the second type of area, data points of the third type of area, and data points of the fourth type of area, further comprising: The electronic device calculates the second variability of the data points of the first type of area, the data points of the third type of area, or the data points of the fourth type of area; When the second variability is not lower than a second variability threshold, the electronic device determines that the data point in the first data is a data point of the first type of area; Alternatively, when the second variability is lower than the second variability threshold, the electronic device determines that the data point in the first data is a data point of the third type of area or a data point of the fourth type of area.

5. The method according to claim 4, characterized in that The first variation M1 satisfies the following formula: M1=mean(abs(diff(X1))) / (2k+1); where k is a positive integer, the window length selected when calculating M1 is 2k+2, and X1 is the set of 2k+2 data points of the first data in the window; The second variation M2 satisfies the following formula: M2=mean(abs(diff(X2))) / (2j+1); wherein j is a positive integer, the window selected when calculating M2 is 2j+2, and X2 is the set of 2j+2 data points of the first data in the window.

6. The method according to any one of claims 1 to 5, characterized in that is the data point of the second data at time t, the data point of the second data Satisfy the following formula: Among them, x t is the data point of the first data at time t, x t-H is the data point of the first data at time tH, x t+H is the data point of the first data at time t+H, H is a positive integer and H is a constant, calculate The selected window length is 2H+1.

7. The method according to any one of claims 1 to 5, characterized in that The preset length is q, is the data point of the third data at time t, the data point of the third data Satisfy the following formula: where x t-Q is the data point of the first data at time t - Q, x t+Q is the data point of the first data at time t + Q, Q is a positive integer and Q is a constant, Q < H, calculate The window length selected is 2Q+1, and the value range of the window length is [1, q].

8. The method according to any one of claims 1 to 5, characterized in that is the data point of the fourth data at time t, the data point of the fourth data Satisfy the following formula: Among them, x t-u is the data point of the first data at time tu, x t+u is the data point of the first data at time t+u, where u is a positive integer and u is a variable, calculate The window length selected is 2u+1.

9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: When the electronic device receives a trigger operation for starting electrocardiogram data detection, the electronic device displays a data point of the fifth data.

10. The method according to any one of claims 1 to 9, characterized in that The electronic device includes a wearable device, and the wearable device includes one or more of the following: a smart watch, a smart bracelet, or smart glasses.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the electronic device is caused to perform the method according to any one of claims 1 to 10.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the computer is caused to perform the method according to any one of claims 1 to 10.

13. A computer program product, characterized in that The invention comprises a computer program which, when being executed, causes a computer to execute the method according to any one of claims 1 to 10.