Skip to content
Snippets Groups Projects
Commit f0e6048e authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Attempt another opencv encoder fix

parent 35c8a74f
No related branches found
No related tags found
1 merge request!311Resolves #296 removal of NvPipe
Pipeline #27144 failed
......@@ -28,9 +28,9 @@ bool OpenCVEncoder::supports(ftl::codecs::codec_t codec) {
}
bool OpenCVEncoder::encode(const cv::cuda::GpuMat &in, ftl::codecs::Packet &pkt) {
bool is_colour = in.type() == CV_8UC4 || in.type() == CV_8UC1;
bool is_colour = in.type() == CV_8UC4;
if (pkt.codec == codec_t::Any) pkt.codec = (is_colour && in.type() != CV_8UC1) ? codec_t::JPG : codec_t::PNG;
if (pkt.codec == codec_t::Any) pkt.codec = (is_colour) ? codec_t::JPG : codec_t::PNG;
if (!supports(pkt.codec)) return false;
if (!is_colour && pkt.codec == codec_t::JPG) {
......@@ -50,7 +50,7 @@ bool OpenCVEncoder::encode(const cv::cuda::GpuMat &in, ftl::codecs::Packet &pkt)
in.download(tmp_);
if (!is_colour) {
if (!is_colour && in.type() == CV_32F) {
tmp_.convertTo(tmp_, CV_16U, 1000.0f);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment