Reputation: 3
I need to convert OpenCV different types like CV_8UC4
to CV_16UC3
.
I tried convertTo(mat, CV_16UC3)
, but this is returns an empty image (when I save it to the storage it's empty).
Upvotes: 0
Views: 1776
Reputation: 20130
convertTo
can't change the number of channels.
You'll need two steps:
cv::cvtColor(src, dst, CV_BGRA2BGR)
dst.convertTo(mat, CV_16U)
for example if your 4th channel is an alpha channel and you just want to drop it.
Upvotes: 5