You can do this with multiple while loops running in parallel. Acquire the picture data in one loop and put it into a queue. Then use another loop to analyze the picture data when something is in the queue. When the queue is empty, this second loop will do nothing.
