Create data variants for a specific modality.
519 {
520 std::vector<DataVariant> variants;
521
523 uint64_t
total = std::accumulate(shape.begin(), shape.end(), uint64_t(1), std::multiplies<>());
524 variants.emplace_back(std::vector<T>(
total, default_value));
525 return variants;
526 }
527
528 switch (modality) {
530 variants.emplace_back(std::vector<T>(shape[0], default_value));
531 break;
532
534 uint64_t samples = shape[0];
537 for (uint64_t ch = 0; ch <
channels; ++ch) {
538 variants.emplace_back(std::vector<T>(samples, default_value));
539 }
540 break;
541 }
542
544 variants.emplace_back(std::vector<T>(shape[0] * shape[1], default_value));
545 break;
546
548 uint64_t
height = shape[0];
549 uint64_t
width = shape[1];
553 for (uint64_t ch = 0; ch <
channels; ++ch) {
554 variants.emplace_back(std::vector<T>(
pixels, default_value));
555 }
556 break;
557 }
558
560 uint64_t
pixels = shape[0] * shape[1];
561 uint64_t components = shape[2];
562 variants.reserve(components);
563 for (uint64_t c = 0; c < components; ++c) {
564 variants.emplace_back(std::vector<T>(
pixels, default_value));
565 }
566 break;
567 }
568
570 variants.emplace_back(std::vector<T>(shape[0] * shape[1], default_value));
571 break;
572
574 variants.emplace_back(std::vector<T>(shape[0] * shape[1] * shape[2], default_value));
575 break;
576
578 uint64_t frames = shape[0];
579 uint64_t
height = shape[1];
580 uint64_t
width = shape[2];
582 variants.reserve(frames);
583 for (uint64_t f = 0; f < frames; ++f) {
584 variants.emplace_back(std::vector<T>(frame_size, default_value));
585 }
586 break;
587 }
588
590 uint64_t frames = shape[0];
591 uint64_t
height = shape[1];
592 uint64_t
width = shape[2];
595 variants.reserve(frames *
channels);
596 for (uint64_t f = 0; f < frames; ++f) {
597 for (uint64_t ch = 0; ch <
channels; ++ch) {
598 variants.emplace_back(std::vector<T>(frame_size, default_value));
599 }
600 }
601 break;
602 }
603
605 uint64_t frames = shape[0];
606 uint64_t
pixels = shape[1] * shape[2];
607 uint64_t components = shape[3];
608 variants.reserve(components);
609 for (uint64_t c = 0; c < components; ++c) {
610 variants.emplace_back(std::vector<T>(frames *
pixels, default_value));
611 }
612 break;
613 }
614
615 default:
616 uint64_t
total = std::accumulate(shape.begin(), shape.end(), uint64_t(1), std::multiplies<>());
617 variants.emplace_back(std::vector<T>(
total, default_value));
618 break;
619 }
620
621 return variants;
622 }
const std::vector< float > * pixels
@ DEPTH_MAP
[height, width, components] - range/disparity image
@ AUDIO_MULTICHANNEL
Multi-channel audio.
@ SPECTRAL_2D
2D spectral data (time + frequency)
@ AUDIO_1D
1D audio signal
@ VIDEO_DEPTH
[frames, height, width, components] - streaming range data
@ VOLUMETRIC_3D
3D volumetric data
@ VIDEO_GRAYSCALE
3D video (time + 2D grayscale)
@ VIDEO_COLOR
4D video (time + 2D + color)
@ IMAGE_COLOR
2D RGB/RGBA image
@ IMAGE_2D
2D image (grayscale or single channel)
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)