Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
camtron
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kr69sugu
camtron
Commits
0ef280f5
Commit
0ef280f5
authored
3 years ago
by
am0ebe
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
6440df91
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
VideoAnalysis.cpp
+138
-138
138 additions, 138 deletions
VideoAnalysis.cpp
VideoAnalysis.h
+1
-1
1 addition, 1 deletion
VideoAnalysis.h
with
139 additions
and
139 deletions
VideoAnalysis.cpp
+
138
−
138
View file @
0ef280f5
...
@@ -18,152 +18,152 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>.
...
@@ -18,152 +18,152 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>.
namespace
bgslibrary
namespace
bgslibrary
{
{
VideoAnalysis
::
VideoAnalysis
()
:
VideoAnalysis
::
VideoAnalysis
()
:
use_file
(
false
),
use_camera
(
false
),
cameraIndex
(
0
),
use_file
(
false
),
use_camera
(
false
),
cameraIndex
(
0
),
use_comp
(
false
),
frameToStop
(
0
)
use_comp
(
false
),
frameToStop
(
0
)
{
{
std
::
cout
<<
"VideoAnalysis()"
<<
std
::
endl
;
std
::
cout
<<
"VideoAnalysis()"
<<
std
::
endl
;
}
}
VideoAnalysis
::~
VideoAnalysis
()
VideoAnalysis
::~
VideoAnalysis
()
{
{
std
::
cout
<<
"~VideoAnalysis()"
<<
std
::
endl
;
std
::
cout
<<
"~VideoAnalysis()"
<<
std
::
endl
;
}
}
bool
VideoAnalysis
::
setup
(
int
argc
,
const
char
**
argv
)
bool
VideoAnalysis
::
setup
(
int
argc
,
const
char
**
argv
)
{
{
bool
flag
=
false
;
bool
flag
=
false
;
#if CV_MAJOR_VERSION == 2
#if CV_MAJOR_VERSION == 2
const
char
*
keys
=
const
char
*
keys
=
"{hp|help|false|Print this message}"
"{hp|help|false|Print this message}"
"{uf|use_file|false|Use video file}"
"{uf|use_file|false|Use video file}"
"{fn|filename||Specify video file}"
"{fn|filename||Specify video file}"
"{uc|use_cam|false|Use camera}"
"{uc|use_cam|false|Use camera}"
"{ca|camera|0|Specify camera index}"
"{ca|camera|0|Specify camera index}"
"{co|use_comp|false|Use mask comparator}"
"{co|use_comp|false|Use mask comparator}"
"{st|stopAt|0|Frame number to stop}"
"{st|stopAt|0|Frame number to stop}"
"{im|imgref||Specify image file}"
"{im|imgref||Specify image file}"
;
;
#elif CV_MAJOR_VERSION == 3
#elif CV_MAJOR_VERSION == 3
const
std
::
string
keys
=
const
std
::
string
keys
=
"{h help ? | | Print this message }"
"{h help ? | | Print this message }"
"{uf use_file |false| Use a video file }"
"{uf use_file |false| Use a video file }"
"{fn filename | | Specify a video file }"
"{fn filename | | Specify a video file }"
"{uc use_cam |false| Use a webcamera }"
"{uc use_cam |false| Use a webcamera }"
"{ca camera | 0 | Specify camera index }"
"{ca camera | 0 | Specify camera index }"
"{co use_comp |false| Use mask comparator }"
"{co use_comp |false| Use mask comparator }"
"{st stopAt | 0 | Frame number to stop }"
"{st stopAt | 0 | Frame number to stop }"
"{im imgref | | Specify a image file }"
"{im imgref | | Specify a image file }"
;
;
#endif
#endif
cv
::
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
cv
::
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
#if CV_MAJOR_VERSION == 2
#if CV_MAJOR_VERSION == 2
if
(
argc
<=
1
||
cmd
.
get
<
bool
>
(
"help"
)
==
true
)
if
(
argc
<=
1
||
cmd
.
get
<
bool
>
(
"help"
)
==
true
)
{
{
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" [options]"
<<
std
::
endl
;
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" [options]"
<<
std
::
endl
;
std
::
cout
<<
"Available options:"
<<
std
::
endl
;
std
::
cout
<<
"Available options:"
<<
std
::
endl
;
cmd
.
printParams
();
cmd
.
printParams
();
return
false
;
return
false
;
}
}
#elif CV_MAJOR_VERSION == 3
#elif CV_MAJOR_VERSION == 3
if
(
argc
<=
1
||
cmd
.
has
(
"help"
))
if
(
argc
<=
1
||
cmd
.
has
(
"help"
))
{
{
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" [options]"
<<
std
::
endl
;
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" [options]"
<<
std
::
endl
;
std
::
cout
<<
"Available options:"
<<
std
::
endl
;
std
::
cout
<<
"Available options:"
<<
std
::
endl
;
cmd
.
printMessage
();
cmd
.
printMessage
();
return
false
;
return
false
;
}
}
if
(
!
cmd
.
check
())
if
(
!
cmd
.
check
())
{
{
cmd
.
printErrors
();
cmd
.
printErrors
();
return
false
;
return
false
;
}
}
#endif
#endif
use_file
=
cmd
.
get
<
bool
>
(
"uf"
);
//use_file
use_file
=
cmd
.
get
<
bool
>
(
"uf"
);
//use_file
filename
=
cmd
.
get
<
std
::
string
>
(
"fn"
);
//filename
filename
=
cmd
.
get
<
std
::
string
>
(
"fn"
);
//filename
use_camera
=
cmd
.
get
<
bool
>
(
"uc"
);
//use_cam
use_camera
=
cmd
.
get
<
bool
>
(
"uc"
);
//use_cam
cameraIndex
=
cmd
.
get
<
int
>
(
"ca"
);
//camera
cameraIndex
=
cmd
.
get
<
int
>
(
"ca"
);
//camera
use_comp
=
cmd
.
get
<
bool
>
(
"co"
);
//use_comp
use_comp
=
cmd
.
get
<
bool
>
(
"co"
);
//use_comp
frameToStop
=
cmd
.
get
<
int
>
(
"st"
);
//stopAt
frameToStop
=
cmd
.
get
<
int
>
(
"st"
);
//stopAt
imgref
=
cmd
.
get
<
std
::
string
>
(
"im"
);
//imgref
imgref
=
cmd
.
get
<
std
::
string
>
(
"im"
);
//imgref
std
::
cout
<<
"use_file: "
<<
use_file
<<
std
::
endl
;
std
::
cout
<<
"use_file: "
<<
use_file
<<
std
::
endl
;
std
::
cout
<<
"filename: "
<<
filename
<<
std
::
endl
;
std
::
cout
<<
"filename: "
<<
filename
<<
std
::
endl
;
std
::
cout
<<
"use_camera: "
<<
use_camera
<<
std
::
endl
;
std
::
cout
<<
"use_camera: "
<<
use_camera
<<
std
::
endl
;
std
::
cout
<<
"cameraIndex: "
<<
cameraIndex
<<
std
::
endl
;
std
::
cout
<<
"cameraIndex: "
<<
cameraIndex
<<
std
::
endl
;
std
::
cout
<<
"use_comp: "
<<
use_comp
<<
std
::
endl
;
std
::
cout
<<
"use_comp: "
<<
use_comp
<<
std
::
endl
;
std
::
cout
<<
"frameToStop: "
<<
frameToStop
<<
std
::
endl
;
std
::
cout
<<
"frameToStop: "
<<
frameToStop
<<
std
::
endl
;
std
::
cout
<<
"imgref: "
<<
imgref
<<
std
::
endl
;
std
::
cout
<<
"imgref: "
<<
imgref
<<
std
::
endl
;
//return false;
//return false;
if
(
use_file
)
if
(
use_file
)
{
{
if
(
filename
.
empty
())
if
(
filename
.
empty
())
{
{
std
::
cout
<<
"Specify filename"
<<
std
::
endl
;
std
::
cout
<<
"Specify filename"
<<
std
::
endl
;
return
false
;
return
false
;
}
}
flag
=
true
;
flag
=
true
;
}
}
if
(
use_camera
)
if
(
use_camera
)
flag
=
true
;
flag
=
true
;
if
(
flag
&&
use_comp
)
if
(
flag
&&
use_comp
)
{
{
if
(
imgref
.
empty
())
if
(
imgref
.
empty
())
{
{
std
::
cout
<<
"Specify image reference"
<<
std
::
endl
;
std
::
cout
<<
"Specify image reference"
<<
std
::
endl
;
return
false
;
return
false
;
}
}
}
}
return
flag
;
return
flag
;
}
}
void
VideoAnalysis
::
start
()
void
VideoAnalysis
::
start
()
{
{
//std::cout << "Press 'ESC' to stop..." << std::endl;
//std::cout << "Press 'ESC' to stop..." << std::endl;
do
do
{
{
videoCapture
=
new
VideoCapture
;
videoCapture
=
new
VideoCapture
;
frameProcessor
=
new
FrameProcessor
;
frameProcessor
=
new
FrameProcessor
;
frameProcessor
->
init
();
frameProcessor
->
init
();
frameProcessor
->
frameToStop
=
frameToStop
;
frameProcessor
->
frameToStop
=
frameToStop
;
frameProcessor
->
imgref
=
imgref
;
frameProcessor
->
imgref
=
imgref
;
videoCapture
->
setFrameProcessor
(
frameProcessor
);
videoCapture
->
setFrameProcessor
(
frameProcessor
);
if
(
use_file
)
if
(
use_file
)
videoCapture
->
setVideo
(
filename
);
videoCapture
->
setVideo
(
filename
);
if
(
use_camera
)
if
(
use_camera
)
videoCapture
->
setCamera
(
cameraIndex
);
videoCapture
->
setCamera
(
cameraIndex
);
videoCapture
->
start
();
videoCapture
->
start
();
if
(
use_file
||
use_camera
)
if
(
use_file
||
use_camera
)
break
;
break
;
frameProcessor
->
finish
();
frameProcessor
->
finish
();
int
key
=
cvWaitKey
(
500
);
int
key
=
cvWaitKey
(
500
);
if
(
key
==
KEY_ESC
)
if
(
key
==
KEY_ESC
)
break
;
break
;
delete
frameProcessor
;
delete
frameProcessor
;
delete
videoCapture
;
delete
videoCapture
;
}
while
(
1
);
}
while
(
1
);
delete
frameProcessor
;
delete
frameProcessor
;
delete
videoCapture
;
delete
videoCapture
;
}
}
}
}
This diff is collapsed.
Click to expand it.
VideoAnalysis.h
+
1
−
1
View file @
0ef280f5
...
@@ -16,7 +16,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>.
...
@@ -16,7 +16,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#pragma once
#pragma once
#include
<iostream>
#include
<iostream>
#include
<sstream>
#include
<sstream>
#include
"VideoCapture.h"
#include
"VideoCapture.h"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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