Before I try to post something on stackexchange (where I would have to do a bunch of work to produce abridged code for people to review), I thought I’d ask here to see if anyone knows the answer.
I’m working on an image-based calibration and I have two box layouts on the screen, one displays a live feed from the webcam and the second displays a snapshot of an image from the webcam that is used for calibration. I have a series of buttons that I press to make the measurements happen. The first is “calibrate” and when I press that, the kivy widget calls a specific routine that takes the current frame from the live feed, performs calculations, and then shows that image in the second box layout. This works fine. When I press a button to move the sled to a particular spot (say +2 inch, +2 inch) and take the same measurement, the resulting image on the second box layout is all black. I know the image is good (i.e., not a black image) because I save it to the disk in the very routine that updates the image… the image is fine.
The difference between the pressing “calibrate” and pressing “move to +2, +2” is that the function to calibrate is called directly from the kivy button widget. However, when I press the “move to +2, +2” button, it calls a function that sends a command to the firmware to move the sled to that position. It also sets the logger to callback to the measurement function once the logger sees that the sled is done moving. The callback is to the same function that the calibrate widget calls. This all works, but the image that gets displayed is all black and not the image that is in memory. I can update text on the screen with no problem (I report the measurement error on a part of the screen) but all image updates done this way are all black. If I hit the “calibrate” button again, it works. So the issue seems to be related to the fact that the function is called from a callback and not directly from the widget… why this matters is beyond me.