Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
22dbd002
Commit
22dbd002
authored
Jun 03, 2011
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix compilation for macos
parent
c5fa7014
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
cascadeclassifier.cpp
samples/gpu/cascadeclassifier.cpp
+14
-14
cascadeclassifier_nvidia_api.cpp
samples/gpu/cascadeclassifier_nvidia_api.cpp
+10
-10
No files found.
samples/gpu/cascadeclassifier.cpp
View file @
22dbd002
...
@@ -57,7 +57,7 @@ void convertAndResize(const T& src, T& gray, T& resized, double scale)
...
@@ -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
...
@@ -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
...
@@ -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"
);
}
}
}
}
...
...
samples/gpu/cascadeclassifier_nvidia_api.cpp
View file @
22dbd002
...
@@ -27,7 +27,7 @@ const Size2i preferredVideoFrameSize(640, 480);
...
@@ -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
...
@@ -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
...
@@ -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"
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment