MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ flatten_channels()

template<typename T >
std::vector< T > MayaFlux::Kakshya::flatten_channels ( const std::vector< std::vector< T > > &  channel_data)

Flatten a vector of channel data into a single vector.

Template Parameters
TData type.
Parameters
channel_dataVector of vectors, each representing a channel's data.
Returns
Single flattened vector containing all channel data in sequence.

This function concatenates the data from multiple channels into a single continuous vector. It is useful for operations that require planar data to be processed as a single array.

Definition at line 44 of file RegionUtils.hpp.

45{
46 std::vector<T> result;
47 size_t total_size = 0;
48 for (const auto& channel : channel_data) {
49 total_size += channel.size();
50 }
51 result.reserve(total_size);
52
53 for (const auto& channel : channel_data) {
54 result.insert(result.end(), channel.begin(), channel.end());
55 }
56 return result;
57}

Referenced by extract_region_data().

+ Here is the caller graph for this function: