Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
228d90276-1
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
228d90276-1
Commits
c6e9be52
Commit
c6e9be52
authored
3 years ago
by
zhanghb97
Browse files
Options
Downloads
Patches
Plain Diff
[DIP] Generate result image for opencv benchmark.
parent
229e3a49
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmarks/ImageProcessing/Main.cpp
+2
-0
2 additions, 0 deletions
benchmarks/ImageProcessing/Main.cpp
benchmarks/ImageProcessing/OpenCVFilter2DBenchmark.cpp
+24
-0
24 additions, 0 deletions
benchmarks/ImageProcessing/OpenCVFilter2DBenchmark.cpp
with
26 additions
and
0 deletions
benchmarks/ImageProcessing/Main.cpp
+
2
−
0
View file @
c6e9be52
...
...
@@ -27,6 +27,7 @@ void initializeOpenCVFilter2D(int, char **);
void
generateResultBuddyConv2D
();
void
generateResultBuddyCorr2D
();
void
generateResultOpenCVFilter2D
();
// Run benchmarks.
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -51,6 +52,7 @@ int main(int argc, char **argv) {
// Generate result image.
generateResultBuddyConv2D
();
generateResultBuddyCorr2D
();
generateResultOpenCVFilter2D
();
return
0
;
}
This diff is collapsed.
Click to expand it.
benchmarks/ImageProcessing/OpenCVFilter2DBenchmark.cpp
+
24
−
0
View file @
c6e9be52
...
...
@@ -47,3 +47,27 @@ static void OpenCV_Filter2D(benchmark::State &state) {
// Register benchmarking function.
BENCHMARK
(
OpenCV_Filter2D
)
->
Arg
(
1
);
// Generate result image.
void
generateResultOpenCVFilter2D
()
{
filter2D
(
inputImageFilter2D
,
outputFilter2D
,
CV_32FC1
,
kernelFilter2D
,
cv
::
Point
(
-
1
,
-
1
),
0.0
,
cv
::
BORDER_CONSTANT
);
// Choose a PNG compression level
vector
<
int
>
compressionParams
;
compressionParams
.
push_back
(
IMWRITE_PNG_COMPRESSION
);
compressionParams
.
push_back
(
9
);
// Write output to PNG.
bool
result
=
false
;
try
{
result
=
imwrite
(
"ResultOpenCVFilter2D.png"
,
outputFilter2D
,
compressionParams
);
}
catch
(
const
cv
::
Exception
&
ex
)
{
fprintf
(
stderr
,
"Exception converting image to PNG format: %s
\n
"
,
ex
.
what
());
}
if
(
result
)
cout
<<
"Saved PNG file."
<<
endl
;
else
cout
<<
"ERROR: Can't save PNG file."
<<
endl
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment