-1

There are two type of image thresholding techniques. 1.adaptive thresholding 2.Global thresholding

what is the best algorithm we can use to seperate a ECG line from ECG grid?

user1150071
  • 285
  • 1
  • 2
  • 9

3 Answers3

2

Assuming you're using MATLAB, I would go about doing the following :

  1. I=im2double(rgb2gray(Img));

  2. imhist(I); %%Shows you the histogram of the image. From the histogram, you can get an idea of the threshold to choose.

  3. BW=im2bw(I,thr); %thr is the threshold level.

  4. Play around with the imerode, imdilate and other morphological functions to separate the ECG from the background grid.

Hope that helps.

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49
Has
  • 885
  • 4
  • 13
  • 31
1

Assuming you're using Python, I would go about doing the following :

cv2.Canny() can be used this way to detect and remove gridlines in an ECG-image:

import cv2
import numpy as np
import matplotlib.pyplot as plt

ECG_image = cv2.imread("image001.png")
plt.figure(figsize=(20,8))
plt.imshow(ECG_image)

enter image description here

img_gray = cv2.cvtColor(ECG_image, cv2.COLOR_BGR2GRAY)
img_edges = cv2.Canny(img_gray, 800, 800, apertureSize=3)
plt.figure(figsize=(10,8))
plt.imshow(img_edges)
plt.show()

enter image description here

You will have to experiment with the parameters in the Canny-function in order to fit the function to your need.

bjornsing
  • 322
  • 6
  • 25
-1

Please look here for one possible solution to this.

Community
  • 1
  • 1
halirutan
  • 4,281
  • 18
  • 44