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

◆ rgba_to_hsv() [1/2]

MAYAFLUX_API void MayaFlux::Kinesis::Vision::rgba_to_hsv ( std::span< const float >  rgba,
std::span< float >  dst,
uint32_t  w,
uint32_t  h 
)

Convert RGBA to HSV writing into caller-supplied buffer.

Output is interleaved HSV, 3 floats per pixel. H in [0, 1], S and V in [0, 1]. Alpha channel is discarded.

Parameters
rgbaInterleaved RGBA span, size must be w * h * 4.
dstOutput span, size must be w * h * 3.
wImage width in pixels.
hImage height in pixels.

Definition at line 94 of file PixelOps.cpp.

97{
98 const size_t n = static_cast<size_t>(w) * h;
99 std::for_each(std::execution::par_unseq,
100 std::views::iota(size_t { 0 }, n).begin(),
101 std::views::iota(size_t { 0 }, n).end(),
102 [&](size_t i) {
103 const glm::vec3 hsv = rgb_to_hsv({ rgba[i * 4], rgba[i * 4 + 1], rgba[i * 4 + 2] });
104
105 dst[i * 3] = hsv.x;
106 dst[i * 3 + 1] = hsv.y;
107 dst[i * 3 + 2] = hsv.z;
108 });
109}
uint32_t h
Definition InkPress.cpp:29
uint32_t * dst

References dst, h, and MayaFlux::Kinesis::rgb_to_hsv().

Referenced by rgba_to_hsv(), and MayaFlux::Kinesis::Vision::VisionExecutor::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: