Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i get coordinates from a 2D array which has been taken from an image.

I have already posted this, but at this stage im struggling. I am doing a project for college where i have to direct a spotlight on anything that moves in a field of vision using a camera and a set of servo motors. The motors will be pulsed based on coordinates taken from an image. I am not using vision assistant or VDM. I am at the point where i am subtracting 2 images using snap and displaying the results in a 2D array. This is where im stuck. I need to get coordinates from the point in the array where change has occured the most ( the highest pixel value ). I have been reading and have been told that to get coordinates from a 2D array you need to pass it through for loop and reshape it into a 1D array, but this dosent make sense to me. I have tried it and have got a 1D array but from this how do i get X,Y coordinates? It was also suggested that i use partical analysis but i have got strange results. Please help, i am new to labview and any pointers would be greatly appreciated, i have been looking at this for the past 2 weeks and its driving me mad. thanks
0 Kudos
Message 1 of 7
(4,766 Views)

hi,

 

I don't know if i understood well but it seems that most of the work has been done if you already have the 2D array that corresponds to the substraction of 2 images. If you need to know the index of the highest pixel value all you have got to do is use the Array Max & Min function.

 

That gives directly the highest pixel value of the 2D array and the coordinates of it. The first pixel of your image is top left and corresponds to (x:0;y:0).

 

0 Kudos
Message 2 of 7
(4,748 Views)
chris i have been looking at your VI. i am feeding u8 pixel values out of my array, do i connect them to the N terminals? this dosent seem to work. In your VI you have a for loop nested inside another for loop, I assume your feeding the array size to the N terminal of the for loop to define the size of the field. I am also assuming the input into your shift register is to tell it where in the array to start searching, (x:0;y:0). being the obvious starting point. The 2D array shows DBL shows the array and its contents then the max value is taken using the max/min array option and out comes your max pixel change and its coordinates. Am i right or ami missing something. ill attach my VI so you can take a look. thanks for taking the time to look.
0 Kudos
Message 3 of 7
(4,743 Views)
PS, what exactly is the RNG for, do i replace this with my output for the array.
0 Kudos
Message 4 of 7
(4,737 Views)

hi,

 

The 2 for loops are only there to create a 2D array of random numbers and its size will correspond to ArraySize2 (columns) x ArraySize1 (lines). The N terminals represent the size of one dimension of your array. I needed to create one array to use Array Min&Max function. You do not need that part and you just have to use this function directly with your 2D array of U8 values.

 

Could you add your VI once again for LV 8.0 please?

0 Kudos
Message 5 of 7
(4,734 Views)

thanks!

 

Look at the attachment it should be ok!

0 Kudos
Message 7 of 7
(4,723 Views)