-
Notifications
You must be signed in to change notification settings - Fork 7
Imagery & Cameras
How to Calibrate a Monocular Camera
guvcview is a standardized camera interfacing application and is a great first step in making sure a uvc camera is functioning correctly.
OpenCV is an all-in-one general purpose image processing library.
sudo apt install ros-kinetic-vision-opencv
Image Transport allows for smart and convenient handling of image streams and compressed images.
sudo apt install ros-kinetic-image-transport ros-kinetic-image-transport-plugins
The RQT Image View Plugin allows for image streams to be viewed in RQT.
sudo apt install ros-kinetic-rqt-image-view
TODO: Put this in a comparison table
- uvc_camera - Unsupported
- libuvc_camera - Unsupported
- usb_cam - Supports the widest range of cameras
- cv_camera
- video_stream_opencv - This is the best general purpose one to date
- raspicam_node - This is the only option for interfacing with the Raspberry Pi Camera
To export images to a video file, there are a few things that you will need to do first:
- Create a working directory folder:
mkdir /tmp/video_export
- Download the export script to the working folder. Note that this will export
.png
compressed images and dump them into your the directory:
cd /tmp/video_export
wget https://raw.githubusercontent.com/qutas/info/master/Scripts/image_saver.py
- Figure out the framerate your video was running at (use
rostopic hz /webcam/image_raw/compressed
, but for your camera/image topic)
To do the actual export process, open three different terminals and run the following commands:
- Terminal 1:
roscore
- Terminal 2:
cd /tmp/video_export
python image_saver.py /camera_name/image_topic
# OR: python image_saver.py /camera_name/image_topic/compressed
- Terminal 3 (replace
BAG_FILE_NAME
as with your bag file recording):
rosbag play BAG_FILE_NAME
Once the bag file recording is complete, the image files should now be saved in /tmp/video_export
The final step is to recombine all the images into a video file. To do this, we can use the tool ffmpeg.
The only trick here is that our image filenames are saved using their timestamps, so they may will need to be renamed such that ffmpeg can easily accept them:
cd /tmp/video_export
ls -v *.png | gawk 'BEGIN{ a=1 }{ printf "mv %s %06d.png\n", $0, a++ }' | bash
Finally, we can combine our images into a video (make sure to enter the framerate of your video in FRAMERATE
):
ffmpeg -r FRAMERATE -i %06d.png -c:v libx264 -vf fps=30 -pix_fmt yuv420p out.mp4
Your exported video should now be compiled!
- Home
- Common Terminology
- UAV Setup Guides (2024)
- UAV Setup Guides (2022)
- UAV Setup Guides (2021)
- UAV Setup Guides (--2020)
- General Computing
- On-Board Computers
- ROS
- Sensors & Estimation
- Flight Controllers & Autopilots
- Control in ROS
- Navigation & Localization
- Communications
- Airframes
- Power Systems
- Propulsion
- Imagery & Cameras
- Image Processing
- Web Interfaces
- Simulation