* @Brief process a set of images such that they appear captured by a new virtual intrinsic * @param input the original sfmData to parse * @param target the transformed sfmData which will be used for intrinsics properties * @param namingFunction function which defines how is the image named given the view object * @param evCorrection do we correct the exposure * @param exportFullRod do we expo
| 334 | * @param rangeEnd the last view index to process (range selection) |
| 335 | */ |
| 336 | bool process(const sfmData::SfMData & input, |
| 337 | sfmData::SfMData & target, |
| 338 | const NameFunction & namingFunction, |
| 339 | bool evCorrection, |
| 340 | bool exportFullRod, |
| 341 | const std::vector<std::string> & masksFolders, |
| 342 | const std::string & maskExtension, |
| 343 | const image::EStorageDataType & storageDataType, |
| 344 | size_t rangeStart, |
| 345 | size_t rangeEnd) |
| 346 | { |
| 347 | size_t countElements = input.getViews().size(); |
| 348 | rangeEnd = std::min(countElements, rangeEnd); |
| 349 | |
| 350 | // for exposure correction |
| 351 | const double medianCameraExposure = input.getMedianCameraExposureSetting().getExposure(); |
| 352 | |
| 353 | for (int posImage = 0; posImage < countElements; posImage++) |
| 354 | { |
| 355 | auto viewsIt = input.getViews().begin(); |
| 356 | std::advance(viewsIt, posImage); |
| 357 | |
| 358 | //Retrieve view |
| 359 | IndexT viewId = viewsIt->first; |
| 360 | sfmData::View & view = *viewsIt->second; |
| 361 | sfmData::View & outputView = target.getView(viewsIt->first); |
| 362 | |
| 363 | //Retrieve intrinsic |
| 364 | IndexT intrinsicId = view.getIntrinsicId(); |
| 365 | const auto & intrinsic = input.getIntrinsic(intrinsicId); |
| 366 | |
| 367 | //Make sure the target sfm contains the same thing |
| 368 | const auto & targetIntrinsics = target.getIntrinsics(); |
| 369 | if (targetIntrinsics.find(intrinsicId) == targetIntrinsics.end()) |
| 370 | { |
| 371 | continue; |
| 372 | } |
| 373 | |
| 374 | const auto & targetIntrinsic = target.getIntrinsic(intrinsicId); |
| 375 | |
| 376 | //Retrieve image name |
| 377 | std::string srcFileName = view.getImage().getImagePath(); |
| 378 | |
| 379 | //Update filename in sfmData |
| 380 | std::string outFileName = namingFunction(view); |
| 381 | outputView.getImage().setImagePath(outFileName); |
| 382 | |
| 383 | //Real processing is ignored if we are not in the chunk |
| 384 | if (posImage < rangeStart || posImage >= rangeEnd) |
| 385 | { |
| 386 | continue; |
| 387 | } |
| 388 | |
| 389 | //Process Image |
| 390 | ALICEVISION_LOG_INFO("Process image " << srcFileName); |
| 391 | processImage(outFileName, |
| 392 | targetIntrinsic, |
| 393 | intrinsic, |
no test coverage detected