-
Notifications
You must be signed in to change notification settings - Fork 266
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
WPIcal documentation initial draft #2691
base: main
Are you sure you want to change the base?
Conversation
Great stuff so far overall! Great to see this coming together. |
source/docs/software/wpilib-tools/wpical/images/ChArUcoDetection.png
Outdated
Show resolved
Hide resolved
.. image:: images/Calibrate.png | ||
:alt: Calibrate | ||
|
||
There are two options for calibrating your camera, :guilabel:`OpenCV` and :guilabel:`MRcal`. It is generally recommended to calibrate with :guilabel:`MRcal`, as it has slightly better accuracy and is more robust against bad calibration data. WPIcal uses a ChArUco board for camera calibration. You can generate a ChArUco board here: `calib.io <https://calib.io/pages/camera-calibration-pattern-generator>`_ |
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.
Any particular recommendations on board width/height? I noticed the gui defaults to 12x8. And whitch dictionary should I be using?
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.
(wpical seems to be hard-coded to 5x5?)
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.
Yes the calibration is hard coded to 5x5. I was testing with a 12x8 board and it seemed to work well. I haven't tested other widths or heights too thoroughly. The optimal dimensions will vary camera to camera right?
|
||
Camera Calibration | ||
------------------ | ||
To measure the distance between tags in a video, you need the camera's intrinsics to account for things like distortion. WPIcal allows users to upload a video file to calibrate the camera in the tool, or upload a JSON file with your camera's intrinsics |
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.
How should I capture a video file? I was able to do it on linux with gstreamer, but it was pretty non-trivial.
gst-launch-1.0 -vvv v4l2src device=/dev/video0 extra-controls="c,gain=25,exposure_auto=1" ! image/jpeg,format=MJPG,width=1600,height=1200,framerate=50/1 ! jpegdec ! videoconvert ! tee name=t t. ! queue ! autovideosink t. ! queue ! videoconvert ! avimux ! filesink location=output.avi
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.
I've been using a phone camera and then transferring the file to a computer to calibrate. For linux It will need to be transcoded. Do you think we should document how to capture the video for linux machines too?
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.
|
||
.. warning:: CalibDB calibrations have been known to fail when bad snapshots are taken. If your calibration data looks suspect, repeat calibration process again. | ||
|
||
Custom JSON |
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.
Do you think there's any value in supporting the photonvision JSON format directly? It's fairly similar
{
"resolution":{"width":1600.0,"height":1200.0},
"cameraIntrinsics":{"rows":3,"cols":3,"type":6,"data":[894.6473376999364,0.0,793.0568907406183,0.0,894.5611200668925,667.7549963404546,0.0,0.0,1.0]},
"distCoeffs":{"rows":1,"cols":8,"type":6,"data":[-0.04029854641739141,-0.03601719361588292,-0.0016269824645254384,-6.609780019207605E-4,0.14767766830679485,-0.09429815218469685,0.057468937992229234,0.11574241865507603]},
"calobjectWarp":[6.226950423907065E-4,6.020992541813042E-5]
}
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.
You mean if teams want to use their PV calibrations and cameras for field calibration?
Linux Users Only: | ||
***************** | ||
Linux users must transcode all videos to MJPEG codec without an audio stream in an .avi file before uploading to WPIcal. This can be done with an ffmpeg command: | ||
``ffmpeg -i <video_file.mp4> -f avi -c:v mjpeg -b:v 4000k -an <video_file.avi>`` |
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.
Note that -b:v 4000k
is totally arbitrary
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.
Do you think this is a good default?
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.
I have no idea, I just stole it from stackoverflow
Adds initial draft of documentation for new WPIcal tool: wpilibsuite/allwpilib#6915