04-22-2017 11:13 AM
My program is supposed to detect and track the motion of moving objects using a CCTV camera. A rectangle box and a tracking line is supposed to appear and track the object. However, when there is no motion a part of the program sends 0,0 XY coordinates to the Overlay Multiple Lines block. This causes the block to plot the tracking line from 0,0 to the next point that has motion. I tried putting a constant of NaN, Inf and -1 to replace coordinates which were 0,0 but the Overlay Multiple Lines block is still plotting 0,0.
To be more specific, I'm saving 15 XY coordinates to an Excel file which is updated with the latest position of the object every frame, which the program can read from and plot those 15 points. The value of 0,0 (NaN, Inf and -1 too) causes the overlay block to wrongly plot the line to origin instead of ignoring it.
If you need my VIs, please feel free to contact me and I will upload ASAP.
Thanks.
04-22-2017 11:30 AM - edited 04-22-2017 11:33 AM
Yes, we need to see the VIs. Points with NaN are skipped, so there must be something else in the data.
(Make sure the VI contains data, e.g. as default values)
04-22-2017 11:52 AM
Thanks for such a quick reply. Actually I have tried testing a standalone VI that contains the Overlay Multiple Lines 2 only. I connected a control to the IMAQ and pumped the coordinates of 100,200
NaN, NaN
200,100
into it. The result was that the IMAQ still plotted the NaN, so the outcome looks like some sort of V shape. I have attached my test VI here
04-22-2017 12:12 PM
Sorry, cannot look at your VI. Won't be near a computer for a while. So you are using imaq? I thought you were using an xy graph.
04-24-2017 09:36 AM
yup! sorry I didnt mention it earlier...i'm using the IMAQ Overlay Multiple Lines 2
04-24-2017 10:29 AM
Well, all you probably need to to is process the array of points and remove the unwanted values instead of replacing them with something else. (or you could substitute the last good point for each (0,0) point of you want to keep the array size constant). Create a small subVI that does that and place it between the control and the imaq function.
04-24-2017 10:44 AM
well, the way my program works, the array size has to be constant...and I've tried using the last good value whenever 0,0 comes in, but I've found out that for example the latest coordinates of the object is 100,200 and a 0,0 comes in, the array will plug in 100,200 instead of 0,0. So far so good. Now, let's say 5 seconds has passed and there's no movement and the program keeps plugging in 100,200 into the IMAQ which is still okay since the IMAQ is not plotting any lines. However, when a new objects moves, the IMAQ will plot the new coordinates AND the coordinates of 100,200 which is supposed to be the position of the previous object. From here onwards, I have no idea how to go around this. I really appreciate your help so far. If my problem is troubling you too much, you can inform me and I will stop pestering you 🙂