LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Overlay Multiple Lines 2 to ignore 0,0 points during plotting?

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.

0 Kudos
Message 1 of 7
(3,843 Views)

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)

0 Kudos
Message 2 of 7
(3,833 Views)

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

0 Kudos
Message 3 of 7
(3,821 Views)

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.

0 Kudos
Message 4 of 7
(3,806 Views)

yup! sorry I didnt mention it earlier...i'm using the IMAQ Overlay Multiple Lines 2

0 Kudos
Message 5 of 7
(3,721 Views)

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.

0 Kudos
Message 6 of 7
(3,715 Views)

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 🙂

0 Kudos
Message 7 of 7
(3,710 Views)