}\r
\r
\r
-void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const ostringstream &ss)\r
+void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss)\r
{\r
int fontFace = FONT_HERSHEY_DUPLEX;\r
double fontScale = 0.8;\r
Point org;\r
org.x = 1;\r
org.y = 3 * fontSize.height * (lineOffsY + 1) / 2;\r
- putText(img, ss.str(), org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16);\r
- putText(img, ss.str(), org, fontFace, fontScale, fontColor, fontThickness, 16);\r
+ putText(img, ss, org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16);\r
+ putText(img, ss, org, fontFace, fontScale, fontColor, fontThickness, 16);\r
}\r
\r
\r
\r
ostringstream ss;\r
ss << "FPS = " << setprecision(1) << fixed << fps;\r
- matPrint(canvas, 0, fontColorRed, ss);\r
+ matPrint(canvas, 0, fontColorRed, ss.str());\r
ss.str("");\r
ss << "[" << canvas.cols << "x" << canvas.rows << "], " <<\r
(bGpu ? "GPU, " : "CPU, ") <<\r
(bLargestFace ? "OneFace, " : "MultiFace, ") <<\r
(bFilter ? "Filter:ON" : "Filter:OFF");\r
- matPrint(canvas, 1, fontColorRed, ss);\r
+ matPrint(canvas, 1, fontColorRed, ss.str());\r
\r
+ // by Anatoly. MacOS fix. ostringstream(const string&) is a private\r
+ // matPrint(canvas, 2, fontColorNV, ostringstream("Space - switch GPU / CPU"));\r
if (bHelp)\r
- { \r
- // by Anatoly. MacOS fix. ostringstream(const string&) is a private\r
- //matPrint(canvas, 2, fontColorNV, ostringstream("Space - switch GPU / CPU"));\r
- matPrint(canvas, 2, fontColorNV, (ostringstream&)(ostringstream() << "Space - switch GPU / CPU"));\r
- matPrint(canvas, 3, fontColorNV, (ostringstream&)(ostringstream() << "M - switch OneFace / MultiFace"));\r
- matPrint(canvas, 4, fontColorNV, (ostringstream&)(ostringstream() << "F - toggle rectangles Filter"));\r
- matPrint(canvas, 5, fontColorNV, (ostringstream&)(ostringstream() << "H - toggle hotkeys help"));\r
- matPrint(canvas, 6, fontColorNV, (ostringstream&)(ostringstream() << "1/Q - increase/decrease scale"));\r
+ {\r
+ matPrint(canvas, 2, fontColorNV, "Space - switch GPU / CPU");\r
+ matPrint(canvas, 3, fontColorNV, "M - switch OneFace / MultiFace");\r
+ matPrint(canvas, 4, fontColorNV, "F - toggle rectangles Filter");\r
+ matPrint(canvas, 5, fontColorNV, "H - toggle hotkeys help");\r
+ matPrint(canvas, 6, fontColorNV, "1/Q - increase/decrease scale");\r
}\r
else\r
{\r
- matPrint(canvas, 2, fontColorNV, (ostringstream&)(ostringstream() << "H - toggle hotkeys help"));\r
+ matPrint(canvas, 2, fontColorNV, "H - toggle hotkeys help");\r
}\r
}\r
\r
const string wndTitle = "NVIDIA Computer Vision :: Haar Classifiers Cascade";\r
\r
\r
-void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const ostringstream &ss)\r
+void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss)\r
{\r
int fontFace = FONT_HERSHEY_DUPLEX;\r
double fontScale = 0.8;\r
Point org;\r
org.x = 1;\r
org.y = 3 * fontSize.height * (lineOffsY + 1) / 2;\r
- putText(img, ss.str(), org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16);\r
- putText(img, ss.str(), org, fontFace, fontScale, fontColor, fontThickness, 16);\r
+ putText(img, ss, org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16);\r
+ putText(img, ss, org, fontFace, fontScale, fontColor, fontThickness, 16);\r
}\r
\r
\r
\r
ostringstream ss;\r
ss << "FPS = " << setprecision(1) << fixed << fps;\r
- matPrint(canvas, 0, fontColorRed, ss);\r
+ matPrint(canvas, 0, fontColorRed, ss.str());\r
ss.str("");\r
ss << "[" << canvas.cols << "x" << canvas.rows << "], " <<\r
(bGpu ? "GPU, " : "CPU, ") <<\r
(bLargestFace ? "OneFace, " : "MultiFace, ") <<\r
(bFilter ? "Filter:ON" : "Filter:OFF");\r
- matPrint(canvas, 1, fontColorRed, ss);\r
+ matPrint(canvas, 1, fontColorRed, ss.str());\r
\r
if (bHelp)\r
{\r
- matPrint(canvas, 2, fontColorNV, (ostringstream&)(ostringstream() << "Space - switch GPU / CPU"));\r
- matPrint(canvas, 3, fontColorNV, (ostringstream&)(ostringstream() << "M - switch OneFace / MultiFace"));\r
- matPrint(canvas, 4, fontColorNV, (ostringstream&)(ostringstream() << "F - toggle rectangles Filter"));\r
- matPrint(canvas, 5, fontColorNV, (ostringstream&)(ostringstream() << "H - toggle hotkeys help"));\r
+ matPrint(canvas, 2, fontColorNV, "Space - switch GPU / CPU");\r
+ matPrint(canvas, 3, fontColorNV, "M - switch OneFace / MultiFace");\r
+ matPrint(canvas, 4, fontColorNV, "F - toggle rectangles Filter");\r
+ matPrint(canvas, 5, fontColorNV, "H - toggle hotkeys help");\r
}\r
else\r
{\r
- matPrint(canvas, 2, fontColorNV, (ostringstream&)(ostringstream() << "H - toggle hotkeys help"));\r
+ matPrint(canvas, 2, fontColorNV, "H - toggle hotkeys help");\r
}\r
}\r
\r