25 #include <../../FlyCapture2/include/Camera.h> 26 #include <../../FlyCapture2/include/Image.h> 27 #include <../../FlyCapture2/include/Error.h> 28 #include <../../FlyCapture2/include/BusManager.h> 60 id.setf(ios_base::hex, ios_base::basefield);
61 id >>
mGUID.value[0];
id.get();
62 id >>
mGUID.value[1];
id.get();
63 id >>
mGUID.value[2];
id.get();
66 if (
mCamera->Connect(&
mGUID) != FlyCapture2::PGRERROR_OK) {
70 FlyCapture2::VideoMode videoMode;
71 FlyCapture2::FrameRate frameRate;
72 if (
mCamera->GetVideoModeAndFrameRate (&videoMode, &frameRate) != FlyCapture2::PGRERROR_OK) {
76 if (videoMode == FlyCapture2::VIDEOMODE_640x480RGB) {
81 }
else if (videoMode == FlyCapture2::VIDEOMODE_640x480Y8) {
86 }
else if (videoMode == FlyCapture2::VIDEOMODE_800x600RGB) {
91 }
else if (videoMode == FlyCapture2::VIDEOMODE_800x600Y8) {
96 }
else if (videoMode == FlyCapture2::VIDEOMODE_1024x768RGB) {
101 }
else if (videoMode == FlyCapture2::VIDEOMODE_1024x768Y8) {
106 }
else if (videoMode == FlyCapture2::VIDEOMODE_1280x960RGB) {
111 }
else if (videoMode == FlyCapture2::VIDEOMODE_1280x960Y8) {
116 }
else if (videoMode == FlyCapture2::VIDEOMODE_1600x1200RGB) {
121 }
else if (videoMode == FlyCapture2::VIDEOMODE_1600x1200Y8) {
131 if (
mCamera->StartCapture() != FlyCapture2::PGRERROR_OK) {
152 if (
mCamera->RetrieveBuffer(
mImage) == FlyCapture2::PGRERROR_OK) {
166 return "CapturePtgrey";
187 FlyCapture2::BusManager bus;
188 if (bus.RescanBus() != FlyCapture2::PGRERROR_OK) {
192 unsigned int numberCameras = 0;
193 bus.GetNumOfCameras(&numberCameras);
195 for (
unsigned int i = 0; i < numberCameras; i++) {
196 FlyCapture2::PGRGuid guid;
197 bus.GetCameraFromIndex(i, &guid);
199 convert << hex << guid.value[0];
200 convert <<
"_" << hex << guid.value[1];
201 convert <<
"_" << hex << guid.value[2];
202 convert <<
"_" << hex << guid.value[3];
203 stringstream description;
204 FlyCapture2::Camera
camera;
205 if (camera.Connect(&guid) != FlyCapture2::PGRERROR_OK)
continue;
206 FlyCapture2::CameraInfo info;
207 if (camera.GetCameraInfo (&info) != FlyCapture2::PGRERROR_OK)
continue;
208 description << info.vendorName <<
" ";
209 description << info.modelName;
211 devices.push_back(captureDevice);
~CapturePluginPtgrey()
Destructor.
std::string SerializeId()
The identification of the class for serialization.
Implementation of Capture interface for Ptgrey plugin.
void stop()
Stops the camera capture.
bool Serialize(Serialization *serialization)
Performs serialization of the class members and configuration.
IplImage * captureImage()
Capture one image from the camera.
FlyCapture2::Image * mImage
CapturePluginPtgrey(const std::string &captureType)
Constructor.
CaptureDevice captureDevice()
The camera information associated to this capture object.
CaptureDeviceVector enumerateDevices()
Enumerate capture devices currently available.
unsigned long mXResolution
~CapturePtgrey()
Destructor.
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camer...
CaptureDevice holder for camera information.
bool start()
Starts the camera capture.
void registerPlugin(const std::string &captureType, alvar::CapturePlugin *&capturePlugin)
CapturePlugin interface that plugins must implement.
bool showSettingsDialog()
Show the settings dialog of the camera.
Capture * createCapture(const CaptureDevice captureDevice)
Create Capture class. Transfers onwership to the caller.
bool isCapturing()
Test if the camera was properly initialized.
This file implements a capture plugin based on Ptgrey.
FlyCapture2::Camera * mCamera
FlyCapture2::PGRGuid mGUID
Capture interface that plugins must implement.
void convert(const A &a, B &b)
Class for serializing class content to/from file or std::iostream.
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
std::vector< CaptureDevice > CaptureDeviceVector
Vector of CaptureDevices.
unsigned long mYResolution