Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
tutorial-grabber-CMU1394.cpp
1
2#include <visp3/core/vpConfig.h>
3#include <visp3/core/vpImage.h>
4#include <visp3/gui/vpDisplayFactory.h>
5#include <visp3/sensor/vp1394CMUGrabber.h>
6
7int main()
8{
9#ifdef VISP_HAVE_CMU1394
10#ifdef ENABLE_VISP_NAMESPACE
11 using namespace VISP_NAMESPACE_NAME;
12#endif
13#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
14 std::shared_ptr<vpDisplay> display;
15#else
16 vpDisplay *display = nullptr;
17#endif
18 try {
20
22 g.setVideoMode(0, 1); // 640x480 MONO8
24 g.setAutoGain();
25 g.setFramerate(4); // 30 fps
26 g.open(I);
27
28 std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
29
30#ifdef VISP_HAVE_DISPLAY
31#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
33#else
35#endif
36#else
37 std::cout << "No image viewer is available..." << std::endl;
38#endif
39
40 while (1) {
41 g.acquire(I);
44 if (vpDisplay::getClick(I, false)) // A click to exit
45 break;
46 }
47 }
48 catch (const vpException &e) {
49 std::cout << "Catch an exception: " << e << std::endl;
50 }
51
52#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
53 if (display != nullptr) {
54 delete display;
55 }
56#endif
57#else
58 std::cout << "Install CMU1394 SDK, configure and build ViSP again to use this example" << std::endl;
59#endif
60}
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void setVideoMode(unsigned long format, unsigned long mode)
void acquire(vpImage< unsigned char > &I)
void setFramerate(unsigned long fps)
void open(vpImage< unsigned char > &I)
Class that defines generic functionalities for display.
Definition vpDisplay.h:171
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
error that can be emitted by ViSP classes.
Definition vpException.h:60
Definition of the vpImage class member functions.
Definition vpImage.h:131
std::shared_ptr< vpDisplay > createDisplay()
Return a smart pointer vpDisplay specialization if a GUI library is available or nullptr otherwise.
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.