MayaFlux 0.1.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 42 of file RegionUtils.hpp.

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

Referenced by extract_region_data().

+ Here is the caller graph for this function: