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
Post a Comment