Open romainbrette opened 3 years ago
It could be interesting to check the precision of template matching with interpolation on the z axis (eg with random movements).
Regarding (1) in manipulator calibration: images are already saved in ./screenshots/.
One thing I noticed is that there seems to be some oscillation after a z step. This might be due to settings on the controller. In any case, it might be an issue because the program only sleeps for 0.1 second (maybe this should be a parameter).
I note also that the stack uses fast moves. I propose to switch to relative moves, which by default uses step moves on the L&N. However, currently step moves don't specify the velocity, maybe they should. Also, it would make sense to have step moves with fixed step distance.
Regarding (2), one subtlety is M[:,i] is the movement for a 1 µm displacement along the axis, in the camera plane and microscope axis. This means the first two coordinates are in pixels and the last one is in µm, so it is not simple to normalize the matrix. A correct way to do it would be to write for each axis the squared length in µm, as a function of µm/pixel and a correction factor (close to 1). This gives a matrix problem with 4 unknowns, and we may want to minimize, say the correction factors ((c-1)^2).
It turns out that making relative moves (steps) instead of absolute moves vastly improves the results.
(1), (3), (4) and (6) are implemented. Normalization makes a small improvement (but not very significant). We get an error of ~8 pixels. It would be interested to test whether it depends on SNR, eg by changing exposure or taking several images.
(5) is implicitly implemented, ie we only keep the matrix giving best error. For (7): the stage is recentered after each pass, and then the reference offset vector is calculated so that this position is 0. The matrix is not discarded, but it's not a big deal: an error would show up in the next test.
Currently it uses the previous calibration to make the next movement (with fixed targets in camera frame), and we calculate the error. This is probably ok. A possibility would be to keep in memory all the previous matrices and compare them all.
There were issues with corners (which are black), such that it was necessary to crop the image (by 10%). Possibly some preprocessing (high-pass filtering?) might improve the results.
Overall this seems to work ok, with possibly some room for improvement in template matching:
For manipulator calibration, I suggest:
Calibration gives poor results. Some ideas to improve.
Improving stage calibration
Improving manipulator calibration