29 #include <Image/Camera.hh>
30 #include <VideoSource/VideoSource_Shm.hh>
33 # define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
36 # include <sys/types.h>
37 # include <sys/mman.h>
47 #include <Base/Common/BIASpragma.hh>
101 SYSTEM_INFO sSysInfo;
102 GetSystemInfo( &sSysInfo );
103 Granularity_ = sSysInfo.dwAllocationGranularity;
105 Granularity_ += sSysInfo.dwAllocationGranularity;
109 while ( Mapping_ == NULL ) {
110 Mapping_ = OpenFileMapping( FILE_MAP_ALL_ACCESS,FALSE,FileName_.c_str());
111 cout <<
"Wait for file mapping: "<<FileName_<<endl;
114 Shm_= (
unsigned char*)MapViewOfFile(Mapping_,FILE_MAP_ALL_ACCESS,0,0,0);
116 BIASERR(
"Failed to memory map file");
124 Context_ = shm_open(FileName_.c_str(),O_RDWR,
125 S_IRWXU| S_IRWXG| S_IRWXO);
128 cout <<
"Creating new context"<<endl;
129 Context_ = shm_open(FileName_.c_str(),O_RDWR| O_CREAT,
130 S_IRWXU| S_IRWXG| S_IRWXO);
134 perror(FileName_.c_str());
139 else cout <<
"Using old context"<<endl;
176 BIASERR(
"Could not write data to streambuffer!");
203 }
while ((!gotit)&&(
bSync_));
223 UnmapViewOfFile(
Shm_);
224 CloseHandle(Mapping_ );
241 cout<<
" to: "<<TotalLength_<<endl;
void Release()
reimplemented from ImageBase
int PreGrab()
Do last preparations before grabbing (e.g. start ISO transfer)
void Set(const T *pv)
copy the array of vectorsize beginning at *T to this->data_
Defines a common interface to different devices.
BIAS::ImageBase::EColorModel ColorMode_
Color mode used by camera.
void SetSize(int w, int h, int bytesperpixel)
Set image size and number of bytes per pixel (e.g.
float BytesPerPixel_
BytesPerPixel cannot be int (e.g. it is 1.5 for YUV420p)
void Set(const Vector3< ROTATION_MATRIX_TYPE > &w, const ROTATION_MATRIX_TYPE phi)
Set from rotation axis w and angle phi (in rad)
color values, 3 channels, order: red,green,blue
int GrabSingle(BIAS::Camera< unsigned char > &image)
void InvalidateUID()
sets the image's uid to invalid
void SetUID(const BIAS::UUID &id)
int PostGrab()
Stop anything started in PreGrab()
int OpenDevice()
selects the first available device to open (e.g.
unsigned int TotalLength_
std::stringstream * pImgBuffer_
static UUID GenerateUUID(const bool &consecutively=DEFAULT_UUID_CONSECUTIVELY)
static function which simply produces a uuid and returns