Find heart rate using ecg imaage
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to calculate heart rate & QRS vales using ecg image. This is my ecg image.

First i convert this photo to black and white using this code.This my Black & White photo.

Then i plot this black & white photo to extract values.This is code for plot.
---------------------------------------------------------------------------------------------
IM = imread('bin_ecgm.png'); %IM = rgb2gray(IM); IM = double(IM);
% Over sample 8 times in horizontal direction % Amount to oversample is determined by maximum slope, e.g. if max slope is % 16, oversample by 16. IM2 = interp2(IM,linspace(1,size(IM,2),size(IM,2)*8),linspace(1,size(IM,1),size(IM,1))');
% Calculate shortest path using 255 - image intensity as energy function [spath,senergy,slastindex,im] = shortestPath(255-IM2',255,0,1,100);
% Down sample path to account for original oversampling p_x = 1:size(IM2,2); p_x = p_x ./ 8; p_y = spath(:,2);
% Plot on top of original image imagesc(IM); colormap gray; hold on; plot(p_x,p_y,'r'); hold off;
-----------------------------------------------------------------------------------
function [ p, e, l, im ] = shortestPath( m, opt, a, ax, bx )
%SHORTESTPATH Summary of this function goes here
% Detailed explanation goes here
%Get size of matrix [sy, sx] = size(m); im = zeros(sy,sx);
%Convert to value different from optimal value = abs(opt - m);
%Preallocate index matrix and energy matrix lastindex = zeros(sy, sx); energy = zeros(sy, sx);
%Initialise first rows energy(1,:) = value(1,:); lastindex(1,:) = 1:sx;
%Initialise temp matrix t = zeros(1,3);
%Loop through remaining rows for row = 2:sy for col = ax:bx %Get the last energies and current values if col == ax t = [inf energy(row-1,col:(col+1))]; cv = [inf value(row,col:(col+1))]; elseif col == bx t = [energy(row-1,(col-1):col) inf]; cv = [value(row,(col-1):col) inf]; else t = energy(row-1,(col-1):(col+1)); cv = value(row,(col-1):(col+1)); end
%Add energy for moving
t = t + [a 0 a];
%Add energy from difference from optimum
t = t + cv;
%Find minimum
[v,i] = min(t);
%Save new values
energy(row,col) = v;
lastindex(row,col) = col + i - 2;
end
end
[v,li] = min(energy(sy,ax:bx)); li = ax + li - 1; p(sy,:) = [sy li]; im(sy,li) = 1; for row = (sy-1):-1:1 i = lastindex(row,li); p(row,:) = [row,i]; im(row,i) = 1; li = i; end
e = energy; l = lastindex;
end
----------------------------------------------------------------------------------
any one know how to do this.
0 Kommentare
Antworten (2)
Image Analyst
am 17 Mai 2014
First of all, use a flatbed scanner instead of a camera so you don't get the specular reflection of the flash in the image, and you'll get a better image of the black line. Then simply draw a black line across, cutting across the peaks. Then call imfill(), bwconncomp(), and regionprops() to get the centroids.
binaryImage = grayImage < 200; % Or whatever you did.
binaryImage(150, :) = true; % Draw a line across at line 150 or whatever.
binaryImage = imfill(binaryImage, 'holes'); % Fill in the peaks to make solid triangles.
cc = bwconncomp(binaryImage);
measurements = regionprops(cc, 'Centroid');
centroids = [measurements.Centroid];
xCentroids = centroids(1:2:end); % Location of the peak centers horizontally.
xCentroids is in units of pixels. Then convert that to seconds by your spatial calibration where you know how many pixels corresponds to how many seconds, which you can get by measuring the number of pixels between the brown grid lines.
Star Strider
am 17 Mai 2014
Objective: (Probably) Lead II EKG rhythm strip. Normal sinus rhythm, Rate 75, PR = 0.16 s, QRS = 0.10 s, QT = 0.42 s (QTc = 0.47 s). QRS amplitude 9 mv.
Impression: Abnormal EKG: (1) Significant QT prolongation; (2) Low T-wave amplitude suggestive of hypokalemia. No evidence of infarct or ischaemia.
----------
If you’re going to calculate anything from a paper EKG tracing, you also have to segment the time and voltage gridlines, if not in the same EKG image, then a corresponding one. Without those references, any EKG tracing is just a squiggle. I did a PubMed search on this just now, and it seems no one has done this, likely because there is no need for it. Even computer-interpreted EKG tracings are all reviewed by someone with expertise in reading them.
4 Kommentare
Image Analyst
am 17 Mai 2014
He just said that you should be able to get the signal and not have to work off the chart image. Can you get the signal in digital form? If not, why not?
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!