Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Oficmajster

Member

01-27-2013 10:36 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

I need to point out all pixels that are peaks and valleys in my 2D array. I thought that I would point them out by building imaginary part of my array and changing corresponding values to 0 and 1 (valley, peak). My question is how to do it quickly and softly. I tried peak detector vi's but they all seem to work with 1D signal only (I cannot change my array to 1D, cause the only condition for peak is that the pixel must have higher value than all 8 closest pixels and 2D - 1D conversion will take it line by line).

Help 🙂

Zody

NI Employee (retired)

01-29-2013 03:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

I don't think there is an VI already implemented for that.

Can you give more specific information, how big is your array and which are your timming constrains? The first step would be to implement by yourself a very simple alghorithm as taking by the rows from that array and comparing the data to the neighbours (A[i][j] compared to A[i-1][j], A[i+1][j], A[i][j-1] ... and so on)

Can you post a text file with your values?

Best regards,

I.R.

02-06-2013 04:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Ok, I didn't describe the problem properly. My 2D array represents 3D surface topography.I need to calculate specific surface parameter. The array is 256x256 and values are generally somwhere between -50 and 50. Now I need to determine how many peaks/pits there are in each interval <-50;-49), <-49; -48), <-48; -47) and so on up to <49; 50). I tried to make double FOR loop so it would check each point separately, and then a while loop inside, but it went out of memory.

Vi attached. I replaced my array with one filled with random numbers but it didn't make any difference. What is wrong?

GerdW

Knight of NI

02-06-2013 05:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Ofic,

do you need a simple histogram? Why not use the histogram functions?

Best regards,

GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO

GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO

02-06-2013 07:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

GerdW

Knight of NI

02-06-2013 07:13 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Ofic,

Now I need to determine how many peaks/pits there are in each interval <-50;-49), <-49; -48), <-48; -47) and so on up to <49; 50).

Sounds like you need a histogram over your data with an interval width of 1. Easily to get with the histogram function as shown above...

Best regards,

GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO

GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO

02-08-2013 08:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Ok I get it. I will use histograms later.

First I need to get rid of all non-peak and non-pit points by replacing them with zeros. My vi. doesn't work and I'm not sure if I know why. I want to receive an array with zeros and (if the point is a peak) values of the points.

Vi. attached.

I thought that the problem is maybe that the program doesn't know next rows until it gets there, but I don't know how to avoid it.

Zody

NI Employee (retired)

02-08-2013 09:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

maybe this VI will help you.

Basically it searches in the 2D arrays for peaks, and returns back an array of cluster, each cluster contains two integer value (row and column number) where there was a peak detected.

Best regards,

I.R.

Download All

Virus scan in progress. Please wait to download attachments.

02-08-2013 10:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I need the value of the peak too.

Zody

NI Employee (retired)

02-09-2013 07:35 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

well, you can parse one more time and extract the values, now that you know the coordinates, it is easy to read the peak values.

Best Regards,

I.R.