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?
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?
Assuming you're using MATLAB, I would go about doing the following :
I=im2double(rgb2gray(Img));
imhist(I); %%Shows you the histogram of the image. From the histogram, you can get an idea of the threshold to choose.
BW=im2bw(I,thr); %thr is the threshold level.
Play around with the imerode, imdilate and other morphological functions to separate the ECG from the background grid.
Hope that helps.
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)
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()
You will have to experiment with the parameters in the Canny-function in order to fit the function to your need.