Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleVideofeedShm.cpp

Example for a feeding a videosource to shared memory , VideoSource_DCAM, VideoShMFeeder

Author
MIP
/*
This file is part of the BIAS library (Basic ImageAlgorithmS).
Copyright (C) 2003-2009 (see file CONTACT for details)
Multimediale Systeme der Informationsverarbeitung
Institut fuer Informatik
Christian-Albrechts-Universitaet Kiel
BIAS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
BIAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BIAS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/** @example ExampleVideofeedShm.cpp
@relates VideoSource_Disk, VideoSource_DCAM, VideoShMFeeder
@ingroup g_examples
@ingroup g_videosource
@brief Example for a feeding a videosource to shared memory
@author MIP
*/
#include <Base/Common/W32Compat.hh> // sprintf wrn
#include <VideoSource/VideoSource_Disk.hh>
#include <VideoSource/VideoSource_Shm.hh>
#ifdef BIAS_HAVE_DCAM
# include <VideoSource/VideoSource_DCAM.hh>
#endif // BIAS_HAVE_DCAM
#include <Image/Camera.hh>
#include <iostream>
#include <VideoSource/VideoShMFeeder.hh>
using namespace std;
using namespace BIAS;
int main( int /*argc*/, char** /*argv*/)
{
std::vector<std::string> filenames;
filenames.push_back("pic.mip");
cam = new VideoSource_Disk();
//#ifdef BIAS_HAVE_DCAM
// cam = new VideoSource_DCAM();
//#endif // BIAS_HAVE_DCAM
char title[100];
sprintf(title,"Sending Picture");
cam->OpenDevice(filenames);
//cam->OpenDevice();
cam->InitImage(pic);
cam->PreGrab();
cam->GrabSingle(pic);
cout << "Image grab OK\n";
VideoShMFeeder ShMFeeder;
int i =0;
while(i<10000){
cam->GrabSingle(pic);
ShMFeeder.ProcessImage(&pic);
i++;
cout <<i<<endl;
}
cam->PostGrab();
cam->CloseDevice();
delete cam;
return 0;
}