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
434dc4a9
Commit
434dc4a9
authored
3 years ago
by
am0ebe
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
e45e89db
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
examples/Demo.cpp
+28
-31
28 additions, 31 deletions
examples/Demo.cpp
examples/run_demo.sh
+3
-3
3 additions, 3 deletions
examples/run_demo.sh
with
31 additions
and
34 deletions
examples/Demo.cpp
+
28
−
31
View file @
434dc4a9
...
...
@@ -2,8 +2,7 @@
bgs_demo -i ../../dataset/video.tar -a 100 -o ../../output -c ../../config/centerConfigFile.xml -p ../../config/camParam.xml
TODO
> input = tar of mp4s?
> amount = ??? number of mp4s??
> input = tar of images!
#### Background Subtraction Methods #####
...
...
@@ -88,7 +87,6 @@ e) save the remaining centroids for a frame to file
void
my_handler
(
int
signum
);
vector
<
char
>
copyDataInBuffer
(
struct
archive
*
aw
);
int
toFrameNumber
(
string
filename
);
//! convert our actual jpg file number to framenumber
void
init
();
void
read_camParamFile
();
void
read_centerFile
();
void
libArchive_init
();
...
...
@@ -114,9 +112,11 @@ struct archive_entry *entry;
int
g_badSignalFlagAbort
=
0
;
Scalar
color_red
(
0
,
0
,
255
,
255
);
bool
testMode
;
namespace
error
{
enum
{
argument_parse_error
,
libarchive_file
,
unexpected_frame_number
,
file_not_found
,
...
...
@@ -156,11 +156,12 @@ void parse(int argc, char** argv)
{
const
String
keys
=
"{help h usage ? || "
+
String
(
argv
[
0
])
+
" -i=in.tar -a=10 -c=center.xml -o=outPath -p=camparam.xml }"
"{i|../input/| input tarfile/dir containing tars? }"
"{o|../output| output path / dir }"
"{a|| amount of files/frames }"
"{p|../config/camparam.yml| camera parameter file }"
"{c|../config/center.xml| exact center xml-conf file }"
"{i input|../input/| input tarfile/dir containing tars? }"
"{o output|../output| output path / dir }"
"{a amount|| amount of frames }"
"{p param|../config/camparam.yml| camera parameter file }"
"{c center|../config/center.xml| exact center xml-conf file }"
"{t testMode|false|test mode for debugging purposes. eg. only process 10 frames}"
;
CommandLineParser
parser
(
argc
,
argv
,
keys
);
...
...
@@ -178,26 +179,20 @@ void parse(int argc, char** argv)
camParamFile
=
parser
.
get
<
String
>
(
"p"
);
centerFile
=
parser
.
get
<
String
>
(
"c"
);
if
(
parser
.
has
(
"testMode"
))
testMode
=
parser
.
get
<
bool
>
(
"t"
);
if
(
!
parser
.
check
())
{
parser
.
printErrors
();
exit
(
1
);
exit
(
error
::
argument_parse_error
);
}
std
::
cout
<<
"amountFiles: "
<<
amountFiles
<<
std
::
endl
;
std
::
cout
<<
"testMode: "
<<
testMode
<<
std
::
endl
;
checkFiles
({{
"camParamFile"
,
camParamFile
},
{
"centerFile"
,
centerFile
},
{
"outputDir"
,
outputDir
},
{
"inputFile"
,
inputFile
}});
}
void
init
()
{
signal
(
SIGUSR1
,
my_handler
);
srand
(
time
(
NULL
));
//init the random number generator
read_camParamFile
();
read_centerFile
();
libArchive_init
();
}
void
read_camParamFile
()
{
FileStorage
fs
(
camParamFile
,
FileStorage
::
READ
);
...
...
@@ -241,7 +236,7 @@ void libArchive_init()
{
int
flags
=
ARCHIVE_EXTRACT_TIME
;
// see https://linux.die.net/man/3/archive_write_disk for more flags
const
char
*
filename
=
inputFile
.
c_str
();
//XXX needed?
//
const char *filename = "testFile"; //XXX needed?
//
"testFile" || "data_sized.tar"
archive
=
archive_read_new
();
ext
=
archive_write_disk_new
();
...
...
@@ -263,26 +258,26 @@ void libArchive_init()
int
main
(
int
argc
,
char
*
argv
[])
{
parse
(
argc
,
argv
);
init
();
cout
<<
"Using OpenCV "
<<
CV_MAJOR_VERSION
<<
"."
<<
CV_MINOR_VERSION
<<
"."
<<
CV_SUBMINOR_VERSION
<<
endl
;
cout
<<
"Using processcenter "
<<
PROCESS_CENTER_VERSION_MAJOR
<<
"."
<<
PROCESS_CENTER_VERSION_MINOR
<<
"."
<<
PROCESS_CENTER_VERSION_MINOR_FIXES
<<
endl
<<
endl
;
signal
(
SIGUSR1
,
my_handler
);
srand
(
time
(
NULL
));
//init the random number generator
parse
(
argc
,
argv
);
read_camParamFile
();
read_centerFile
();
libArchive_init
();
// IBGS *bgs = new FrameDifference;
IBGS
*
bgs
=
new
PixelBasedAdaptiveSegmenter
;
// TODO
int
ret
=
system
(
"echo 'sleep a bit... ' && sleep 12"
);
exit
(
ret
);
cout
<<
"a) process all frames "
<<
endl
;
int
everyPic
=
60
*
5
;
//string fileName;
int
frameCounter
=
0
;
int
everyPic
=
60
*
5
;
int
frameCounter
=
0
;
int
myFileTarWriterHeaderCounter
=
0
;
int
frameCounterOld
=
-
1
;
int
r
=
-
1
;
...
...
@@ -316,9 +311,10 @@ int main(int argc, char * argv[])
// get filename
const
char
*
fileNamePtr
=
archive_entry_pathname
(
entry
);
string
filename
(
fileNamePtr
,
strlen
(
fileNamePtr
)
);
//
cout << "fileName: " << filename << endl;
cout
<<
"fileName: "
<<
filename
<<
endl
;
// convert it to a framenumber
frameCounter
=
toFrameNumber
(
filename
);
cout
<<
"frameCounter: "
<<
frameCounter
<<
endl
;
if
(
frameCounterOld
>
frameCounter
)
{
...
...
@@ -593,7 +589,8 @@ int main(int argc, char * argv[])
if
(
g_badSignalFlagAbort
)
frameCounter
=
amountFiles
;
// abort
//if(frameCounter>10)exit(0); //the test abort function
if
(
testMode
&&
frameCounter
>
10
)
exit
(
0
);
}
//end for ever loop
...
...
This diff is collapsed.
Click to expand it.
examples/run_demo.sh
+
3
−
3
View file @
434dc4a9
#!/bin/bash
# ./build/bgs_demo -a=40 -p=../config/2019-10-15-d4-calibration-parameter-n500.xml -o=../output -c=../config/camera_center_d3.xml
./build/bgs_demo
-i
=
../input/rec1
1983200track.mp4
-a
=
4
0
-p
=
../config/2019-10-15-d4-calibration-parameter-n500.xml
-o
=
../output
-c
=
../config/camera_center_d3.xml
./build/bgs_demo
-i
=
../input/rec1
2345678p.tar
-a
=
4
-p
=
../config/2019-10-15-d4-calibration-parameter-n500.xml
-o
=
../output
-c
=
../config/camera_center_d3.xml
# -i data_sized.tar (not gzipped)
#multiple tar'ed videos?
# looking for sth like: rec1235678p/
#
multiple tar'ed videos?
# looking for sth like: rec1235678p/
# -a ?
...
...
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