user1150071
user1150071

Reputation: 315

how to get values From a scanned ECG image?

In my project, I have to digitize an ECG image taken with a normal camera (jpeg). For example, I have the following camera captured image: i'm using c# to implement this

enter image description here

Then i convert this image to greyscale image and then apply threshold to seperate the wave from the grid. Finally remove unnecessary things from the image and final output is like this

enter image description here

now i want to fetch the values which are mention on bellow image using pixel count between those segments.what is the best way to do that?

enter image description here

main things i want to get are height of QR wave and length between two Q waves.(pixel values)

how to implement bellow code to get those values and store them in arrays

public void black(Bitmap bmp)
{
            Color[,] results = new Color[bmp.Width, bmp.Height];
            for (int i = 0; i < bmp.Height; i++)
            {
                for (int j = 0; j < bmp.Width; j++)
                {
                    Color col = bmp.GetPixel(j, i);
                    if (col.R == 0) 
                    {
                        results[j, i] = bmp.GetPixel(j, i);

                    }
           }
      }
}

Upvotes: 1

Views: 2228

Answers (1)

mkfs
mkfs

Reputation: 346

For a theoretical (i.e. no source code) overview of the problem, read Section III of Syeda-Mahmood, Beymer, and Wang "Shaped-based Matching of ECG Recordings.

Basically, your black & white image is an array of datapoints: the x axis is simply the width of the image in pixels, and the y axis is obtained by averaging the y-position of the black pixels at each x-position (not needed if the black line is only one pixel high).

To make the data more manageable, you can down-sample by selecting every nth x-position from the image. You probably want to stick with a standard ECG sampling rate to ensure that you do not miss important data; modern ECG hardware often samples at 1000Hz, while the data in MIT's QRS database on Physionet is at 250Hz or 360Hz. Using one of these rates would mean reading 1000, 250, or 360 pixels for every second of data (25mm) in the scanned image.

Upvotes: 3

Related Questions