Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
tutorial-grabber-1394-writer.cpp
1
2
#include <visp3/core/vpConfig.h>
3
#include <visp3/core/vpImage.h>
4
#include <visp3/gui/vpDisplayFactory.h>
5
#include <visp3/io/vpVideoWriter.h>
6
#include <visp3/sensor/vp1394TwoGrabber.h>
7
8
int
main(
int
argc,
char
**)
9
{
10
#ifdef VISP_HAVE_DC1394
11
#ifdef ENABLE_VISP_NAMESPACE
12
using namespace
VISP_NAMESPACE_NAME
;
13
#endif
14
#ifdef VISP_HAVE_DISPLAY
15
vpDisplay
*
d
=
vpDisplayFactory::allocateDisplay
();
16
#else
17
std::cout <<
"No image viewer is available..."
<< std::endl;
18
#endif
19
try
{
20
bool
save =
false
;
21
if
(argc == 2) {
22
save =
true
;
23
}
24
25
vpImage<vpRGBa>
I;
// Create a color image container
26
bool
reset =
true
;
// Enable bus reset during construction (default)
27
vp1394TwoGrabber
g(reset);
// Create a grabber based on libdc1394-2.x third party lib
28
29
g.setVideoMode(
vp1394TwoGrabber::vpVIDEO_MODE_640x480_MONO8
);
30
g.setFramerate(
vp1394TwoGrabber::vpFRAMERATE_60
);
31
g.open(I);
32
33
std::cout <<
"Image size: "
<< I.getWidth() <<
" "
<< I.getHeight() << std::endl;
34
35
vpVideoWriter
writer;
36
writer.
setFileName
(
"./I%04d.pgm"
);
37
if
(save)
38
writer.
open
(I);
39
40
#ifdef VISP_HAVE_DISPLAY
41
d
->init(I);
42
while
(1)
43
#else
44
// for loop when no display is available to avoid infinite while loop
45
for
(
unsigned
int
i = 0;
i
< 1000; ++
i
)
46
#endif
47
{
48
g.acquire(I);
49
50
if
(save)
51
writer.
saveFrame
(I);
52
53
#ifdef VISP_HAVE_DISPLAY
54
vpDisplay::display
(I);
55
vpDisplay::flush
(I);
56
57
if
(
vpDisplay::getClick
(I,
false
)) {
58
break
;
59
}
60
#endif
61
}
62
63
if
(save) {
64
writer.
close
();
65
}
66
}
67
catch
(
const
vpException
&e) {
68
std::cout <<
"Catch an exception: "
<<
e
<< std::endl;
69
}
70
#ifdef VISP_HAVE_DISPLAY
71
if
(d !=
nullptr
) {
72
delete
d
;
73
}
74
#endif
75
#else
76
(void)argc;
77
#endif
78
79
return
EXIT_SUCCESS;
80
}
vp1394TwoGrabber
Class for firewire ieee1394 video devices using libdc1394-2.x api.
Definition
vp1394TwoGrabber.h:185
vp1394TwoGrabber::vpFRAMERATE_60
@ vpFRAMERATE_60
Definition
vp1394TwoGrabber.h:257
vp1394TwoGrabber::vpVIDEO_MODE_640x480_MONO8
@ vpVIDEO_MODE_640x480_MONO8
Definition
vp1394TwoGrabber.h:217
vpDisplay
Class that defines generic functionalities for display.
Definition
vpDisplay.h:171
vpDisplay::getClick
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Definition
vpDisplay_uchar.cpp:894
vpDisplay::display
static void display(const vpImage< unsigned char > &I)
Definition
vpDisplay_uchar.cpp:869
vpDisplay::flush
static void flush(const vpImage< unsigned char > &I)
Definition
vpDisplay_uchar.cpp:845
vpException
error that can be emitted by ViSP classes.
Definition
vpException.h:60
vpImage
Definition of the vpImage class member functions.
Definition
vpImage.h:131
vpVideoWriter
Class that enables to write easily a video file or a sequence of images.
Definition
vpVideoWriter.h:171
vpVideoWriter::saveFrame
void saveFrame(vpImage< vpRGBa > &I)
Definition
vpVideoWriter.cpp:202
vpVideoWriter::setFileName
void setFileName(const std::string &filename)
Definition
vpVideoWriter.cpp:91
vpVideoWriter::close
void close()
Definition
vpVideoWriter.cpp:270
vpVideoWriter::open
void open(vpImage< vpRGBa > &I)
Definition
vpVideoWriter.cpp:117
VISP_NAMESPACE_NAME
Definition
vpEigenConversion.h:44
ibvs-four-points.e
e
Definition
ibvs-four-points.py:272
vpDisplayFactory::allocateDisplay
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.
Definition
vpDisplayFactory.h:68
yolo-centering-task-afma6.d
d
Definition
yolo-centering-task-afma6.py:273
yolo-centering-task-afma6.i
i
Definition
yolo-centering-task-afma6.py:329
tutorial
grabber
tutorial-grabber-1394-writer.cpp
Generated by
1.17.0