IO
Camera IO
camera.h
int read_camera(const std::string fname, Camera& camera);
int write_camera(const std::string fname, const Camera& camera);
camera IO method to read/write Camera
data from/to a file fname
.
Exif IO
exif_io.h
// to be done
method to extract focal length (pix) from EXIF tag.
When you take a photo with almost any digital camera, the camera embeds useful information about the photo into the JPEG file itself. This often includes information about exposure time, focus, aperture, whether the flash was activated, and focal length. The last of these, focal length, is especially useful when creating panoramas. This tutorial describing how to extract the focal length from the EXIF tags of a digital photo and to convert it to pixel units can be found here.
summarized steps
- extract the EXIF tags: find focal length in mm
- find the CCD width: find sensor/image width in mm
- convert from millimeters to pixels:
Keypoint IO
keypoint_io.h
int read_keypoints(const std::string fname, std::vector<Keypoint>& keypoints);
int write_keypoints(const std::string fname, const std::vector<Keypoint>& keypoints);
keypoint IO methods, which read/write Keypoint
data from/to a file fname
. The format of the file is as follows, note that all components but the first two are optional.
[x-coordinate] [y-coordinate] [scale] [orientation] [color] [image index]
Descriptor IO
descriptor_io.h
int read_descriptors(const std::string fname, std::vector<Vecf>& descriptors);
int write_descriptors(const std::string fname, const std::vector<Vecf>& descriptors);
descriptor IO methods, which read/write Descriptor
data from/to file fname
.
Match IO
match_io.h
int read_matches(const std::string fname, std::vector<DMatch>& matches);
int write_matches(const std::string fname, const std::vector<DMatch>& matches);
match IO methods, which read/write DMatch
data to/from file fname
. The format of the file is as follows:
[index of keypoint 1] [index of keypoint 2] [x-coordinate of keypoint 1] [y-coordinate of keypoint 1] [x-coordinate of keypoint 2] [y-coordinate of keypoint 2] [descriptor distance]
Graph IO
graph_io.h
int read_graph(const std::string fname, Graph& graph);
int write_graph(const std::string fname, const Graph& graph);
Graph
IO methods, which read/write Graph
data to/from file fname
. The format of the file is as follows:
[number of images: I] [index of image 1] ... [index of image I]
[parameters of camera 1]
...
[parameters of camera I]
[number of tracks: T]
[number of keypoints in track 1: K_1] [x-coordinate of keypoint 1] [y-coordinate of keypoint 1] [image index of keypoint 1] ... [x-coordinate of keypoint K_1] [y-coordinate of keypoint K_1] [image index of keypoint K_1]
...
[number of keypoints in track T: K_T] [x-coordinate of keypoint 1] [y-coordinate of keypoint 1] [image index of keypoint 1] ... [x-coordinate of keypoint K_T] [y-coordinate of keypoint K_T] [image index of keypoint K_T]
[number of structure point: S]
[x-coordinate of struct_point 1] [y-coordinate of struct_point 1] [z-coordinate of struct_point 1]
...
[x-coordinate of struct_point S] [y-coordinate of struct_point S] [z-coordinate of struct_point S]
SfM IO
sfm_io.h
int write_sfm(const std::string dir, const Graph& graph)
method to write the camera parameters estimated by SfM to files that are compatible with existing MVS softwares, currently support PMVS.