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
a052567d
Commit
a052567d
authored
Sep 20, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15530 from sturkmen72:update_samples_v4
parents
ee23a757
2d233038
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
35 deletions
+14
-35
dis_opticalflow.cpp
samples/cpp/dis_opticalflow.cpp
+7
-16
ela.cpp
samples/cpp/ela.cpp
+6
-18
squares.py
samples/python/squares.py
+1
-1
No files found.
samples/cpp/dis_opticalflow.cpp
View file @
a052567d
...
@@ -2,30 +2,24 @@
...
@@ -2,30 +2,24 @@
#include "opencv2/core/utility.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/video.hpp"
#include "opencv2/video.hpp"
using
namespace
std
;
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
;
static
void
help
()
{
printf
(
"Usage: dis_optflow <video_file>
\n
"
);
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
VideoCapture
cap
;
CommandLineParser
parser
(
argc
,
argv
,
"{ @video | vtest.avi | use video as input }"
);
string
filename
=
samples
::
findFileOrKeep
(
parser
.
get
<
string
>
(
"@video"
));
if
(
argc
<
2
)
VideoCapture
cap
;
{
cap
.
open
(
filename
);
help
();
exit
(
1
);
}
cap
.
open
(
argv
[
1
]);
if
(
!
cap
.
isOpened
())
if
(
!
cap
.
isOpened
())
{
{
printf
(
"ERROR: Cannot open file %s
\n
"
,
argv
[
1
]);
printf
(
"ERROR: Cannot open file %s
\n
"
,
filename
.
c_str
());
parser
.
printMessage
();
return
-
1
;
return
-
1
;
}
}
...
@@ -35,9 +29,6 @@ int main(int argc, char **argv)
...
@@ -35,9 +29,6 @@ int main(int argc, char **argv)
Mat
hsv_split
[
3
],
hsv
;
Mat
hsv_split
[
3
],
hsv
;
char
ret
;
char
ret
;
namedWindow
(
"flow"
,
1
);
namedWindow
(
"orig"
,
1
);
Ptr
<
DenseOpticalFlow
>
algorithm
=
DISOpticalFlow
::
create
(
DISOpticalFlow
::
PRESET_MEDIUM
);
Ptr
<
DenseOpticalFlow
>
algorithm
=
DISOpticalFlow
::
create
(
DISOpticalFlow
::
PRESET_MEDIUM
);
while
(
true
)
while
(
true
)
...
...
samples/cpp/ela.cpp
View file @
a052567d
...
@@ -5,13 +5,8 @@
...
@@ -5,13 +5,8 @@
@date Jun 24, 2018
@date Jun 24, 2018
*/
*/
#include <opencv2/highgui
/highgui
.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <iostream>
#include <vector>
const
char
*
keys
=
"{ help h | | Print help message. }"
"{ input i | | Input image to calc ELA algorithm. }"
;
using
namespace
cv
;
using
namespace
cv
;
...
@@ -48,20 +43,13 @@ static void processImage(int , void*)
...
@@ -48,20 +43,13 @@ static void processImage(int , void*)
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
CommandLineParser
parser
(
argc
,
argv
,
"{ input i | ela_modified.jpg | Input image to calculate ELA algorithm. }"
);
parser
.
about
(
"
\n
Jpeg Recompression Example:
\n
"
);
parser
.
printMessage
();
CommandLineParser
parser
(
argc
,
argv
,
keys
);
// Read the new image
if
(
argc
==
1
||
parser
.
has
(
"help"
))
image
=
imread
(
samples
::
findFile
(
parser
.
get
<
String
>
(
"input"
)));
{
parser
.
printMessage
();
std
::
cout
<<
"
\n
Jpeg Recompression Example:
\n\t
"
<<
argv
[
0
]
<<
" --input=../../data/ela_modified.jpg
\n
"
;
return
0
;
}
if
(
parser
.
has
(
"input"
))
{
// Read the new image
image
=
imread
(
parser
.
get
<
String
>
(
"input"
));
}
// Check image
// Check image
if
(
!
image
.
empty
())
if
(
!
image
.
empty
())
{
{
...
...
samples/python/squares.py
View file @
a052567d
...
@@ -32,7 +32,7 @@ def find_squares(img):
...
@@ -32,7 +32,7 @@ def find_squares(img):
bin
=
cv
.
dilate
(
bin
,
None
)
bin
=
cv
.
dilate
(
bin
,
None
)
else
:
else
:
_retval
,
bin
=
cv
.
threshold
(
gray
,
thrs
,
255
,
cv
.
THRESH_BINARY
)
_retval
,
bin
=
cv
.
threshold
(
gray
,
thrs
,
255
,
cv
.
THRESH_BINARY
)
bin
,
contours
,
_hierarchy
=
cv
.
findContours
(
bin
,
cv
.
RETR_LIST
,
cv
.
CHAIN_APPROX_SIMPLE
)
contours
,
_hierarchy
=
cv
.
findContours
(
bin
,
cv
.
RETR_LIST
,
cv
.
CHAIN_APPROX_SIMPLE
)
for
cnt
in
contours
:
for
cnt
in
contours
:
cnt_len
=
cv
.
arcLength
(
cnt
,
True
)
cnt_len
=
cv
.
arcLength
(
cnt
,
True
)
cnt
=
cv
.
approxPolyDP
(
cnt
,
0.02
*
cnt_len
,
True
)
cnt
=
cv
.
approxPolyDP
(
cnt
,
0.02
*
cnt_len
,
True
)
...
...
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