Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

cv::format using locale decimal mark

$
0
0
I'm using OpenCV 3.1 from C++ and I want to store my matrix in Python format: errfile.open("errs.txt"); errfile << cv::format(errs, cv::Formatter::FMT_PYTHON) << std::endl; errfile.close(); (errs is of type cv::Mat) But the output is: [[1271892,725376768, 65449,68687547074, 9149,382398115458, ... ]] It seems like OpenCV is using my systems locale number format, using a comma as decimal separator. But Python expects a dot. Although doing: errfile << 6.66f << std::endl; does print "6.66" not "6,66". Using `errfile.embue` to set the locale for the steam doesn't help either. I have to set the global locale: std::setlocale(LC_NUMERIC, "en_US.UTF-8"); I don't think it makes sense to apply the locale here, since the format should be the python code format. Is this a bug I should report? Additional Info: My system uses en_US locale for language, but German (de_AT) locale for numbers.

Viewing all articles
Browse latest Browse all 19555

Latest Images

Trending Articles



Latest Images