Go to the documentation of this file.00001 #ifndef __frame_grabber__
00002 #define __frame_grabber__ 1
00003
00004 #include <sys/mman.h>
00005 #include <sys/ioctl.h>
00006 #include <vcl_sys/types.h>
00007 #include <linux/videodev.h>
00008 #include <sys/stat.h>
00009 #include <fcntl.h>
00010 #include <sys/signal.h>
00011 #include <vcl_cstdlib.h>
00012 #include <vcl_iostream.h>
00013 #include <vil/vil_image_view.h>
00014 #include <unistd.h>
00015
00016
00017
00018
00019
00020 using namespace std;
00021
00022 class FrameGrabberVil
00023 {
00024 public:
00025 FrameGrabberVil(const string &device_name="/dev/video0",
00026 int width=320, int height=240);
00027 ~FrameGrabberVil();
00028 FrameGrabberVil(const FrameGrabberVil &cpy)
00029 { vcl_cerr << "Can't copy framegrabber\n"; vcl_exit(-1); }
00030 FrameGrabberVil &operator=(const FrameGrabberVil &cpy)
00031 { vcl_cerr << "Can't copy framegrabber\n"; vcl_exit(-1); return *this; }
00032 vil_image_view<vxl_byte> *grab_frame();
00033
00034 private:
00035 int fd;
00036 struct video_mmap mm;
00037 vil_image_view<vxl_byte> **frame;
00038 unsigned char *bigbuf;
00039 struct video_mbuf vm;
00040 };
00041
00042 #endif