Merge pull request #717 from pierotofy/georef

Handle bundler files that have invalid/empty camera parameters

Former-commit-id: 293bdfec57
pull/1161/head
Dakota Benjamin 2017-11-28 11:20:15 -05:00 zatwierdzone przez GitHub
commit e08af050b8
2 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -190,6 +190,11 @@ Vec3 GeorefCamera::getReferencedPos()
return Vec3(easting_,northing_,altitude_);
}
bool GeorefCamera::isValid()
{
return focalLength_ != 0 && k1_ != 0 && k2_ != 0;
}
std::ostream& operator<<(std::ostream &os, const GeorefCamera &cam)
{
os << "Focal, k1, k2 : " << cam.focalLength_ << ", " << cam.k1_ << ", " << cam.k2_ << "\n";
@ -1058,7 +1063,15 @@ void Georef::createGeoreferencedModelFromExifData()
{
throw GeorefException("Not enough cameras in \'" + inputCoordFilename_ + "\' coord file.\n");
}
// Remove invalid cameras
std::vector<GeorefCamera> goodCameras;
for (size_t i = 0; i < cameras_.size(); i++){
if (cameras_[i].isValid()) goodCameras.push_back(GeorefCamera(cameras_[i]));
}
cameras_.clear();
cameras_ = goodCameras;
// The optimal camera triplet.
size_t cam0, cam1, cam2;

Wyświetl plik

@ -95,6 +95,11 @@ struct GeorefCamera
* \brief getReferencedPos Get the georeferenced position of the camera.
*/
Vec3 getReferencedPos();
/*!
* \brief isValid Whether this camera is valid based on its parameters.
*/
bool isValid();
double focalLength_; /**< The focal length of the camera. */
double k1_; /**< The k1 lens distortion parameter. **/