Notes on the camera, stage-control, and feedback components discussed in my automated-transfer work. This page documents the building blocks and validation approach; it does not claim that a complete autonomous pick-up and release process has been demonstrated.
Hardware: coordinate systems and motion
The discussed control path uses a microscope camera and an MCNewton piezo stage with x, y, and z axes. Python communicates with the vendor LabVIEW VI through Windows COM. The class used in the earlier code was MCNewton_Set_Jiahui, with channel selection and a target position passed to the VI.
- Keep image pixels, stage coordinates, and physical sample coordinates distinct. Calibrate the direction and scale of each axis with small observed motions.
- Record the objective, camera resolution, crop, and magnification used for each calibration. A different imaging setup requires a fresh pixel-to-distance calibration.
- Separate lateral alignment from vertical approach. An image-match score alone does not measure contact, force, or clearance.
- Store commanded positions separately from measured feedback. A cached old_val is a software estimate, not independent confirmation of stage position.
Software: acquire, compare, move, verify
The earlier feedback discussion combined run_camera(), compare_image(), an image RMSE metric, and incremental calls to the stage setValue() method. A useful control sequence is: acquire a reference frame; acquire the current frame after settling; compare the same region of interest; decide whether a bounded movement is appropriate; acquire another frame; then check whether the error improved.
- Set maximum iterations, maximum travel, a minimum improvement threshold, and a clear manual stop.
- Keep a fixed region of interest and stable illumination. Exposure changes can alter RMSE without any actual displacement.
- Reject missing, saturated, or badly defocused frames rather than sending another motion command.
- Use a coarse-to-fine step size only after the motion direction and feedback sign have been verified.
- Save the reference image, current image, chosen displacement, timestamp, and resulting error for each iteration.
Focus scoring and image comparison
The focus-analysis workflows discussed alongside this project compared Tenengrad, a Sobel-plus-variance metric, and Laplacian variance within a selected ROI. Compare scores on the same crop and acquisition settings. Normalizing each dataset independently to [0,1] helps compare curve shapes, but removes absolute scale information between datasets.
import numpy as np
def normalize_scores(scores):
scores = np.asarray(scores, dtype=float)
if not np.all(np.isfinite(scores)):
raise ValueError("Focus scores must be finite")
span = np.ptp(scores)
return np.zeros_like(scores) if span == 0 else (scores - scores.min()) / spanGUI and integration notes
Keep the camera, stage driver, scan controller, and display as separate components. In the PyQt measurement-panel discussion, connection state and instrument tags belonged to reusable connection/tag panels, while scan controls were separate. Update plots without blocking the acquisition loop; in a standalone Matplotlib prototype, a short plt.pause() can display intermediate images, while a full application should use its GUI event loop.
Before a physical transfer, validate image processing on saved frames, stage commands with clear travel space, and the complete loop with conservative motion limits. Pick-up temperature, release temperature, contact detection, and stamp mechanics need their own experimentally established procedure.
Related: Python setup, instrument control, and data handling

发表评论