fix compilation for macos

This commit is contained in:
Anatoly Baksheev 2011-06-03 08:13:03 +00:00
parent c5fa70143d
commit 22dbd002e6
2 changed files with 24 additions and 24 deletions

View File

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

View File

@ -27,7 +27,7 @@ const Size2i preferredVideoFrameSize(640, 480);
const string wndTitle = "NVIDIA Computer Vision :: Haar Classifiers Cascade"; const string wndTitle = "NVIDIA Computer Vision :: Haar Classifiers Cascade";
void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const ostringstream &ss) void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss)
{ {
int fontFace = FONT_HERSHEY_DUPLEX; int fontFace = FONT_HERSHEY_DUPLEX;
double fontScale = 0.8; double fontScale = 0.8;
@ -37,8 +37,8 @@ void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const ostringstream &ss
Point org; Point org;
org.x = 1; org.x = 1;
org.y = 3 * fontSize.height * (lineOffsY + 1) / 2; org.y = 3 * fontSize.height * (lineOffsY + 1) / 2;
putText(img, ss.str(), org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16); putText(img, ss, org, fontFace, fontScale, CV_RGB(0,0,0), 5*fontThickness/2, 16);
putText(img, ss.str(), org, fontFace, fontScale, fontColor, fontThickness, 16); putText(img, ss, org, fontFace, fontScale, fontColor, fontThickness, 16);
} }
@ -49,24 +49,24 @@ void displayState(Mat &canvas, bool bHelp, bool bGpu, bool bLargestFace, bool bF
ostringstream ss; ostringstream ss;
ss << "FPS = " << setprecision(1) << fixed << fps; ss << "FPS = " << setprecision(1) << fixed << fps;
matPrint(canvas, 0, fontColorRed, ss); matPrint(canvas, 0, fontColorRed, ss.str());
ss.str(""); ss.str("");
ss << "[" << canvas.cols << "x" << canvas.rows << "], " << ss << "[" << canvas.cols << "x" << canvas.rows << "], " <<
(bGpu ? "GPU, " : "CPU, ") << (bGpu ? "GPU, " : "CPU, ") <<
(bLargestFace ? "OneFace, " : "MultiFace, ") << (bLargestFace ? "OneFace, " : "MultiFace, ") <<
(bFilter ? "Filter:ON" : "Filter:OFF"); (bFilter ? "Filter:ON" : "Filter:OFF");
matPrint(canvas, 1, fontColorRed, ss); matPrint(canvas, 1, fontColorRed, ss.str());
if (bHelp) if (bHelp)
{ {
matPrint(canvas, 2, fontColorNV, (ostringstream&)(ostringstream() << "Space - switch GPU / CPU")); matPrint(canvas, 2, fontColorNV, "Space - switch GPU / CPU");
matPrint(canvas, 3, fontColorNV, (ostringstream&)(ostringstream() << "M - switch OneFace / MultiFace")); matPrint(canvas, 3, fontColorNV, "M - switch OneFace / MultiFace");
matPrint(canvas, 4, fontColorNV, (ostringstream&)(ostringstream() << "F - toggle rectangles Filter")); matPrint(canvas, 4, fontColorNV, "F - toggle rectangles Filter");
matPrint(canvas, 5, fontColorNV, (ostringstream&)(ostringstream() << "H - toggle hotkeys help")); matPrint(canvas, 5, fontColorNV, "H - toggle hotkeys help");
} }
else else
{ {
matPrint(canvas, 2, fontColorNV, (ostringstream&)(ostringstream() << "H - toggle hotkeys help")); matPrint(canvas, 2, fontColorNV, "H - toggle hotkeys help");
} }
} }