Open CV Casting variables problem in QT Creator (C++)

,

Hi,
I’m trying to calibrate my camera using OpenCV library in QT Creator. I’m trying to display a cv::Matx33f and cv::Vec in QT using qDebug() console or QPlainTextEdit so I could see the result in my GUI, but I have no idea how to do it. I’ve been trying with QString(), QString::number() etc. and nothing seems to work for me.


cv::Matx33f Var1(Matx33f::eye());  
cv::Vec<float, 5> Var2(0, 0, 0, 0, 0); 

ui->calibParameters->appendPlainText(**QString()... "no idea how to convert"** );

errors:

No matching conversion for functional-style cast from 'cv::Matx33f' (aka 'Matx<float, 3, 3>') to 'QString' 
No matching conversion for functional-style cast from 'Vec<float, 5>' to 'QString'

Can someone help me with my ‘casting’ problem?

Thank you in advance

There probably is no cast. You can write a small helper function to firmat the data as string, see How to convert opencv mat into string c++ - Stack Overflow

since you can write them out to std::ostream:

std::stringstream ss; 
ss << Var1 << " " << Var2 << endl;
ui->calibParameters->appendPlainText( QString(ss.str()) );

apart from std::ostream, I would have expected a cast to char* or std::string to maybe work, but not QString, because OpenCV has no clue what that is.