Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
98f305e4
Commit
98f305e4
authored
Dec 02, 2016
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix codestyle in structured_edge_detection sample
parent
50489dc0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
structured_edge_detection.cpp
modules/ximgproc/samples/structured_edge_detection.cpp
+22
-22
No files found.
modules/ximgproc/samples/structured_edge_detection.cpp
View file @
98f305e4
...
@@ -7,6 +7,7 @@ https://github.com/opencv/opencv_extra/blob/master/testdata/cv/ximgproc/model.ym
...
@@ -7,6 +7,7 @@ https://github.com/opencv/opencv_extra/blob/master/testdata/cv/ximgproc/model.ym
#include <opencv2/ximgproc.hpp>
#include <opencv2/ximgproc.hpp>
#include "opencv2/highgui.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/utility.hpp"
#include <iostream>
using
namespace
cv
;
using
namespace
cv
;
using
namespace
cv
::
ximgproc
;
using
namespace
cv
::
ximgproc
;
...
@@ -21,52 +22,51 @@ const char* keys =
...
@@ -21,52 +22,51 @@ const char* keys =
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
{
{
bool
printHelp
=
(
argc
==
1
);
bool
printHelp
=
(
argc
==
1
);
printHelp
=
printHelp
||
(
argc
==
2
&&
std
::
s
tring
(
argv
[
1
])
==
"--help"
);
printHelp
=
printHelp
||
(
argc
==
2
&&
S
tring
(
argv
[
1
])
==
"--help"
);
printHelp
=
printHelp
||
(
argc
==
2
&&
std
::
s
tring
(
argv
[
1
])
==
"-h"
);
printHelp
=
printHelp
||
(
argc
==
2
&&
S
tring
(
argv
[
1
])
==
"-h"
);
if
(
printHelp
)
if
(
printHelp
)
{
{
printf
(
"
\n
This sample demonstrates structured forests for fast edge detection
\n
"
std
::
cout
<<
"
\n
This sample demonstrates structured forests for fast edge detection
\n
"
"Call:
\n
"
"Call:
\n
"
" structured_edge_detection -i=in_image_name -m=model_name [-o=out_image_name]
\n\n
"
)
;
" structured_edge_detection -i=in_image_name -m=model_name [-o=out_image_name]
\n\n
"
;
return
0
;
return
0
;
}
}
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
CommandLineParser
parser
(
argc
,
argv
,
keys
);
if
(
!
parser
.
check
()
)
if
(
!
parser
.
check
()
)
{
{
parser
.
printErrors
();
parser
.
printErrors
();
return
-
1
;
return
-
1
;
}
}
std
::
string
modelFilename
=
parser
.
get
<
std
::
s
tring
>
(
"m"
);
String
modelFilename
=
parser
.
get
<
S
tring
>
(
"m"
);
std
::
string
inFilename
=
parser
.
get
<
std
::
s
tring
>
(
"i"
);
String
inFilename
=
parser
.
get
<
S
tring
>
(
"i"
);
std
::
string
outFilename
=
parser
.
get
<
std
::
s
tring
>
(
"o"
);
String
outFilename
=
parser
.
get
<
S
tring
>
(
"o"
);
cv
::
Mat
image
=
cv
::
imread
(
inFilename
,
1
);
Mat
image
=
imread
(
inFilename
,
1
);
if
(
image
.
empty
()
)
if
(
image
.
empty
()
)
{
CV_Error
(
Error
::
StsError
,
String
(
"Cannot read image file: "
)
+
inFilename
);
printf
(
"Cannot read image file: %s
\n
"
,
inFilename
.
c_str
());
return
-
1
;
}
image
.
convertTo
(
image
,
cv
::
DataType
<
float
>::
type
,
1
/
255.0
);
if
(
modelFilename
.
size
()
==
0
)
CV_Error
(
Error
::
StsError
,
String
(
"Empty model name"
));
cv
::
Mat
edges
(
image
.
size
(),
image
.
type
()
);
image
.
convertTo
(
image
,
DataType
<
float
>::
type
,
1
/
255.0
);
cv
::
Ptr
<
StructuredEdgeDetection
>
pDollar
=
Mat
edges
(
image
.
size
(),
image
.
type
());
Ptr
<
StructuredEdgeDetection
>
pDollar
=
createStructuredEdgeDetection
(
modelFilename
);
createStructuredEdgeDetection
(
modelFilename
);
pDollar
->
detectEdges
(
image
,
edges
);
pDollar
->
detectEdges
(
image
,
edges
);
if
(
outFilename
==
""
)
if
(
outFilename
.
size
()
==
0
)
{
{
cv
::
namedWindow
(
"edges"
,
1
);
namedWindow
(
"edges"
,
1
);
cv
::
imshow
(
"edges"
,
edges
);
imshow
(
"edges"
,
edges
);
waitKey
(
0
);
cv
::
waitKey
(
0
);
}
}
else
else
cv
::
imwrite
(
outFilename
,
255
*
edges
);
imwrite
(
outFilename
,
255
*
edges
);
return
0
;
return
0
;
}
}
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