Cv :: String and std :: string: when to use which one and the need to use both?

As part of a project, OpenCV is commonly cv::Stringused in functions, for example. simple putText. However, when using functions, it std std::stringanswers. For instance. when

ifstream stream(filepath);
string line;
getline(stream, line, '\n');

it is necessary that a std::string, since it cv::Stringthrows an error. Otherwise, using the OpenCV function std::stringproperly converts to cv::Stringand the following code works:

string Str = "Test";
putText(img, Str, Point(10, 10), FONT_HERSHEY_PLAIN, 1, Scalar::all(255), 1);

Questions

Why does OpenCV have its own String-Class? I think there may be some differences for OpenCV, while cv::Stringfunctionality is still possible (or most?) std::string. But it seems that std::stringyou can convert to cv::String(which I tested, at least for putText.

The docs show similar functions, but also some differences, such as related functions static bool operator> (const String &lhs, const String &rhs)and similar:

http://docs.opencv.org/3.1.0/d1/d8f/classcv_1_1String.html for cv::String http://www.cplusplus.com/reference/string/string/ forstd::string

Did I miss something?

, , std::string ? ( , , , , )

: QString , std::string , . , OpenCV.

+4
2

OpenCV ? OpenCV - ( , 2000 .). , OpenCV, , , . MFC , Qt wxWidgets. "" std::string - .

- . ; , , a cv::String, std::string. , cv::String , cv::String . (: Jonas , cv::String std::string.)

, putString cv::String - std::string . ( ) " " , .

+4

, , openCV, -, cv::String, , , , .

, , , std::string, , , , , .

, . , . , std::string, - openCV .

, openCV , , , , , . , , - , .

+3

Source: https://habr.com/ru/post/1684355/


All Articles