-
Notifications
You must be signed in to change notification settings - Fork 47
feat: laser autofocus improvement #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Alpaca233
wants to merge
26
commits into
Cephla-Lab:master
Choose a base branch
from
Alpaca233:af-scan
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Alpaca233
commented
Jan 24, 2026
- search laser spot when it's out of range
- new spot detection method (connected component)
- fixes
- apply Gaussian filter to both reference and measurement images
- use Displacement Successful Window
- Replace find_spot_location() with connected components algorithm using cv2.connectedComponentsWithStats() for improved robustness - Add new CC parameters: cc_threshold, cc_min_area, cc_max_area, cc_row_tolerance - Remove old line profile parameters and intensity profile RMSE check - Update LaserAFConfig, UI widgets, and settings manager - Simplify return signature to (x, y) tuple - Add debug plot visualization for connected components detection - Update tests for new implementation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ignore_row_tolerance parameter to _get_laser_spot_centroid() to disable row filtering during initialization when spot location is unknown - Add piezo delay after each move in search loop to allow piezo to settle before attempting spot detection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Save intermediate laser AF camera images when characterization_mode is enabled:
- Image after measurement (after search if triggered)
- Image used for cross-correlation verification
Images saved to /tmp/laser_af_{timestamp}_{step}.bmp
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove _3_after_restore debug image (already saved by acquisition) - Fix failure_return_value type from np.array to float scalar Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add self.debug_image for characterization mode (only set on successful detection) - self.image always stores latest captured frame (for error debugging) - Characterization mode saves (_1_measurement.bmp, _2_cc_verify.bmp) now use debug_image - Fixes issue where trigger image was saved instead of successful detection image Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… displacement window - Add cc_max_aspect_ratio parameter (default 2.5) to filter elongated shapes - Change default filter_sigma from None to 1 (enable Gaussian blur) - Rename displacement_success_window_um to displacement_success_window_pixels - Set default displacement window to 300 pixels - Update UI spinboxes for new parameters Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add missing piezo delay after _move_z in move_to_target before CC verification - Add missing if self.piezo check for calibration delay (line 219) - Apply Gaussian filter to both reference and current crops in CC comparison when filter_sigma is configured Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed spinbox key from displacement_success_window_um to displacement_success_window_pixels to match the created spinbox name. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…cted peak Previously, cross-correlation verification cropped around the detected spot position, which allowed debris/contamination spots to pass the CC check if their shape was consistent. Now we crop around the reference position, so off-position spots will appear off-center in the crop, resulting in low correlation and failing the check. Also added warning log when detected spot is >20 pixels from reference, indicating possible debris/contamination. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.