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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kr69sugu
camtron
Commits
3f9d68aa
Commit
3f9d68aa
authored
Nov 11, 2019
by
Thomas Boy
Browse files
Options
Downloads
Patches
Plain Diff
is working pretty well, so we do a full test run
parent
0b5a9d7f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Demo.cpp
+42
-10
42 additions, 10 deletions
Demo.cpp
with
42 additions
and
10 deletions
Demo.cpp
+
42
−
10
View file @
3f9d68aa
/*
/*
./bgs_demo -i test45/ -a 100 -o test45/results/
./bgs_demo -i test45/ -a 100 -o test45/results
based on original demo.cpp
*/
*/
//cpp c
//cpp c
...
@@ -20,6 +19,9 @@ based on original demo.cpp
...
@@ -20,6 +19,9 @@ based on original demo.cpp
#include
<string.h>
#include
<string.h>
#include
<unistd.h>
#include
<unistd.h>
//cpp 11X
#include
<regex>
#define PROCESS_CENTER_VERSION_MAJOR 2
#define PROCESS_CENTER_VERSION_MAJOR 2
#define PROCESS_CENTER_VERSION_MINOR 0
#define PROCESS_CENTER_VERSION_MINOR 0
...
@@ -46,6 +48,9 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option);
...
@@ -46,6 +48,9 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option);
std
::
vector
<
char
>
copyDataInBuffer
(
struct
archive
*
aw
);
std
::
vector
<
char
>
copyDataInBuffer
(
struct
archive
*
aw
);
//! we convert our actual jpg file number to framenumber
int
toFrameNumber
(
std
::
string
filename
);
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
signal
(
SIGUSR1
,
my_handler
);
signal
(
SIGUSR1
,
my_handler
);
...
@@ -55,12 +60,12 @@ int main(int argc, char * argv[])
...
@@ -55,12 +60,12 @@ int main(int argc, char * argv[])
//!** parse programm input****************/
//!** parse programm input****************/
if
(
cmdOptionExists
(
argv
,
argv
+
argc
,
"-h"
))
if
(
cmdOptionExists
(
argv
,
argv
+
argc
,
"-h"
))
{
{
cout
<<
" error: please use command as
\n
./bgs_demo -i
pathToInputDir
-a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"
<<
endl
;
cout
<<
" error: please use command as
\n
./bgs_demo -i
inputTarFile
-a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"
<<
endl
;
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
if
(
!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-i"
)
||!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-a"
)
||!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-o"
)
||!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-p"
))
if
(
!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-i"
)
||!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-a"
)
||!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-o"
)
||!
cmdOptionExists
(
argv
,
argv
+
argc
,
"-p"
))
{
{
cout
<<
" error: please use command as
\n
./bgs_demo -i
pathToInputDir
-a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"
<<
endl
;
cout
<<
" error: please use command as
\n
./bgs_demo -i
inputTarFile
-a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"
<<
endl
;
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
...
@@ -246,6 +251,7 @@ int main(int argc, char * argv[])
...
@@ -246,6 +251,7 @@ int main(int argc, char * argv[])
int
everyPic
=
60
*
5
;
int
everyPic
=
60
*
5
;
//std::string fileName;
//std::string fileName;
int
frameCounter
=
0
;
int
frameCounter
=
0
;
int
frameCounterOld
=
-
1
;
vector
<
string
>
myFileErrorList
;
//list for pure io error
vector
<
string
>
myFileErrorList
;
//list for pure io error
vector
<
string
>
myFileListNoContour
;
//list for no contours found;
vector
<
string
>
myFileListNoContour
;
//list for no contours found;
vector
<
string
>
myFileListAfterContourSelection
;
//list for no contours found after selection;
vector
<
string
>
myFileListAfterContourSelection
;
//list for no contours found after selection;
...
@@ -276,8 +282,17 @@ int main(int argc, char * argv[])
...
@@ -276,8 +282,17 @@ int main(int argc, char * argv[])
const
char
*
fileNamePtr
=
archive_entry_pathname
(
entry
);
const
char
*
fileNamePtr
=
archive_entry_pathname
(
entry
);
std
::
string
filename
(
fileNamePtr
,
strlen
(
fileNamePtr
)
);
std
::
string
filename
(
fileNamePtr
,
strlen
(
fileNamePtr
)
);
//cout << "fileName: "<< filename <<endl;
//cout << "fileName: "<< filename <<endl;
//we convert it to a framenumber
frameCounter
=
toFrameNumber
(
filename
);
if
(
frameCounterOld
>
frameCounter
)
{
cerr
<<
" error during read in the file number, we do have non montonic order, will abort"
;
exit
(
1
);
}
frameCounterOld
=
frameCounter
;
//TODO we should test what file we have, this filenumber n = n - 1 ??
r
=
archive_write_header
(
ext
,
entry
);
r
=
archive_write_header
(
ext
,
entry
);
if
(
r
!=
ARCHIVE_OK
)
if
(
r
!=
ARCHIVE_OK
)
{
{
...
@@ -300,8 +315,6 @@ int main(int argc, char * argv[])
...
@@ -300,8 +315,6 @@ int main(int argc, char * argv[])
//we read the image buffer as a jpg picture and decode it
//we read the image buffer as a jpg picture and decode it
Mat
img_input
=
imdecode
(
Mat
(
vec
),
1
);
Mat
img_input
=
imdecode
(
Mat
(
vec
),
1
);
// //we define the type better to prevent error
// //we define the type better to prevent error
// fileName = std::string(inputFile + TToolBox::getFileName(frameCounter));
// fileName = std::string(inputFile + TToolBox::getFileName(frameCounter));
// cv::String fileNameCV(fileName);
// cv::String fileNameCV(fileName);
...
@@ -561,6 +574,8 @@ int main(int argc, char * argv[])
...
@@ -561,6 +574,8 @@ int main(int argc, char * argv[])
if
(
g_badSignalFlagAbort
)
if
(
g_badSignalFlagAbort
)
frameCounter
=
amountFiles
;
//we abort
frameCounter
=
amountFiles
;
//we abort
if
(
frameCounter
>
10
)
exit
(
0
);
//the test abort function
}
//end for ever loop
}
//end for ever loop
//finishing time
//finishing time
...
@@ -675,3 +690,20 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option)
...
@@ -675,3 +690,20 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option)
{
{
return
std
::
find
(
begin
,
end
,
option
)
!=
end
;
return
std
::
find
(
begin
,
end
,
option
)
!=
end
;
}
}
int
toFrameNumber
(
std
::
string
filename
)
{
int
retVal
=
-
1
;
//we cut out all non needed substrings
filename
=
regex_replace
(
filename
,
regex
(
"/"
),
""
);
filename
=
regex_replace
(
filename
,
regex
(
"data_sized"
),
""
);
filename
=
regex_replace
(
filename
,
regex
(
"jpg"
),
""
);
filename
=
regex_replace
(
filename
,
regex
(
"
\\
."
),
""
);
retVal
=
std
::
stoi
(
filename
);
//cout <<"filename out:" << filename << " number: "<< retVal << endl;
return
retVal
;
}
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