I'm trying to process a scanned ECG image using matlab(I'm a complete novice). I'd like to:-
1.find and highlight all local maxima and minima in the ECG
2.compute and display the distance between the successive minima and maxima
I'm using a jpeg image from the internet .After converting it to grayscale ,I'm at a loss for what to do .I've tried the functions in
How can I find local maxima in an image in MATLAB?
http://www.mathworks.in/matlabcentral/answers/58002-how-to-find-local-maxima-and-minima-of-a-noisy-ecg
but the image retains the non-maxima and non-minima points.Will converting
Any help in this(or advice on how I could better myself at matlab ) would be much appreciated .
Asked
Active
Viewed 2,005 times
1
-
1Could you describe the problem a bit more in detail? In particular, what the problem is when you apply the found solutions? – Dennis Jaheruddin Feb 06 '13 at 14:57
-
I'd like to get something like [this](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTRrY4lzmj7awsoqsuqlghvXbR59DpcpNpF5K8z2jA6-RBx48Mt_w)but imregionalmax() and others are not giving me the 3 peaks I need in the image .How do I process the image to get those?Thanks in advance. – Eridanus Feb 06 '13 at 15:08
-
@Eridanus include at least a representative input image and what output you expect from it. – mmgp Feb 06 '13 at 17:38
2 Answers
1
As you appear to be searching for spikes in the signal I would recommend the following:
Suppose you have a vector called signal
treshold = std(signal); %Multiply with a constant to get a nice result
peak = signal>mean(signal) + treshold;
dip = signal>mean(signal) - treshold;
This can give you the location of all spikes if the signal is always at roughly the same level, otherwise you need to run this on a part of the signal instead of the full signal.
After you have the locations of the peaks and dips it should not be too hard to analyse them.

Dennis Jaheruddin
- 21,208
- 8
- 66
- 122
1
To get the local minima of an image I :
minima=I(1:end-2,2:end-1)>I(2:end-1,2:end-1) && I(3:end,2:end-1)>I(2:end-1,2:end-1) && I(2:end-1,1:end-2)>I(2:end-1,2:end-1) && I(2:end-1,3:end)>I(2:end-1,2:end-1);
Thus you get a matrix with 1 on minima and 0 on none minima( Note that the border are removed)
To get minima list of x and y
[x,y]=find(minima);
x=x+1;y=y+1; %Adding the removed border
To get minima values:
J=I(2:end-1,2:end-1);
val=J(minima(:));
For your second question I don't understand what you want

Ninjasam
- 101
- 3