Skip to content
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

Feature Request: Additional Statistics for the Reprojection Error #21

Open
DanielSimsTOA opened this issue Jun 21, 2024 · 1 comment
Open

Comments

@DanielSimsTOA
Copy link

DanielSimsTOA commented Jun 21, 2024

Hi!

First, I want to express my appreciation for mrcal—it's been an invaluable tool for my projects.

I have a feature request concerning the reprojection error statistics provided by mrcal. Currently, I'm trying to obtain detailed statistics like the minimum, maximum, mean, and standard deviation of the reprojection errors directly through the Python API. While mrcal-calibrate-cameras provides some of this data, I've noticed discrepancies when attempting to calculate these statistics manually using the API. I'm pretty sure I am doing something wrong.

Here is the code snippet I've been working with:

import mrcal
import numpy as np

# Load the camera model and obtain optimization inputs
model = mrcal.cameramodel("camera-0.cameramodel")
optimization_inputs = model.optimization_inputs()

# Calculate reprojection error statistics from existing camera model. 
x_chessboard = mrcal.residuals_chessboard(optimization_inputs=optimization_inputs).ravel()

print("Standard deviation of reprojection errors:", np.std(x_chessboard))
print("Mean of reprojection errors:", np.mean(x_chessboard))
print("Root mean square of reprojection errors:", np.sqrt(np.mean(x_chessboard**2)))
print("Maximum reprojection error:", np.max(x_chessboard))
print("Minimum reprojection error:", np.min(x_chessboard))

Is it possible to enhance mrcal to natively support these statistical computations? Am I missing something with the Python API?

Having these directly available would be beneficial to my project.

Thanks for considering this enhancement. Please let me know if you need any more details or if there's a workaround I might have missed.

Best Regards,
Daniel Sims

@dkogan
Copy link
Owner

dkogan commented Jun 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants