Hi I am trying to draw a contour to a base64 encoded qbytearray by converting it to cv mat and revert it back to qbyte array to display on qml. While the first part is working correclty, I can't seem to convert the cv mat to qbytearray back properly
the code that I am using now is
cv::Mat final_img;
cv::Mat dst;
cv::resize(final_img, final_img, final_img.size());
cv::cvtColor(final_img, dst, cv::COLOR_BGR2BGRA);
QByteArray data = QByteArray::fromRawData(reinterpret_cast<char*>(dst.data), 592355);
decoded_image = "data:image/jpeg;base64,";
decoded_image.append(QString::fromLatin1(data.toBase64().data()));
I get a correct format of base64encoded bytearray but gets the following error
Unsupported image format
Any help will be appreciated! Thanks