void PhotoCamera::buildIntrinsic() { //Projection Matrix Eigen::Matrix3f Mi; // cout << "focal length: " << focalLength << endl; // cout << "1/dx: " << oneOverDx << endl; // cout << "1/dy: " << oneOverDy << endl; Mi << -focalLength*oneOverDx, 0, principalPoint(0), 0, -focalLength*oneOverDy, principalPoint(1), 0, 0, 1; intrinsicMatrix.topLeftCorner(3, 3) = Mi; }
//***************************************************************************** // BuckeyeSMPlugin::constructSensorModelFromISD //***************************************************************************** TSMWarning *BuckeyeSMPlugin::constructSensorModelFromISD( const tsm_ISD& image_support_data, const std::string& sensor_model_name, TSMSensorModel*& sensor_model) const throw (TSMError) { TSMWarning * tsmWarn = NULL; std::string myname("BuckeyeSMPlugin::constructSensorModelFromISD"); bool isISDSupported = false; //canSensorModelBeConstructedFromISD(image_support_data, sensor_model_name, isISDSupported); const filenameISD * filenameObject = dynamic_cast<const filenameISD*>(&image_support_data); ossimFilename frameMetaGsti; ossimRefPtr<ossimImageHandler> ih; ossimFilename frameNumber; if(filenameObject) { ossimFilename file(filenameObject->_filename); if(file.ext() == "tif") { std::cout << "********* tif\n"; // Temporary -- Tiff development is underway but not operational } ossimFilename dir(file.path()); frameNumber = file.fileNoExtension(); frameMetaGsti = dir.dirCat("FrameMeta_GSTI.txt"); ih = ossimImageHandlerRegistry::instance()->open(file); if(frameMetaGsti.exists()&&ih.valid()) { isISDSupported = true; } } BuckeyeSensorModel* result = 0; if (isISDSupported) { ossimDpt pixelSize(.0068, .0068); // Note: This system only works for Square pixels....... ossimDpt principalPoint(-0.1853,1.2428); double focalLength = 211.0211; ossimIrect imageRect = ih->getBoundingRect(); double roll = 0.0; double pitch = 0.0; double yaw = 0.0; ossimGpt platformPosition; bool frameNumberFound = false; ossimCsvFile csv(" \t"); // we will use tab or spaces as separator if(csv.open(frameMetaGsti)) { if(csv.readHeader()) { ossimRefPtr<ossimCsvFile::Record> record; while( ((record = csv.nextRecord()).valid()) && !frameNumberFound) { if( (*record)["Frame#"] == frameNumber) { frameNumberFound = true; roll = (*record)["Roll(deg)"].toDouble(); pitch = (*record)["Pitch(deg)"].toDouble(); yaw = (*record)["Yaw(deg)"].toDouble(); platformPosition = ossimGpt((*record)["Lat(deg)"].toDouble(), (*record)["Lon(deg)"].toDouble(), (*record)["HAE(m)"].toDouble()); } } } if(frameNumberFound) { result = new BuckeyeSensorModel(); BuckeyeSensorModel *bkSensorModel = static_cast<BuckeyeSensorModel*>(result); bkSensorModel->buckeye->setRollPitchHeading(roll, pitch, yaw); bkSensorModel->buckeye->setFocalLength(focalLength); bkSensorModel->buckeye->setPlatformPosition(platformPosition); bkSensorModel->buckeye->setPrincipalPoint(principalPoint); bkSensorModel->buckeye->setPixelSize(pixelSize); ossimSmacCallibrationSystem* distortion = new ossimSmacCallibrationSystem(1.06545826E-002, -1.58699040E-005, 1.12448462E-009, -8.67450914E-013, 0, 5.92909E-006, -1.66339E-005, 0, 0); bkSensorModel->buckeye->setLensDistortion(distortion); bkSensorModel->buckeye->setImageRect(imageRect); bkSensorModel->buckeye->updateModel(); bkSensorModel->setSensorPosition(platformPosition); bkSensorModel->setPrincipalPoint(principalPoint); bkSensorModel->setFocalLength(focalLength); bkSensorModel->setPixelSize(pixelSize); bkSensorModel->setImageSize(imageRect.height(), imageRect.width()); bkSensorModel->setReferenceDateAndTime("Date TIME"); #if 0 testBuckeyeCSMSensor(bkSensorModel); #endif } } } if(!result) { TSMError tsmError = TSMError(TSMError::ISD_NOT_SUPPORTED, "Unable to create sensor model from ISD.", myname); throw tsmError; } sensor_model = result; return tsmWarn; }