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
48c9dc2b
Commit
48c9dc2b
authored
8 years ago
by
Rich Lewis
Browse files
Options
Downloads
Patches
Plain Diff
update the macos demo to work with OpenCV 3.x
parent
209a2ff5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demos/macosx/FrameDifferenceTest.cpp
+13
-15
13 additions, 15 deletions
demos/macosx/FrameDifferenceTest.cpp
with
13 additions
and
15 deletions
demos/macosx/FrameDifferenceTest.cpp
+
13
−
15
View file @
48c9dc2b
#include
<iostream>
#include
<iostream>
#include
<cv.h>
#include
<opencv2/opencv.hpp>
#include
<highgui.h>
#include
"../../package_bgs/FrameDifference.h"
#include
"../../package_bgs/FrameDifference.h"
using
namespace
bgslibrary
::
algorithms
;
using
namespace
bgslibrary
::
algorithms
;
//using namespace cv;
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
CvCapture
*
capture
=
0
;
cv
::
VideoCapture
capture
(
0
);
capture
=
cvCaptureFromCAM
(
0
);
if
(
!
capture
){
if
(
!
capture
.
isOpened
())
{
std
::
cerr
<<
"Cannot initialize video!"
<<
std
::
endl
;
std
::
cerr
<<
"Cannot initialize video!"
<<
std
::
endl
;
return
-
1
;
return
-
1
;
}
}
...
@@ -19,13 +19,13 @@ int main(int argc, char **argv)
...
@@ -19,13 +19,13 @@ int main(int argc, char **argv)
IBGS
*
bgs
;
IBGS
*
bgs
;
bgs
=
new
FrameDifference
;
bgs
=
new
FrameDifference
;
IplImage
*
frame
;
int
key
=
0
;
while
(
1
)
cv
::
Mat
img_input
;
while
(
key
!=
'q'
)
{
{
frame
=
cvQueryFrame
(
capture
)
;
capture
>>
img_input
;
if
(
!
frame
)
break
;
if
(
img_input
.
empty
()
)
break
;
cv
::
Mat
img_input
(
frame
);
cv
::
imshow
(
"Input"
,
img_input
);
cv
::
imshow
(
"Input"
,
img_input
);
cv
::
Mat
img_mask
;
cv
::
Mat
img_mask
;
...
@@ -34,18 +34,16 @@ int main(int argc, char **argv)
...
@@ -34,18 +34,16 @@ int main(int argc, char **argv)
// by default, it shows automatically the foreground mask image
// by default, it shows automatically the foreground mask image
bgs
->
process
(
img_input
,
img_mask
,
img_bkgmodel
);
bgs
->
process
(
img_input
,
img_mask
,
img_bkgmodel
);
//if(!img_mask.empty())
key
=
cvWaitKey
(
33
);
// cv::imshow("Foreground", img_mask);
// do something
if
(
cvWaitKey
(
33
)
>=
0
)
if
(
key
>=
0
)
break
;
break
;
}
}
delete
bgs
;
delete
bgs
;
capture
.
release
();
cvDestroyAllWindows
();
cvDestroyAllWindows
();
cvReleaseCapture
(
&
capture
);
return
0
;
return
0
;
}
}
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