05-05-2019 08:31 AM
Hello. I have problems with timing a while loop. I used some examples of other people but its still not showing time. I am using flat sequence structure. My program is creating grayscale form webcam live video. I divided flat sequence structure to three parts, while loop was in second part and timers were in first and third. In third I substracted times like in second uploaded picture.
05-05-2019 08:56 AM
The number you're feeding to the timer is the duration of the loop in milliseconds. If you pass that to a numeric indicator, you'll be able to see the value on the Front Panel. Is that what you're wanting to do?
Passing it to the "Timer" as you describe with the BD comments only makes you wait for that length of time, it doesn't display a value.
05-05-2019 09:04 AM
yes I want to create indicator showing how much time it needs to process image into grayscale and it should be changing because its real time image processing
05-05-2019 09:18 AM
Hello Raew,
Delete the Wait for ms Timer you have in the last panel of your sequence structure, then right click the left over wire and select Create Indicator. This will give you the elapsed time in milliseconds.
05-05-2019 09:23 AM
I have it like this and it is not working.
05-05-2019 10:01 AM - edited 05-05-2019 10:01 AM
If you are looking for the time for each iteration of your loop, you need to put the timing checks inside of your loop. Use a Feedback Node to hold the previous iteration's time and subtract the current from the previous.
05-05-2019 10:15 AM
yes I need to know how much time does program need for transformation of image. I inserted it into loop so it should now show correctly time in seconds right?
05-05-2019 10:42 AM
@raew wrote:
yes I need to know how much time does program need for transformation of image. I inserted it into loop so it should now show correctly time in seconds right?
No. It will tell you how much time elapsed since the last time you saved the Clock. This includes everything that happens inside the loop, including (a) acquiring the Image and (b) transforming the Image. If you want to know only (b), you need to make two Time measurements -- one just before you enter the Case Statement and one right after you exit the Case. The Timer doesn't have an Error Line to "anchor" it sequentially to anything, so this is one of those rare instances where a Sequence structure, with three Frames, is useful. Put the Case Statement in the middle Frame, a Precision Timer in the first and third, and subtract them. The First Frame (with the "Start" time) won't be executed until just before the Case, and the Third Frame (with the "End" time) won't be executed until just after the Case, precisely what you need.
Bob Schor