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
09f48f44
Commit
09f48f44
authored
6 years ago
by
Thomas Boy
Browse files
Options
Downloads
Patches
Plain Diff
test bk model needs static picture
parent
cf0601db
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
Demo.cpp
+30
-22
30 additions, 22 deletions
Demo.cpp
package_bgs/Tapter.cpp
+0
-3
0 additions, 3 deletions
package_bgs/Tapter.cpp
with
30 additions
and
25 deletions
Demo.cpp
+
30
−
22
View file @
09f48f44
...
...
@@ -234,25 +234,27 @@ int main(int argc, char * argv[])
cout
<<
"circleRadius: "
<<
circleRadius
<<
endl
;
fsCen
.
release
();
//first the static pic**********
//std::string fileName = getFileName(begin);
std
::
string
staticFile
=
inputDir
+
"/bk.jpg"
;
cout
<<
"a) load first static background pic :"
<<
staticFile
<<
endl
;
img_input
=
imread
(
staticFile
.
c_str
(),
CV_LOAD_IMAGE_COLOR
);
if
(
img_input
.
data
)
{
//we cut out a smaller ROI
img_input
=
TToolBox
::
cropImageCircle
(
img_input
,
circleCenterX
,
circleCenterY
,
circleRadius
);
cv
::
Mat
img_mask
;
cv
::
Mat
img_bkgmodel
;
bgs
->
process
(
img_input
,
img_mask
,
img_bkgmodel
);
}
else
{
cout
<<
"error loading file: "
<<
staticFile
<<
", will abort"
<<
endl
;
return
EXIT_FAILURE
;
}
// //first the static pic**********
// //std::string fileName = getFileName(begin);
// std::string staticFile = inputDir+"/bk.jpg";
// cout <<"a) load first static background pic :"<< staticFile<<endl;
// img_input = imread(staticFile.c_str(), CV_LOAD_IMAGE_COLOR);
// if(img_input.data )
// {
// //we cut out a smaller ROI
// img_input = TToolBox::cropImageCircle(img_input,circleCenterX,circleCenterY,circleRadius);
// cv::Mat img_mask;
// cv::Mat img_bkgmodel;
// bgs->process(img_input, img_mask, img_bkgmodel);
// }
// else
// {
// cout<<"error loading file: "<< staticFile<<", will abort"<<endl;
// return EXIT_FAILURE;
// }
std
::
string
fileName
;
...
...
@@ -276,6 +278,7 @@ int main(int argc, char * argv[])
cout
<<
"b) we train the background with random choosen files"
<<
fileName
<<
endl
;
vector
<
string
>
myRandomTrainList
;
//we save all draws in a list which will save to the results
cv
::
Mat
img_bkgmodel
;
for
(
i
=
0
;
i
<
amountTrainingSteps
;
i
++
)
{
//random index
...
...
@@ -294,8 +297,12 @@ int main(int argc, char * argv[])
//cv::imshow("input", img_input);
cv
::
Mat
img_mask
;
cv
::
Mat
img_bkgmodel
;
bgs
->
process
(
img_input
,
img_mask
,
img_bkgmodel
);
// by default, it shows automatically the foreground mask image
//we save the bk gmodel
std
::
string
bkTestFileName
=
inputDir
+
"bk_"
+
TToolBox
::
mNzero
(
i
)
+
".jpg"
;
imwrite
(
bkTestFileName
.
c_str
(),
img_bkgmodel
);
}
else
{
...
...
@@ -304,6 +311,7 @@ int main(int argc, char * argv[])
}
}
cout
<<
"c) we produce train the background with random choosen files"
<<
fileName
<<
endl
;
bgs
->
setInitialFrameCounter
(
0
);
bgs
->
setFlagWrite
(
1
);
...
...
@@ -317,7 +325,7 @@ int main(int argc, char * argv[])
clock_t
begin
=
clock
();
fileName
=
inputDir
+
TToolBox
::
getFileName
(
i
);
cout
<<
"
\t
"
<<
i
<<
"of
\t
"
<<
begin
+
step
s
<<
"load file :"
<<
fileName
<<
endl
;
cout
<<
"
\t
"
<<
i
<<
"of
\t
"
<<
amountFile
s
<<
"
load file :"
<<
fileName
<<
endl
;
//cv::imwrite(convert.str().c_str(), img_output);
img_input
=
imread
(
fileName
.
c_str
(),
CV_LOAD_IMAGE_COLOR
);
...
...
@@ -354,7 +362,7 @@ int main(int argc, char * argv[])
clock_t
endAll
=
clock
();
double
elapsedSecTotal
=
double
(
endAll
-
beginAll
)
/
CLOCKS_PER_SEC
;
cout
<<
"process single pic:
\t
"
<<
elapsedSecs
<<
" s
\t
:"
<<
amountFiles
<<
"
\t
-
\t
"
<<
(
int
)(
elapsedSecTotal
/
60
)
<<
"
min
"
<<
endl
;
cout
<<
"process single pic:
\t
"
<<
elapsedSecs
<<
" s
-
\t\t
"
<<
(
int
)(
elapsedSecTotal
/
60
)
<<
" min
-
\t
"
<<
(
int
)(
elapsedSecTotal
/
60
/
60
)
<<
"
h
"
<<
endl
;
}
...
...
This diff is collapsed.
Click to expand it.
package_bgs/Tapter.cpp
+
0
−
3
View file @
09f48f44
...
...
@@ -72,9 +72,6 @@ void Tapter::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img
IplImage
*
frame
=
new
IplImage
(
img_input
);
if
(
firstTime
)
{
int
w
=
cvGetSize
(
frame
).
width
;
...
...
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