Load an image in hard disk using OpenCV and Qt -


i new using qt , opencv. trying read image in hd , show it. not specific image, program read image user select. code:

qstring imagename = qfiledialog::getopenfilename(                 this,                 tr("open images"),                 "c://",                 tr("tiff files (*.tif);; raw file (*.raw)"));   if ( imagename.isnull())     {          qmessagebox::warning(this,"error!","image not valid!");     }       cv::mat src(filename); 

mat configuration is: mat imread(const string& filename, int flags=1 )

how can solve this?

cv::mat doesn't have contructor accepts string. use imread instead. since imread accepts std::string, not qstring, do:

cv::mat yourimage = cv::imread(filename.tostdstring()); 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -