I used a similar workflow I found on one this forum to implement it. It's working now, kind of, but the contrast isn't too great with the video we captured - could be a problem with data acquisition that we're working on fixing. Pupil is the trial video. I've also attached the video we recorded and are trying to work with. I got it to plot the centroid but I wanted to know if there was an easy way to automate the thresholding based on imaging conditions - preferably while capturing data realtime and feeding it into bonsai. (Attaching the videos as a drive link as it's too large to upload)
Another follow up I had was how to get this plot for the centroid from Bonsai to an Analog system using NI DAQ.
Thank you so much for your help!