02-19-2017 12:48 PM - last edited on 02-19-2017 07:16 PM by altenbach
Hello, I am a student and I am currently working for a company that uses labview software. I get positions with an array in x and y. On this table. I would like to compare the positions which are too close to one another and to x and y. If it is too close, I add the x and add the y to make an average. I rank these averages in a new table. I do not know if I was clear enough in my explanations. I leave you a little VI to show a little my logic. But this VI does not work. I do not know how to create the new array with the averages of those positions. If anyone can help me please.
02-19-2017 01:12 PM
Wow. I have almost no idea what you want to do! The poorly-drawn picture shows X and Y as identical arrays of shapes, with the left side having (what I supposed are supposed to be) duplicate circle and triangle entries that were removed. It shows X and Y as identical.
The Code isn't much clearer (but thank you for including it as a VI, rather than as a PNG!). There is absolutely no need for a Matlab script (whose logic was also not clear, and I apologize for not investing the time and patience to try to understand it).
Some questions.
Bob Schor
02-19-2017 07:27 PM
Your code is overly complicated and contains serious race conditions. Maybe that's why it does not work.
02-20-2017 04:07 AM
Hello everyone, Thank you for your answers. Indeed, I expressed myself very badly by explaining my problem. I took a shortcut. For me it was obvious, but not for you and I apologize. The problem is this: I use a camera to detect fruits. Thanks to acquisition vision, I have the possibility to know the positions x and y. I use Color Location. He sends me all the portions of colors he has found. At the beginning, I added the x and also the y. This was perfect for a single fruit on the screen, but not for several. Below, I made a small drawing representing an example of situation. For example, if 2 squares are too ready for each other, I will average because it will be one fruit. On the other hand if the squares are too elongated with their positions X and Y it is that it is not the same fruit. I hope you have understood me better this time. I am still a student and it is during my Saturdays that I work in this company. It's a small box that just opened a very short time ago. We are only 2. The boss and I. Thanks again.
02-20-2017 07:18 AM
How about sending an actual Image that you are trying to analyze? Now I think I understand a little better what it is you are trying to do.
Do you have a lot of experience using Machine Vision software, i.e. using Image Analysis to identify "objects"? I know that NI does this sort of thing (I've seen demos of NI Vision routines used to "find the part that has a manufacturing defect" or "sort the red, blue, and green marbles rolling down a track into separate bins", but have not done this, myself.
Bob Schor
02-20-2017 07:44 AM
It sounds like you can use IMAQ Count Objects if you just set the limits correct. Then you should just get 1 square/object and can easily get the average within each.
/Y
02-21-2017 05:54 AM
Thank you for your answers. I think I did not think well. Since I have to detect nuts, damassines or mirabelles as fruits and it is rare that 2 fruits have the same shape. I will no longer ask myself and think about doing otherwise to detect them and have a position at a time for a single fruit.
Thanks again. A good day.
02-21-2017 11:00 AM
@djo.mayala wrote:
Thank you for your answers. I think I did not think well. Since I have to detect nuts, damassines or mirabelles as fruits and it is rare that 2 fruits have the same shape. I will no longer ask myself and think about doing otherwise to detect them and have a position at a time for a single fruit. Thanks again. A good day.
Please DON'T use code tags when posting plain text. Simply Don't!!!
03-04-2017 08:19 AM
Hello,
I come back to you with clearer explanations. Here is a VI of my program with the worries that I meet.
When I have a single fruit on the screen, I have the exact position of this fruit. On the other hand when I have 2, it gives me the average of 2. I wish to have the position of each fruit separately.
I uploaded my VI. I did this because I use 2 functions that are needed to open the file.
Is it possible?
Cordially.
03-04-2017 08:28 AM
Let me requote Altenbach:
"Please DON'T use code tags when posting plain text. Simply Don't!!!"
Yet you did it again. Just type your message in the edit box. Don't mess with any buttons above that box!