computer-vision-2/assignments/assignment_3/src/Frame3D/Frame3D.cpp
/* Load .3df file, the variables have to be loaded in the same order as they have been saved
 * TODO(morris) : make something like a header to check whether or not this is actually a legit .3DF file
 */
Load .3df file, the variables have to be loaded in the same order as they have been saved
TODO(morris) : make something like a header to check whether or not this is actually a legit .3DF file
Load . 3df file the variables have to be loaded in the same order as they have been saved TODO ( morris ) : make something like a header to check whether or not this is actually a legit . 3DF file
void Frame3D::load(string path) {
	int index = path.find_last_of('.');
	if (index > 0 && path.substr(index) == Frame3D::extension) {
		FileReader reader(path);
		version_ = reader.readDouble();
		if (version_ >= 1) {
			rgb_image_ 	 	 = reader.readImage();
			depth_image_ 	 = reader.readImage();
		} else {
			rgb_image_ 	 	 = reader.readMat();
			depth_image_  	 = reader.readMat();
		}
		if (version_ >= 1.2) {
			transformation_  = reader.readMat();
			syncTrans();
		} else {
			rotation_ 	 	 = reader.readMat();
			translation_ 	 = reader.readMat();
			syncTrans(rotation_, translation_);
		}
		focal_length_ = reader.readDouble();
		if (version_ >= 1.3)
			device_name_	 = reader.readString();
	} else {
		throw(runtime_error("this is not a valid " + Frame3D::extension + " file: " + path));
	}
}
void Frame3D :: load ( string path ) { int index = path . find_last_of ( ' ' ) ; if ( index > 0 && path . substr ( index ) == Frame3D :: extension ) { FileReader reader ( path ) ; version_ = reader . readDouble ( ) ; if ( version_ >= 1 ) { rgb_image_ = reader . readImage ( ) ; depth_image_ = reader . readImage ( ) ; } else { rgb_image_ = reader . readMat ( ) ; depth_image_ = reader . readMat ( ) ; } if ( version_ >= 1.2 ) { transformation_ = reader . readMat ( ) ; syncTrans ( ) ; } else { rotation_ = reader . readMat ( ) ; translation_ = reader . readMat ( ) ; syncTrans ( rotation_ , translation_ ) ; } focal_length_ = reader . readDouble ( ) ; if ( version_ >= 1.3 ) device_name_ = reader . readString ( ) ; } else { throw ( runtime_error ( " " + Frame3D :: extension + " " + path ) ) ; } }
Load .3df file, the variables have to be loaded in the same order as they have been saved
 TODO(morris) : make something like a header to check whether or not this is actually a legit .3DF file
Load . 3df file the variables have to be loaded in the same order as they have been saved TODO ( morris ) : make something like a header to check whether or not this is actually a legit . 3DF file