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
9ea8c775
Commit
9ea8c775
authored
Nov 11, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samples: use findFile() in T-API samples
parent
e8e21970
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
24 deletions
+24
-24
clahe.cpp
samples/tapi/clahe.cpp
+6
-2
hog.cpp
samples/tapi/hog.cpp
+2
-2
opencl_custom_kernel.cpp
samples/tapi/opencl_custom_kernel.cpp
+1
-1
pyrlk_optical_flow.cpp
samples/tapi/pyrlk_optical_flow.cpp
+4
-4
squares.cpp
samples/tapi/squares.cpp
+2
-2
ufacedetect.cpp
samples/tapi/ufacedetect.cpp
+9
-13
No files found.
samples/tapi/clahe.cpp
View file @
9ea8c775
...
...
@@ -63,8 +63,9 @@ int main(int argc, char** argv)
setTrackbarPos
(
"Tile Size"
,
"CLAHE"
,
cur_tilesize
.
width
);
setTrackbarPos
(
"Clip Limit"
,
"CLAHE"
,
cur_clip
);
if
(
infile
!=
""
)
if
(
!
infile
.
empty
()
)
{
infile
=
samples
::
findFile
(
infile
);
imread
(
infile
).
copyTo
(
frame
);
if
(
frame
.
empty
())
{
...
...
@@ -87,7 +88,10 @@ int main(int argc, char** argv)
else
imread
(
infile
).
copyTo
(
frame
);
if
(
frame
.
empty
())
continue
;
{
waitKey
();
break
;
}
cvtColor
(
frame
,
frame
,
COLOR_BGR2GRAY
);
pFilter
->
apply
(
frame
,
outframe
);
...
...
samples/tapi/hog.cpp
View file @
9ea8c775
...
...
@@ -61,7 +61,7 @@ int main(int argc, char** argv)
"{ h help | | print help message }"
"{ i input | | specify input image}"
"{ c camera | -1 | enable camera capturing }"
"{ v video |
../data/
vtest.avi | use video as input }"
"{ v video | vtest.avi | use video as input }"
"{ g gray | | convert image to gray one or not}"
"{ s scale | 1.0 | resize the image before detect}"
"{ o output | | specify output path when input is images}"
;
...
...
@@ -107,7 +107,7 @@ App::App(CommandLineParser& cmd)
make_gray
=
cmd
.
has
(
"gray"
);
resize_scale
=
cmd
.
get
<
double
>
(
"s"
);
vdo_source
=
cmd
.
get
<
string
>
(
"v"
);
vdo_source
=
samples
::
findFileOrKeep
(
cmd
.
get
<
string
>
(
"v"
)
);
img_source
=
cmd
.
get
<
string
>
(
"i"
);
output
=
cmd
.
get
<
string
>
(
"o"
);
camera_id
=
cmd
.
get
<
int
>
(
"c"
);
...
...
samples/tapi/opencl_custom_kernel.cpp
View file @
9ea8c775
...
...
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
string
image_file
=
args
.
get
<
string
>
(
"i"
);
if
(
!
image_file
.
empty
())
{
Mat
image
=
imread
(
image_file
);
Mat
image
=
imread
(
samples
::
findFile
(
image_file
)
);
if
(
image
.
empty
())
{
cout
<<
"error read image: "
<<
image_file
<<
endl
;
...
...
samples/tapi/pyrlk_optical_flow.cpp
View file @
9ea8c775
...
...
@@ -96,8 +96,8 @@ int main(int argc, const char* argv[])
}
bool
defaultPicturesFail
=
true
;
string
fname0
=
cmd
.
get
<
string
>
(
"left"
);
string
fname1
=
cmd
.
get
<
string
>
(
"right"
);
string
fname0
=
samples
::
findFile
(
cmd
.
get
<
string
>
(
"left"
)
);
string
fname1
=
samples
::
findFile
(
cmd
.
get
<
string
>
(
"right"
)
);
string
vdofile
=
cmd
.
get
<
string
>
(
"video"
);
string
outfile
=
cmd
.
get
<
string
>
(
"output"
);
int
points
=
cmd
.
get
<
int
>
(
"points"
);
...
...
@@ -105,9 +105,9 @@ int main(int argc, const char* argv[])
int
inputName
=
cmd
.
get
<
int
>
(
"c"
);
UMat
frame0
;
imread
(
fname0
,
cv
::
IMREAD_GRAYSCALE
).
copyTo
(
frame0
);
imread
(
fname0
,
IMREAD_GRAYSCALE
).
copyTo
(
frame0
);
UMat
frame1
;
imread
(
fname1
,
cv
::
IMREAD_GRAYSCALE
).
copyTo
(
frame1
);
imread
(
fname1
,
IMREAD_GRAYSCALE
).
copyTo
(
frame1
);
vector
<
cv
::
Point2f
>
pts
(
points
);
vector
<
cv
::
Point2f
>
nextPts
(
points
);
...
...
samples/tapi/squares.cpp
View file @
9ea8c775
...
...
@@ -156,7 +156,7 @@ int main(int argc, char** argv)
cout
<<
"OpenCL was disabled"
<<
endl
;
}
string
inputName
=
cmd
.
get
<
string
>
(
"i"
);
string
inputName
=
samples
::
findFile
(
cmd
.
get
<
string
>
(
"i"
)
);
string
outfile
=
cmd
.
get
<
string
>
(
"o"
);
int
iterations
=
10
;
...
...
@@ -164,7 +164,7 @@ int main(int argc, char** argv)
vector
<
vector
<
Point
>
>
squares
;
UMat
image
;
imread
(
inputName
,
1
).
copyTo
(
image
);
imread
(
inputName
,
IMREAD_COLOR
).
copyTo
(
image
);
if
(
image
.
empty
()
)
{
cout
<<
"Couldn't load "
<<
inputName
<<
endl
;
...
...
samples/tapi/ufacedetect.cpp
View file @
9ea8c775
...
...
@@ -28,9 +28,6 @@ void detectAndDraw( UMat& img, Mat& canvas, CascadeClassifier& cascade,
CascadeClassifier
&
nestedCascade
,
double
scale
,
bool
tryflip
);
string
cascadeName
=
"../../data/haarcascades/haarcascade_frontalface_alt.xml"
;
string
nestedCascadeName
=
"../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml"
;
int
main
(
int
argc
,
const
char
**
argv
)
{
VideoCapture
capture
;
...
...
@@ -44,8 +41,8 @@ int main( int argc, const char** argv )
double
scale
;
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{cascade|
../../
data/haarcascades/haarcascade_frontalface_alt.xml|}"
"{nested-cascade|
../../
data/haarcascades/haarcascade_eye_tree_eyeglasses.xml|}"
"{cascade|data/haarcascades/haarcascade_frontalface_alt.xml|}"
"{nested-cascade|data/haarcascades/haarcascade_eye_tree_eyeglasses.xml|}"
"{help h ||}{scale|1|}{try-flip||}{@filename||}"
);
if
(
parser
.
has
(
"help"
))
...
...
@@ -53,8 +50,8 @@ int main( int argc, const char** argv )
help
();
return
0
;
}
cascadeName
=
parser
.
get
<
string
>
(
"cascade"
);
nestedCascadeName
=
parser
.
get
<
string
>
(
"nested-cascade"
);
string
cascadeName
=
samples
::
findFile
(
parser
.
get
<
string
>
(
"cascade"
)
);
string
nestedCascadeName
=
samples
::
findFileOrKeep
(
parser
.
get
<
string
>
(
"nested-cascade"
)
);
scale
=
parser
.
get
<
double
>
(
"scale"
);
tryflip
=
parser
.
has
(
"try-flip"
);
inputName
=
parser
.
get
<
string
>
(
"@filename"
);
...
...
@@ -66,10 +63,10 @@ int main( int argc, const char** argv )
}
if
(
!
nestedCascade
.
load
(
nestedCascadeName
)
)
cerr
<<
"WARNING: Could not load classifier cascade for nested objects
"
<<
endl
;
cerr
<<
"WARNING: Could not load classifier cascade for nested objects
: "
<<
nestedCascadeName
<<
endl
;
if
(
!
cascade
.
load
(
cascadeName
)
)
{
cerr
<<
"ERROR: Could not load classifier cascade
"
<<
endl
;
cerr
<<
"ERROR: Could not load classifier cascade
: "
<<
cascadeName
<<
endl
;
help
();
return
-
1
;
}
...
...
@@ -84,9 +81,8 @@ int main( int argc, const char** argv )
}
else
{
if
(
inputName
.
empty
()
)
inputName
=
"../data/lena.jpg"
;
image
=
imread
(
inputName
,
1
).
getUMat
(
ACCESS_READ
);
inputName
=
samples
::
findFileOrKeep
(
inputName
);
imread
(
inputName
,
IMREAD_COLOR
).
copyTo
(
image
);
if
(
image
.
empty
()
)
{
if
(
!
capture
.
open
(
inputName
))
...
...
@@ -133,7 +129,7 @@ int main( int argc, const char** argv )
len
--
;
buf
[
len
]
=
'\0'
;
cout
<<
"file "
<<
buf
<<
endl
;
im
age
=
imread
(
buf
,
1
).
getUMat
(
ACCESS_READ
);
im
read
(
samples
::
findFile
(
buf
),
IMREAD_COLOR
).
copyTo
(
image
);
if
(
!
image
.
empty
()
)
{
detectAndDraw
(
image
,
canvas
,
cascade
,
nestedCascade
,
scale
,
tryflip
);
...
...
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