03-18-2014 06:49 AM
Hi
I am COMPLETELY new to labview and am having some trouble.
I would like to record a video using a USB camera and be able to play it back on multiple occasions at different speeds.
The file attached is what I have so far. The signal generated at the top is controlling the equipment I am recording. Currently, I am saving the video to the hard drive in AVI format and retreiving it to watch again. However I would like to be able to play this at different speeds and be able to pause/rewind. Is this possible? I would also prefer not to have to save and retreive the file and much prefer it to stay within the system memory.
Thanks in Advance
Alex
03-18-2014 08:50 AM - edited 03-18-2014 09:00 AM
Hi!
In your program you set the "frames per second" input on the "Init AVI" Vi to 50. If your camera is set up to acquire 50 frames/sec this is ok. But your "playback" loop will (as it is) run at much higher rate, since it is not limited in speed. You need to control the playback rate with a delay function (maybe the Wait (ms)-vi). If the acq-rate is 50Hz, you need to limit the playback loop to 50 iterations per sec -> 20ms delay.
Set the delay to a lower value for a faster playback, or higher value for slow motion playback.
If you decide to use the AVI-vi:s you need to associate the video with a file. You can however keep the frames in memory by simply create an array of images and write to them instead of to the AVI-file. Modify your code like this:
1) Create an array of IMAQ-images, Note that you need diffrent images on each index in the array.
2) In your acqure-loop. Instead of writing to the AVI-file, write to the array at index "i". Note that you must modify this image, so retreive the image-ref at array index "i", then modify it by writing to it, the put the image-ref back in the array.
3) In your playback loop.Read image-ref to display from the array by index "i".
Done
Best regards
Dan
03-19-2014 09:04 AM
Hi Dan! Thank you very much for your reply! The quality of the plaback video is now much better quality and I am now able to choose different playback speeds depending on the delay!
Could you please explain the process of creating an array, inputting the video and then retreiving it again.
It would be of great use if I didn't have to save to AVI!
Thanks again!
Alex
03-20-2014 08:38 AM - edited 03-20-2014 08:44 AM
Hi!
I described the steps you needed in the last post. However, since I was curious on how to achieve this in the simplest way. I wrote the complete program for you. Have a look at the snippet below (Save the image to file and then drag it on to an empty labVIEW block diagram).
Feel free to use it as a base for your program if you find it suitable.
I didn't have time to put all the comment in, but you might want to fill in the blanks.
Notes
Best regards
Dan
Best regards
04-06-2014 08:21 AM
Hi Dan
Is there a way to alter the frames per second in this program?
Thanks again
Alex
04-06-2014 02:24 PM - edited 04-06-2014 02:28 PM
Yes, you can change the rate by changing the timeout for the event structure. please see the timeout case.
The "speed" Control is connected to this function. You can simply select playback speed on the front panel!
//Dan