| 378 | // ---------------------------------------------------------------------------------------- |
| 379 | |
| 380 | void add_width_and_height_metadata(const command_line_parser& parser) |
| 381 | { |
| 382 | for (unsigned long i = 0; i < parser.number_of_arguments(); ++i) { |
| 383 | image_dataset_metadata::dataset metadata; |
| 384 | const string datasource = parser[i]; |
| 385 | load_image_dataset_metadata(metadata,datasource); |
| 386 | |
| 387 | // Set the current directory to be the one that contains the |
| 388 | // metadata file. We do this because the file might contain |
| 389 | // file paths which are relative to this folder. |
| 390 | set_current_dir(get_parent_directory(file(datasource))); |
| 391 | |
| 392 | parallel_for(0, metadata.images.size(), [&](long i) |
| 393 | { |
| 394 | array2d<rgb_pixel> img; |
| 395 | load_image(img, metadata.images[i].filename); |
| 396 | metadata.images[i].width = img.nc(); |
| 397 | metadata.images[i].height = img.nr(); |
| 398 | }); |
| 399 | |
| 400 | save_image_dataset_metadata(metadata, datasource); |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | // ---------------------------------------------------------------------------------------- |
| 405 |
no test coverage detected