kopia lustrzana https://github.com/OpenDroneMap/ODM
				
				
				
			added output of the final transform to text file (also fixed a small typo)
							rodzic
							
								
									98018b8b8b
								
							
						
					
					
						commit
						d9717678f4
					
				| 
						 | 
				
			
			@ -279,6 +279,8 @@ void Georef::parseArguments(int argc, char *argv[])
 | 
			
		|||
    logFile_ = std::string(argv[0]) + "_log.txt";
 | 
			
		||||
    log_ << logFile_ << "\n";
 | 
			
		||||
    
 | 
			
		||||
    finalTransformFile_ = std::string(argv[0]) + "_transform.txt";
 | 
			
		||||
    
 | 
			
		||||
    // If no arguments were passed, print help.
 | 
			
		||||
    if (argc == 1)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -877,8 +879,10 @@ void Georef::performGeoreferencingWithGCP()
 | 
			
		|||
                             gcps_[gcp0].getReferencedPos(), gcps_[gcp1].getReferencedPos(), gcps_[gcp2].getReferencedPos());
 | 
			
		||||
    log_ << "Final transform:\n";
 | 
			
		||||
    log_ << transFinal.transform_ << '\n';
 | 
			
		||||
    
 | 
			
		||||
    printFinalTransform(transFinal.transform_);
 | 
			
		||||
 | 
			
		||||
    // The tranform used to transform model into the georeferenced system.
 | 
			
		||||
    // The transform used to transform model into the georeferenced system.
 | 
			
		||||
    Eigen::Transform<float, 3, Eigen::Affine> transform;
 | 
			
		||||
 | 
			
		||||
    transform(0, 0) = static_cast<float>(transFinal.transform_.r1c1_);
 | 
			
		||||
| 
						 | 
				
			
			@ -1056,7 +1060,9 @@ void Georef::createGeoreferencedModelFromExifData()
 | 
			
		|||
    log_ << "Final transform:\n";
 | 
			
		||||
    log_ << transFinal.transform_ << '\n';
 | 
			
		||||
    
 | 
			
		||||
    // The tranform used to move the chosen area into the ortho photo.
 | 
			
		||||
    printFinalTransform(transFinal.transform_);
 | 
			
		||||
    
 | 
			
		||||
    // The transform used to move the chosen area into the ortho photo.
 | 
			
		||||
    Eigen::Transform<float, 3, Eigen::Affine> transform;
 | 
			
		||||
    
 | 
			
		||||
    transform(0, 0) = static_cast<float>(transFinal.transform_.r1c1_);    transform(1, 0) = static_cast<float>(transFinal.transform_.r2c1_);
 | 
			
		||||
| 
						 | 
				
			
			@ -1311,6 +1317,30 @@ void Georef::printGeorefSystem()
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void Georef::printFinalTransform(Mat4 transform)
 | 
			
		||||
{
 | 
			
		||||
    if(outputObjFilename_.empty())
 | 
			
		||||
    {
 | 
			
		||||
        throw GeorefException("Output file path empty!.");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    std::string tmp = outputObjFilename_;
 | 
			
		||||
    size_t findPos = tmp.find_last_of(".");
 | 
			
		||||
    
 | 
			
		||||
    if(std::string::npos == findPos)
 | 
			
		||||
    {
 | 
			
		||||
        throw GeorefException("Tried to generate default ouptut file, could not find .obj in the output file:\n\'"+outputObjFilename_+"\'");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    log_ << '\n';
 | 
			
		||||
    log_ << "Saving final transform file to \'" << finalTransformFile_ << "\'...\n";
 | 
			
		||||
    std::ofstream transformStream(finalTransformFile_.c_str());
 | 
			
		||||
    transformStream << transform << std::endl;
 | 
			
		||||
    transformStream.close();
 | 
			
		||||
    log_ << "... final transform saved.\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool Georef::loadObjFile(std::string inputFile, pcl::TextureMesh &mesh)
 | 
			
		||||
{
 | 
			
		||||
    int data_type;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -227,6 +227,11 @@ private:
 | 
			
		|||
      **/
 | 
			
		||||
    void printGeorefSystem();
 | 
			
		||||
    
 | 
			
		||||
    /*!
 | 
			
		||||
      * \brief printFinalTransform      Prints a file containing the final transform, next to the output file.
 | 
			
		||||
      **/
 | 
			
		||||
    void printFinalTransform(Mat4 transform);
 | 
			
		||||
    
 | 
			
		||||
    /*!
 | 
			
		||||
      * \brief Loads a model from an .obj file (replacement for the pcl obj loader).
 | 
			
		||||
      *
 | 
			
		||||
| 
						 | 
				
			
			@ -248,6 +253,8 @@ private:
 | 
			
		|||
    Logger          log_;                       /**< Logging object. */
 | 
			
		||||
    std::string     logFile_;                   /**< The path to the output log file. */
 | 
			
		||||
    
 | 
			
		||||
    std::string     finalTransformFile_;        /**< The path to the file for the final transform. */
 | 
			
		||||
    
 | 
			
		||||
    std::string     bundleFilename_;            /**< The path to the cameras bundle file. **/
 | 
			
		||||
    std::string     inputCoordFilename_;        /**< The path to the cameras exif gps positions file. **/
 | 
			
		||||
    std::string     outputCoordFilename_;       /**< The path to the cameras georeferenced gps positions file. **/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue