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
Branches
Branches containing commit
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 @@
...
@@ -2,8 +2,7 @@
bgs_demo -i ../../dataset/video.tar -a 100 -o ../../output -c ../../config/centerConfigFile.xml -p ../../config/camParam.xml
bgs_demo -i ../../dataset/video.tar -a 100 -o ../../output -c ../../config/centerConfigFile.xml -p ../../config/camParam.xml
TODO
TODO
> input = tar of mp4s?
> input = tar of images!
> amount = ??? number of mp4s??
#### Background Subtraction Methods #####
#### Background Subtraction Methods #####
...
@@ -88,7 +87,6 @@ e) save the remaining centroids for a frame to file
...
@@ -88,7 +87,6 @@ e) save the remaining centroids for a frame to file
void
my_handler
(
int
signum
);
void
my_handler
(
int
signum
);
vector
<
char
>
copyDataInBuffer
(
struct
archive
*
aw
);
vector
<
char
>
copyDataInBuffer
(
struct
archive
*
aw
);
int
toFrameNumber
(
string
filename
);
//! convert our actual jpg file number to framenumber
int
toFrameNumber
(
string
filename
);
//! convert our actual jpg file number to framenumber
void
init
();
void
read_camParamFile
();
void
read_camParamFile
();
void
read_centerFile
();
void
read_centerFile
();
void
libArchive_init
();
void
libArchive_init
();
...
@@ -114,9 +112,11 @@ struct archive_entry *entry;
...
@@ -114,9 +112,11 @@ struct archive_entry *entry;
int
g_badSignalFlagAbort
=
0
;
int
g_badSignalFlagAbort
=
0
;
Scalar
color_red
(
0
,
0
,
255
,
255
);
Scalar
color_red
(
0
,
0
,
255
,
255
);
bool
testMode
;
namespace
error
{
namespace
error
{
enum
{
enum
{
argument_parse_error
,
libarchive_file
,
libarchive_file
,
unexpected_frame_number
,
unexpected_frame_number
,
file_not_found
,
file_not_found
,
...
@@ -156,11 +156,12 @@ void parse(int argc, char** argv)
...
@@ -156,11 +156,12 @@ void parse(int argc, char** argv)
{
{
const
String
keys
=
const
String
keys
=
"{help h usage ? || "
+
String
(
argv
[
0
])
+
" -i=in.tar -a=10 -c=center.xml -o=outPath -p=camparam.xml }"
"{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? }"
"{i input|../input/| input tarfile/dir containing tars? }"
"{o|../output| output path / dir }"
"{o output|../output| output path / dir }"
"{a|| amount of files/frames }"
"{a amount|| amount of frames }"
"{p|../config/camparam.yml| camera parameter file }"
"{p param|../config/camparam.yml| camera parameter file }"
"{c|../config/center.xml| exact center xml-conf 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
);
CommandLineParser
parser
(
argc
,
argv
,
keys
);
...
@@ -178,26 +179,20 @@ void parse(int argc, char** argv)
...
@@ -178,26 +179,20 @@ void parse(int argc, char** argv)
camParamFile
=
parser
.
get
<
String
>
(
"p"
);
camParamFile
=
parser
.
get
<
String
>
(
"p"
);
centerFile
=
parser
.
get
<
String
>
(
"c"
);
centerFile
=
parser
.
get
<
String
>
(
"c"
);
if
(
parser
.
has
(
"testMode"
))
testMode
=
parser
.
get
<
bool
>
(
"t"
);
if
(
!
parser
.
check
())
if
(
!
parser
.
check
())
{
{
parser
.
printErrors
();
parser
.
printErrors
();
exit
(
1
);
exit
(
error
::
argument_parse_error
);
}
}
std
::
cout
<<
"amountFiles: "
<<
amountFiles
<<
std
::
endl
;
std
::
cout
<<
"amountFiles: "
<<
amountFiles
<<
std
::
endl
;
std
::
cout
<<
"testMode: "
<<
testMode
<<
std
::
endl
;
checkFiles
({{
"camParamFile"
,
camParamFile
},
{
"centerFile"
,
centerFile
},
{
"outputDir"
,
outputDir
},
{
"inputFile"
,
inputFile
}});
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
()
void
read_camParamFile
()
{
{
FileStorage
fs
(
camParamFile
,
FileStorage
::
READ
);
FileStorage
fs
(
camParamFile
,
FileStorage
::
READ
);
...
@@ -241,7 +236,7 @@ void libArchive_init()
...
@@ -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
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
=
inputFile
.
c_str
();
//XXX needed?
//
const char *filename = "testFile"; //XXX needed?
//
"testFile" || "data_sized.tar"
archive
=
archive_read_new
();
archive
=
archive_read_new
();
ext
=
archive_write_disk_new
();
ext
=
archive_write_disk_new
();
...
@@ -263,26 +258,26 @@ void libArchive_init()
...
@@ -263,26 +258,26 @@ void libArchive_init()
int
main
(
int
argc
,
char
*
argv
[])
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 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
;
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 FrameDifference;
IBGS
*
bgs
=
new
PixelBasedAdaptiveSegmenter
;
// TODO
IBGS
*
bgs
=
new
PixelBasedAdaptiveSegmenter
;
// TODO
int
ret
=
system
(
"echo 'sleep a bit... ' && sleep 12"
);
exit
(
ret
);
cout
<<
"a) process all frames "
<<
endl
;
cout
<<
"a) process all frames "
<<
endl
;
int
everyPic
=
60
*
5
;
int
everyPic
=
60
*
5
;
//string fileName;
int
frameCounter
=
0
;
int
frameCounter
=
0
;
int
myFileTarWriterHeaderCounter
=
0
;
int
myFileTarWriterHeaderCounter
=
0
;
int
frameCounterOld
=
-
1
;
int
frameCounterOld
=
-
1
;
int
r
=
-
1
;
int
r
=
-
1
;
...
@@ -316,9 +311,10 @@ int main(int argc, char * argv[])
...
@@ -316,9 +311,10 @@ int main(int argc, char * argv[])
// get filename
// get filename
const
char
*
fileNamePtr
=
archive_entry_pathname
(
entry
);
const
char
*
fileNamePtr
=
archive_entry_pathname
(
entry
);
string
filename
(
fileNamePtr
,
strlen
(
fileNamePtr
)
);
string
filename
(
fileNamePtr
,
strlen
(
fileNamePtr
)
);
//
cout << "fileName: " << filename << endl;
cout
<<
"fileName: "
<<
filename
<<
endl
;
// convert it to a framenumber
// convert it to a framenumber
frameCounter
=
toFrameNumber
(
filename
);
frameCounter
=
toFrameNumber
(
filename
);
cout
<<
"frameCounter: "
<<
frameCounter
<<
endl
;
if
(
frameCounterOld
>
frameCounter
)
if
(
frameCounterOld
>
frameCounter
)
{
{
...
@@ -593,7 +589,8 @@ int main(int argc, char * argv[])
...
@@ -593,7 +589,8 @@ int main(int argc, char * argv[])
if
(
g_badSignalFlagAbort
)
if
(
g_badSignalFlagAbort
)
frameCounter
=
amountFiles
;
// abort
frameCounter
=
amountFiles
;
// abort
//if(frameCounter>10)exit(0); //the test abort function
if
(
testMode
&&
frameCounter
>
10
)
exit
(
0
);
}
//end for ever loop
}
//end for ever loop
...
...
This diff is collapsed.
Click to expand it.
examples/run_demo.sh
+
3
−
3
View file @
434dc4a9
#!/bin/bash
#!/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 -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)
# -i data_sized.tar (not gzipped)
#multiple tar'ed videos?
#
multiple tar'ed videos?
# looking for sth like: rec1235678p/
# looking for sth like: rec1235678p/
# -a ?
# -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