08-24-2015 08:46 AM
Hi,
My name is Noy and I'm a student in my last year and working on my final project.
In the project I has to get frames from a camera , put them in a queue in one loop and in another loop I want to get the frames from the queue and save them as a avi file.
When I run the program I see that the enqueue goes well but when it goes to the dequeue loop it seems that the queue is empty.
Can anyone help me to understand how to solve that?
Thanks,
Noy
Solved! Go to Solution.
08-24-2015 09:00 AM
Well your bottom Get Queue Status VI will show zero if your top loop is enqueueing at the same rate as your lower loop because it's reading the queue size right after dequeueing.
I imagine, it's going something like this: Enqueue -> Read # Elements = 1 -> Dequeue -> Read # Elements = 0
Is there something else that makes you think the queue is empty? Your producer consumer loop setup (though sloppy) shouldn't have any problems dequeueing unless there's an error.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-24-2015 09:11 AM
Thank you for your reply!
I think that it's not going well because when I trying to see the avi file I saved (should be few seconds) it looks empty.
The avi file is attached.
08-24-2015 09:28 AM
Never ever tell a consumer to stop when the queue is empty. That is just asking for strange issues like you are seeing. Instead, you should send an actual command through the queue telling it to stop. In a case like this, I would send an empty array. There is a simple primitive on the comparison palette to test for an empty array. You also need to release the queue when the consumer loop is complete.
08-24-2015 09:29 AM - edited 08-24-2015 09:32 AM
I would suggest setting up some error handling in that consumer loop. You currently don't have any, so maybe there's an error that it's generating that will give you more info. At a minimum, just put an indicator for the error in there.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-24-2015 09:37 AM
Thank you so much!!
The problem is solved when I did what you said 🙂