RaspiCalib
RapiCalib is a camera calibration app from an OpenCV tutorial modified to work directly with the Raspberry Pi camera.
A modified RaspiVid application is used to provide the image data (in a way
similar to the RaspiCV project). The original RaspiVid.c
is modified (see
d019d18) to pass image and motion vector buffers to callbacks defined in
cv.h
. File cv.cpp
implements these callbacks and provides the latest
captured frame to class RaspiVideoCapture
.
The camera_calibration code and the XML configuration file come from the
OpenCV library. The original camera_calibration.cpp
is modified (see
e2bbc46) to support the Raspberry Pi camera.
The exact camera configuration (parametrs passed to the RaspiVid) is in cv.cpp
(function process_thread
). Currently the configuraton is limited to grayscale
format. This can be easily modified (see function cv_init()
).
Building
First build the OpenCV library (version 3.1.0) and make sure it is
registered by pkg-config
:
pkg-config --libs opencv
Then make the USERLAND_DIR
variable in Makefile
point to Raspberry Pi's
userland repository. Makefile
references some files required by
RaspiCV.c
.
Finally, build the application by make
and run it by make run
or:
raspicalib default.xml
The application works exactly as described in the tutorial. The Raspberry
Pi camera is used if you set the Input
element in the XML configuration file
to any number in range 0 to 9, e.g. <Input>"1"</Input>
.
Acknowledgements
The camera calibration code and tutorial was written by Bernát Gábor as a part of the OpenCV library (license).