I want to set up a rapid loop of updating a screen with some image data and then fetching the result with a webcam that is pointed at the screen (the idea is to sample hundreds of cycles, change some external filter between the screen and camera, and sample again).
How can I update an already existing imshowDict with new image data? The new data has the same dimensions and type as the old one. The updated imshow window should not move in relation to the physical screen from update to update.
I’m convinced that I need to connect the call to imshow with a Signal of an image, and then just push! to that signal, but I can’t get it to work…
Not sure what plotting library you’re using, but I’ve been playing around with Makie.jl for this sort of thing and it’s great (though still in development).
I’ve got some code here that updates a heatmap display with a 2D matrix representing an scrolling audio spectrogram, which seems to perform really well.
Also note that code isn’t a particularly great audio DSP example because it doesn’t do any windowing so there’s a lot of spectral leakage. It should get the point across, though
Cool! Well, because I’m only updating an image, I thought ImageView.imshow would do. But I’ve been meaning to try Makie for a while now, so maybe this should be it!
I do think there’s a way to get ImageView to do what you want, I’m pretty sure I’ve seen Tim demo animations and videos before. Unhelpfully I don’t know how though.
rather than creating a new image object you can just update the data for the existing one with img = image(olddata); img[:image] = newdata. Not sure how much overhead this saves, but I’d guess it’s at least slightly more efficient. This might act strangely if the image size changes though.