Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5145

Camera board • Re: Using grayscale image in TfStage

$
0
0
Jeepers, converting from YUV420 to RGB in order to convert back again is just total overkill.

If your source and destination can have the same stride, then you want something like

Code:

std::vector<uint8_t> output(dst_info.height * dst_info.stride);memcpy(output.data(), src, src_info.stride * src_info * height);return output;
If they need different strides, then you want something like

Code:

std::vector<uint8_t> output(dst_info.height * dst_info.stride);unsigned int y = 0;uint8_t *dst = output.data();for (; y < dst_info.height; y++, src += src_info.stride, dst += dst_info.stride){memcpy(dst, src, src_info.width);}return output;

Statistics: Posted by 6by9 — Tue Jul 23, 2024 2:04 pm



Viewing all articles
Browse latest Browse all 5145

Trending Articles