62 m_nCameras(nCameras), m_mode(mode), m_colorMode(colorMode), m_bayerPatternType(bayerPatternType)
70 m_ppOriginalImages[i] = 0;
71 m_ppInternalImages[i] = 0;
73 m_flyCaptureContext[i] = 0;
79 : m_mode(mode), m_colorMode(colorMode), m_bayerPatternType(bayerPatternType)
86 FlyCaptureError ret = ::flycaptureBusCameraCount(&nCameras);
87 if (ret != FLYCAPTURE_OK)
90 m_nCameras = (int) nCameras;
95 m_ppOriginalImages[i] = 0;
96 m_ppInternalImages[i] = 0;
97 m_flyCaptureContext[i] = 0;
153 for (
int i = 0; i < m_nCameras; i++)
155 ret = ::flycaptureCreateContext(&m_flyCaptureContext[i]);
156 if (ret != FLYCAPTURE_OK)
159 ret = ::flycaptureInitialize(m_flyCaptureContext[i], i);
160 if (ret != FLYCAPTURE_OK)
165 ret = ::flycaptureStartCustomImage(m_flyCaptureContext[i], 0, 4, 4, 640, 480, 100.0, FLYCAPTURE_MONO8);
167 ret = ::flycaptureStartCustomImage(m_flyCaptureContext[i], 0, 4, 4, 640, 480, 100.0, FLYCAPTURE_RAW8);
169 if (ret != FLYCAPTURE_OK)
172 m_ppInternalImages[i] =
new FlyCaptureImage();
174 if (m_colorMode ==
eRGB24)
188 for (
int i = 0; i < m_nCameras; i++)
190 if (m_flyCaptureContext[i])
193 ::flycaptureStop(m_flyCaptureContext[i]);
194 ::flycaptureDestroyContext(m_flyCaptureContext[i]);
195 m_flyCaptureContext[i] = 0;
200 delete m_ppImages[i];
204 if (m_ppInternalImages[i])
206 delete m_ppInternalImages[i];
207 m_ppInternalImages[i] = 0;
210 if (m_ppOriginalImages[i])
212 delete m_ppOriginalImages[i];
213 m_ppOriginalImages[i] = 0;
224 if (!m_flyCaptureContext)
228 for (i = 0; i < m_nCameras; i++)
230 ret = ::flycaptureGrabImage2(m_flyCaptureContext[i], m_ppInternalImages[i]);
231 if (ret != FLYCAPTURE_OK)
238 for (i = 0; i < m_nCameras; i++)
240 image_header.
pixels = m_ppInternalImages[i]->pData;
273 m_sec = m_ppInternalImages[0]->timeStamp.ulSeconds;
274 m_usec = m_ppInternalImages[0]->timeStamp.ulMicroSeconds;
288 if (m_flyCaptureContext[nCamera])
290 if (::flycaptureGetCameraInfo(m_flyCaptureContext[nCamera], &m_flyCaptureInfoEx) == FLYCAPTURE_OK)
291 return m_flyCaptureInfoEx.SerialNumber;
299 if (m_flyCaptureContext[nCamera1] && m_flyCaptureContext[nCamera2])
301 FlyCaptureContext fCC_tmp = m_flyCaptureContext[nCamera1];
302 m_flyCaptureContext[nCamera1] = m_flyCaptureContext[nCamera2];
303 m_flyCaptureContext[nCamera2] = fCC_tmp;
bool Resize(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI=0, bool bInterpolation=true)
Resizes a CByteImage and writes the result to a CByteImage.
void SwapCameras(int nCamera1, int nCamera2)
Swap the camera source.
bool CopyImage(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI=0, bool bUseSameSize=false)
Copies one CByteImage to another.
BayerPatternType
The four possible variants for Bayer pattern conversion.
ImageType
Enum specifying the supported image types.
void GetCurrentTimestamp(unsigned int &sec, unsigned int &usec)
bool CaptureImage(CByteImage **ppImages)
bool ConvertBayerPattern(const CByteImage *pInputImage, CByteImage *pOutputImage, BayerPatternType type)
Converts an 8 bit Bayer pattern CByteImage to an RGB24 color CByteImage.
#define DRAGONFLY_MAX_CAMERAS
unsigned int GetSerialFromCamera(int nCamera)
Get the serial number from the camera.
CDragonFlyCapture(int nCameras, VideoMode mode, ColorMode colorMode, ImageProcessor::BayerPatternType bayerPatternType)
unsigned char * pixels
The pointer to the the pixels.
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
CByteImage::ImageType GetType()