-
Notifications
You must be signed in to change notification settings - Fork 1
Improve Virtual Stereo Calibration #1
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
Open
Myzhar
wants to merge
33
commits into
main
Choose a base branch
from
improve_virtual_stereo
base: main
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.
+1,652
−720
Open
Changes from 21 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f69e462
Add parameters for Virtual Stereo init
Myzhar 51404dc
Improve result report
Myzhar 8847f0e
Improve calibration feedback
Myzhar 09e149d
Fix image reading error
Myzhar 529a117
Debug info
Myzhar 91eaad3
Improve target detection
Myzhar cb92b29
Add coverage Checker code
Myzhar 7a40e46
Test calibration checker
Myzhar 14b6b4e
Test sample collection completeness
Myzhar cf522f5
Calibration validated
Myzhar 5342e6a
Change params diff check
Myzhar 5b9ea50
Better user feedback
Myzhar d462be5
Fix sample diff checker
Myzhar 9131b8c
TODO Check sample differences
Myzhar 110f7cd
Add 4-zone coverage indicator
Myzhar db871e4
Check ZED X One model
Myzhar 309b34d
Add function to save SDK conf file
Myzhar 8dd778a
Save SDK calib file
Myzhar 4f2108b
Fix Rotation vector for SDK calib file
Myzhar aa2f42d
Minor Fix
Myzhar f5430ee
Improve skew calc and fix SDK calib saving
Myzhar 39d913d
Update stereo_calibration/src/opencv_calibration.cpp
Myzhar 1c82ed5
Update stereo_calibration/src/calibration_checker.cpp
Myzhar e521ca3
Fixes by Copilot review
Myzhar 467e127
Data type fix and param tuning
Myzhar 6b0a943
fix fisheye disto export
P-yver 8abe278
Merge branch 'improve_virtual_stereo' of github.com:stereolabs/zed-op…
Myzhar c74a81c
Add baseline value check
Myzhar 9e88f8d
Add checkerboard params
Myzhar ce2c0f6
Improve user log feedback
Myzhar 9ec055f
Improve user feedback
Myzhar 7781ce4
Improvements
Myzhar ea5c491
Added minimum checkerboard area param
Myzhar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "C_Cpp.errorSquiggles": "disabled" | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| #ifndef CALIBRATION_CHECKER_HPP | ||
| #define CALIBRATION_CHECKER_HPP | ||
|
|
||
| #include <opencv2/opencv.hpp> | ||
|
|
||
| typedef struct _board { | ||
| cv::Size board_size = { | ||
| 0, 0}; // Number of inner corners per a chessboard row and column | ||
| float square_size = | ||
| 0.0f; // Size of a square in your defined unit (point, millimeter,etc). | ||
| std::vector<cv::Point3f> objp; // 3D points in real world space | ||
| cv::Size2f board_size_mm = {0.0f, 0.0f}; // Physical size of the board in mm | ||
| } Board; | ||
|
|
||
| typedef struct _detected_board_params { | ||
| cv::Point2f pos = { | ||
| -1.0f, -1.0f}; // Normalized position of the checkerboard in the image | ||
| float size = -1.0f; // Normalized size of the checkerboard | ||
| float skew = -1.0f; // Normalized skew of the checkerboard | ||
| } DetectedBoardParams; | ||
|
|
||
| // Constants | ||
| const size_t DEFAULT_MIN_SAMPLES = 20; | ||
| const size_t DEFAULT_MAX_SAMPLES = 50; | ||
| const DetectedBoardParams DEFAULT_IDEAL_PARAMS = { | ||
| cv::Point2f( | ||
| 0.65f, // Checkerboard X position should cover 65% of the image width | ||
| 0.65f // Checkerboard Y position should cover 65% of the image height | ||
| ), | ||
| 0.4f, // Checkerboard size variation should be at least 40% | ||
| 0.6f // Checkerboard skew variation should be at least 70% | ||
| }; // Ideal parameters for a good sample database | ||
|
|
||
| class CalibrationChecker { | ||
| public: | ||
| CalibrationChecker(cv::Size board_size, float square_size, | ||
| size_t min_samples = DEFAULT_MIN_SAMPLES, | ||
| size_t max_samples = DEFAULT_MAX_SAMPLES, | ||
| DetectedBoardParams idealParams = DEFAULT_IDEAL_PARAMS, | ||
| bool verbose = false); | ||
| ~CalibrationChecker() = default; | ||
|
|
||
| // Test if the detected corners form a valid sample | ||
| bool testSample(const std::vector<cv::Point2f>& corners, cv::Size image_size); | ||
|
|
||
| // Retrieve valid corners | ||
| const std::vector<std::vector<cv::Point2f>>& getValidCorners() const { | ||
| return validCorners_; | ||
| } | ||
|
|
||
| // Retrieve valid sample count | ||
| size_t getValidSampleCount() const { return validCorners_.size(); } | ||
|
|
||
| // Calculate the sample collection status according to the stored samples | ||
| bool evaluateSampleCollectionStatus(float& size_score, float& skew_score, | ||
| float& pos_score_x, | ||
| float& pos_score_y) const; | ||
|
|
||
| // Retrieve the last detected board parameters | ||
| const DetectedBoardParams& getLastDetectedBoardParams() const; | ||
|
|
||
| private: | ||
| // Calculate the parameter of a detected checkerboard | ||
| DetectedBoardParams getDetectedBoarParams( | ||
Myzhar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const std::vector<cv::Point2f>& corners, cv::Size image_size); | ||
|
|
||
| // Check if the detected corners are valid | ||
| bool isGoodSample(const DetectedBoardParams& params); | ||
|
|
||
| // Helper functions | ||
| std::vector<cv::Point2f> get_outside_corners( | ||
| const std::vector<cv::Point2f>& | ||
| corners); // Get the 4 outside corners of a checkerboard | ||
| float compute_skew( | ||
| const std::vector<cv::Point2f>& | ||
| outside_corners); // Compute skew based on the 4 outside corners | ||
| float compute_area( | ||
| const std::vector<cv::Point2f>& | ||
| outside_corners); // Compute area based on the 4 outside corners | ||
|
|
||
| private: | ||
| Board board_; | ||
|
|
||
| std::vector<DetectedBoardParams> | ||
| paramDb_; // Database of previously detected board parameters | ||
| std::vector<std::vector<cv::Point2f>> | ||
| validCorners_; // All the corners associated to the single parameters in | ||
| // paramDb_ | ||
|
|
||
| DetectedBoardParams idealParams_ = DEFAULT_IDEAL_PARAMS; | ||
| size_t min_samples_ = DEFAULT_MIN_SAMPLES; // Minimum number of samples to | ||
| // consider the database complete | ||
| size_t max_samples_ = DEFAULT_MAX_SAMPLES; // Maximum number of samples to | ||
| // consider the database complete | ||
|
|
||
| bool verbose_ = false; | ||
| }; | ||
|
|
||
| #endif // CALIBRATION_CHECKER_HPP | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDE-specific configuration files like
.vscode/settings.jsonshould typically not be committed to version control as they represent personal development preferences. Consider adding.vscode/to.gitignoreinstead. This setting disables error squiggles which may hide legitimate issues for other developers.