Skip to content
Open
Show file tree
Hide file tree
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 Nov 11, 2025
51404dc
Improve result report
Myzhar Nov 11, 2025
8847f0e
Improve calibration feedback
Myzhar Nov 11, 2025
09e149d
Fix image reading error
Myzhar Nov 12, 2025
529a117
Debug info
Myzhar Nov 12, 2025
91eaad3
Improve target detection
Myzhar Nov 12, 2025
cb92b29
Add coverage Checker code
Myzhar Nov 13, 2025
7a40e46
Test calibration checker
Myzhar Nov 14, 2025
14b6b4e
Test sample collection completeness
Myzhar Nov 14, 2025
cf522f5
Calibration validated
Myzhar Nov 18, 2025
5342e6a
Change params diff check
Myzhar Nov 18, 2025
5b9ea50
Better user feedback
Myzhar Nov 19, 2025
d462be5
Fix sample diff checker
Myzhar Nov 19, 2025
9131b8c
TODO Check sample differences
Myzhar Nov 19, 2025
110f7cd
Add 4-zone coverage indicator
Myzhar Nov 20, 2025
db871e4
Check ZED X One model
Myzhar Nov 20, 2025
309b34d
Add function to save SDK conf file
Myzhar Nov 20, 2025
8dd778a
Save SDK calib file
Myzhar Nov 20, 2025
4f2108b
Fix Rotation vector for SDK calib file
Myzhar Nov 20, 2025
aa2f42d
Minor Fix
Myzhar Nov 20, 2025
f5430ee
Improve skew calc and fix SDK calib saving
Myzhar Nov 20, 2025
39d913d
Update stereo_calibration/src/opencv_calibration.cpp
Myzhar Nov 20, 2025
1c82ed5
Update stereo_calibration/src/calibration_checker.cpp
Myzhar Nov 20, 2025
e521ca3
Fixes by Copilot review
Myzhar Nov 20, 2025
467e127
Data type fix and param tuning
Myzhar Nov 20, 2025
6b0a943
fix fisheye disto export
P-yver Nov 28, 2025
8abe278
Merge branch 'improve_virtual_stereo' of github.com:stereolabs/zed-op…
Myzhar Dec 2, 2025
c74a81c
Add baseline value check
Myzhar Dec 2, 2025
9e88f8d
Add checkerboard params
Myzhar Dec 2, 2025
ce2c0f6
Improve user log feedback
Myzhar Dec 2, 2025
9ec055f
Improve user feedback
Myzhar Dec 2, 2025
7781ce4
Improvements
Myzhar Dec 2, 2025
ea5c491
Added minimum checkerboard area param
Myzhar Dec 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stereo_calibration/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"C_Cpp.errorSquiggles": "disabled"
}
Copy link

Copilot AI Nov 28, 2025

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.json should typically not be committed to version control as they represent personal development preferences. Consider adding .vscode/ to .gitignore instead. This setting disables error squiggles which may hide legitimate issues for other developers.

Copilot uses AI. Check for mistakes.
99 changes: 99 additions & 0 deletions stereo_calibration/include/calibration_checker.hpp
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(
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
Loading