LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2d multi-peak detector (matrix)

Hi all,
I was looking for a method to find peaks over a 2d array data set (matrix).
I found some topics in old threads but noone seems exactly to help me.

In fact I was looking for something that returns (i,j) indexes of maximums found over a 2d data array (my seeking area=window).

This means that maybe I should consider the derivatives over 2d data (or maybe some 2d surface evaluation for maximums), in order to find peaks that are internal to the matrix area (but not near to the border, because these maximums could belong to peaks that are outside my seeking area).

A little example about the operation that I need to perform:
Given a (row x column) matrix:


0    10    10    0    0    0    0    0
10    5    0    0    0    5    0    0
20    10    0    0    5    10    5    0
30    20    10    0    10    20    10    0
20    10    0    0    10    15    5    0   
10    5    0    0    5    5    0    0
0    0    0    0    0    0    0    0

The real peak I want to find is 20 at (3,5) NOT 30 at (3,0), because this could be a false peak coming from a maximum located outside the border of the window.

Ideas are welcomed expecially in LV 7.1 (or LV 8.2.1).

Thanks for your suggestions!

Marco
0 Kudos
Message 1 of 23
(7,305 Views)
Hello,

if one item border has not to be consider why don't you scan array avoidind this border
or scan a subarray  n-1*n-1  or using an array with border equal zero

is border thick always "1" ?

why don't you use comparative operator  to find highest  value ?

best regards

Sébastien

 
CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 2 of 23
(7,274 Views)

Hi Marco

can you explain in more detail, why [3, 5] is  the value you want to find and [3, 0] not. Are there any rules for it? I think from human view the other point was possible, too.

Mike

0 Kudos
Message 3 of 23
(7,262 Views)
Hallo and thanks for your interest!

Tinnitus: it should be correct to discard the first column in an immediate approach, and set the first column to 0, but when evaluating the 2nd column I will find in the list of maximums also (3,2) with a value of 20 as well as (3,5). This is the main problem: maybe I should evaluate partial derivatives in some surface evaluation method, this is the only approach I can see at the moment... but i was wondering if some other faster approach exists.

Mike: the value located at (3,5) is a local maximum while the value located at (3,0) belongs to the ramp that is coming from a maximum located outside my seeking area (=matrix).
Note that if I had  another matrix like (here I have only substituted the element at (4,1) 😞

0    10    10    0    0    0    0    0
10    5    0    0    0    5    0    0
20    10    0    0    5    10    5    0
30    20    10    0    10    20    10    0
20    40    0    0    10    15    5    0   
10    5    0    0    5    5    0    0
0    0    0    0    0    0    0    0

with maximum at (4,1)=40 then I should obtain in my maximum list two indexes results: (4,1) and (3,5) and I will choose (4,1).

Hope have explained well my targets...

Thank you once again for your interests!

Have a nice day.

Marco




0 Kudos
Message 4 of 23
(7,254 Views)
For Tinnus: Sorry it was (3,1)=20 not (3,2)!
0 Kudos
Message 5 of 23
(7,253 Views)
an so, this is not a big problem just a spirit view (we can say that !!!)

there is 3-4 possibilities to solve your pb.

you scan your full matrix rejecting all duplet  containing 0 ( ex (0,x), (0,0),(x,0)

you scan sub matrix n-1*n1 and adding (1,1) to (i,j)  found  to work  on original matrix

i will try this afternoon i  used to work on matrix this C  or  matlab   but not familiar with  labview

but methodes are sames just shape change...
 
See you




CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 6 of 23
(7,242 Views)

Just to point out that I added zeroes just to simplify my example. In the real case zeroes are absent.
Real Data are over a matrix e.g 20*30 with values within -90 and -50 (dbm values coming from anhecoic chamber sampling.....)
C code examples are welcomed... i can create a dll over that!

thank you

marco
0 Kudos
Message 7 of 23
(7,240 Views)
Hi,

is that your are looking for ?
CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 8 of 23
(7,238 Views)
oops


CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 9 of 23
(7,235 Views)
In the last example you discarded the first row and the first column to find maximums in the sub-matrix and then recompute indexes to the original one.

here stands the problem!

in fact in the sub-matrix i could have maximums that belong to peaks located outside my seeking area (i.e. the starting matrix) and so they are only a "ramp" but not real local maximums!

Example:

Matrix:
0    10    10    0    0    0    0    0
10    5    0    0    0    5    0    0
20    10    0    0    5    10    5    0
30    20    10    0    10    20    10    0
20    10    0    0    10    15    5    0   
10    5    0    0    5    5    0    0
0    0    0    0    0    0    0    0


Sub Matrix:

5    0    0    0    5    0    0
10    0    0    5    10    5    0
20    10    0    10    20    10    0
10    0    0    10    15    5    0   
5    0    0    5    5    0    0
 0    0    0    0    0    0    0

Max: 20 at (2,0): is a FALSE MAX (a ramp coming from a peak outside my seeking area), in fact if i evaluate the part. derivatives there is no change of sign.

Real Max= 20 at (2,4) in the submatrix (where part,. derivatives have a change of sign)



thanks

marco
0 Kudos
Message 10 of 23
(7,217 Views)