MCPcopy Create free account
hub / github.com/davisking/dlib / add_width_and_height_metadata

Function add_width_and_height_metadata

tools/imglab/src/main.cpp:380–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378// ----------------------------------------------------------------------------------------
379
380void 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

Callers 1

mainFunction · 0.85

Calls 11

get_parent_directoryFunction · 0.85
parallel_forFunction · 0.85
number_of_argumentsMethod · 0.80
set_current_dirFunction · 0.50
fileClass · 0.50
load_imageFunction · 0.50
sizeMethod · 0.45
ncMethod · 0.45
nrMethod · 0.45

Tested by

no test coverage detected