Subversion Repositories seema-scanner

Rev

Rev 207 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 207 Rev 255
1
#include "CameraPointGrey.h"
1
#include "CameraPointGrey.h"
2
#include <cstring>
2
#include <cstring>
3
#include <assert.h>
3
#include <assert.h>
4
 
4
 
5
//#include <sys/ioctl.h>
5
//#include <sys/ioctl.h>
6
//#include <linux/usbdevice_fs.h>
6
//#include <linux/usbdevice_fs.h>
7
 
7
 
8
void PrintError(FlyCapture2::Error error){
8
void PrintError(FlyCapture2::Error error){
9
    //TODOassert(false);
9
    //TODOassert(false);
10
    error.PrintErrorTrace();
10
    error.PrintErrorTrace();
11
}
11
}
12
 
12
 
13
vector<CameraInfo> CameraPointGrey::getCameraList(){
13
vector<CameraInfo> CameraPointGrey::getCameraList(){
14
    
14
    
15
    FlyCapture2::Error error;
15
    FlyCapture2::Error error;
16
 
16
 
17
    FlyCapture2::BusManager busManager;
17
    FlyCapture2::BusManager busManager;
18
    unsigned int numCameras;
18
    unsigned int numCameras;
19
    error = busManager.GetNumOfCameras(&numCameras);
19
    error = busManager.GetNumOfCameras(&numCameras);
20
 
20
 
21
    vector<CameraInfo> ret;
21
    vector<CameraInfo> ret;
22
 
22
 
23
    if (error != FlyCapture2::PGRERROR_OK){
23
    if (error != FlyCapture2::PGRERROR_OK){
24
        PrintError(error);
24
        PrintError(error);
25
        return ret;
25
        return ret;
26
    }
26
    }
27
 
27
 
28
    for (unsigned int i=0; i < numCameras; i++){
28
    for (unsigned int i=0; i < numCameras; i++){
29
        FlyCapture2::PGRGuid guid;
29
        FlyCapture2::PGRGuid guid;
30
        error = busManager.GetCameraFromIndex(i, &guid);
30
        error = busManager.GetCameraFromIndex(i, &guid);
31
        if (error != FlyCapture2::PGRERROR_OK)
31
        if (error != FlyCapture2::PGRERROR_OK)
32
            PrintError(error);
32
            PrintError(error);
33
 
33
 
34
        // Connect to camera
34
        // Connect to camera
35
        FlyCapture2::Camera cam;
35
        FlyCapture2::Camera cam;
36
        error = cam.Connect(&guid);
36
        error = cam.Connect(&guid);
37
        if (error != FlyCapture2::PGRERROR_OK)
37
        if (error != FlyCapture2::PGRERROR_OK)
38
            PrintError( error );
38
            PrintError( error );
39
 
39
 
40
        // Get camera information
40
        // Get camera information
41
        FlyCapture2::CameraInfo camInfo;
41
        FlyCapture2::CameraInfo camInfo;
42
        error = cam.GetCameraInfo(&camInfo);
42
        error = cam.GetCameraInfo(&camInfo);
43
        if (error != FlyCapture2::PGRERROR_OK)
43
        if (error != FlyCapture2::PGRERROR_OK)
44
            PrintError( error );
44
            PrintError( error );
45
 
45
 
46
        CameraInfo camera;
46
        CameraInfo camera;
47
        camera.vendor = "Point Grey";
47
        camera.vendor = "Point Grey";
48
        camera.model = camInfo.modelName;
48
        camera.model = camInfo.modelName;
49
        camera.busID = camInfo.nodeNumber;
49
        camera.busID = camInfo.nodeNumber;
50
        camera.serialNumber = camInfo.serialNumber;
50
        camera.serialNumber = camInfo.serialNumber;
51
 
51
 
52
        ret.push_back(camera);
52
        ret.push_back(camera);
53
    }
53
    }
54
 
54
 
55
    return ret;
55
    return ret;
56
}
56
}
57
 
57
 
58
CameraPointGrey::CameraPointGrey(unsigned int camNum, CameraTriggerMode triggerMode) : Camera(triggerMode){
58
CameraPointGrey::CameraPointGrey(unsigned int camNum, CameraTriggerMode triggerMode) : Camera(triggerMode){
59
 
59
 
60
//    // Reset USB bus
60
//    // Reset USB bus
61
//    std::cout << "Resetting USB device %s\n";
61
//    std::cout << "Resetting USB device %s\n";
62
//    int rc = ioctl(fd, USBDEVFS_RESET, 0);
62
//    int rc = ioctl(fd, USBDEVFS_RESET, 0);
63
//    if (rc < 0)
63
//    if (rc < 0)
64
//        perror("Error in ioctl");
64
//        perror("Error in ioctl");
65
//    else
65
//    else
66
//        printf("Reset successful\n");
66
//        printf("Reset successful\n");
67
 
67
 
68
 
68
 
69
    FlyCapture2::Error error;
69
    FlyCapture2::Error error;
70
 
70
 
71
    // Connect to camera
71
    // Connect to camera
72
    FlyCapture2::BusManager busManager;
72
    FlyCapture2::BusManager busManager;
73
 
73
 
74
    FlyCapture2::PGRGuid camGuid;
74
    FlyCapture2::PGRGuid camGuid;
75
 
75
 
76
    busManager.GetCameraFromIndex(camNum, &camGuid);
76
    busManager.GetCameraFromIndex(camNum, &camGuid);
77
    error = cam.Connect(&camGuid);
77
    error = cam.Connect(&camGuid);
78
    if (error != FlyCapture2::PGRERROR_OK)
78
    if (error != FlyCapture2::PGRERROR_OK)
79
        PrintError(error);
79
        PrintError(error);
80
 
80
 
81
//    // Configure DCAM video mode and frame rate
81
//    // Configure DCAM video mode and frame rate
82
//    FlyCapture2::VideoMode videoMode = FlyCapture2::VIDEOMODE_1280x960Y8;
82
//    FlyCapture2::VideoMode videoMode = FlyCapture2::VIDEOMODE_1280x960Y8;
83
//    FlyCapture2::FrameRate frameRate = FlyCapture2::FRAMERATE_7_5;
83
//    FlyCapture2::FrameRate frameRate = FlyCapture2::FRAMERATE_7_5;
84
//    error = cam.SetVideoModeAndFrameRate(videoMode, frameRate);
84
//    error = cam.SetVideoModeAndFrameRate(videoMode, frameRate);
85
//    if (error != FlyCapture2::PGRERROR_OK)
85
//    if (error != FlyCapture2::PGRERROR_OK)
86
//        PrintError(error);
86
//        PrintError(error);
87
 
87
 
88
    // Configure Format7 mode
88
    // Configure Format7 mode
89
    FlyCapture2::Format7ImageSettings format7Settings;
89
    FlyCapture2::Format7ImageSettings format7Settings;
90
    format7Settings.mode = FlyCapture2::MODE_0;
90
    format7Settings.mode = FlyCapture2::MODE_0;
91
    format7Settings.pixelFormat = FlyCapture2::PIXEL_FORMAT_RAW8;
91
    format7Settings.pixelFormat = FlyCapture2::PIXEL_FORMAT_RAW8;
92
    format7Settings.width = 3376;
92
    format7Settings.width = 3376;
93
    format7Settings.height = 2704;
93
    format7Settings.height = 2704;
94
    format7Settings.offsetX = 0;
94
    format7Settings.offsetX = 0;
95
    format7Settings.offsetY = 0;
95
    format7Settings.offsetY = 0;
96
 
96
 
97
//    format7Settings.width = 2496;
97
//    format7Settings.width = 2496;
98
//    format7Settings.height = 1888;
98
//    format7Settings.height = 1888;
99
//    format7Settings.offsetX = (3376-2496)/2;
99
//    format7Settings.offsetX = (3376-2496)/2;
100
//    format7Settings.offsetY = (2704-1888)/2;
100
//    format7Settings.offsetY = (2704-1888)/2;
101
 
101
 
102
    // Validate and set mode
102
    // Validate and set mode
103
    FlyCapture2::Format7PacketInfo packetInfo;
103
    FlyCapture2::Format7PacketInfo packetInfo;
104
    bool valid;
104
    bool valid;
105
    error = cam.ValidateFormat7Settings(&format7Settings, &valid, &packetInfo);
105
    error = cam.ValidateFormat7Settings(&format7Settings, &valid, &packetInfo);
106
    if (error != FlyCapture2::PGRERROR_OK)
106
    if (error != FlyCapture2::PGRERROR_OK)
107
        PrintError(error);
107
        PrintError(error);
108
    // packetsize configures maximum frame rate
108
    // packetsize configures maximum frame rate
109
    error = cam.SetFormat7Configuration(&format7Settings, packetInfo.recommendedBytesPerPacket);
109
    error = cam.SetFormat7Configuration(&format7Settings, packetInfo.recommendedBytesPerPacket);
110
    if (error != FlyCapture2::PGRERROR_OK)
110
    if (error != FlyCapture2::PGRERROR_OK)
111
        PrintError(error);
111
        PrintError(error);
112
 
112
 
113
    // Configure general
113
    // Configure general
114
    FlyCapture2::FC2Config config;
114
    FlyCapture2::FC2Config config;
115
    config.numBuffers = 5;
115
    config.numBuffers = 5;
116
    config.grabTimeout = 1000; // retrieveBuffer() timeout in ms
116
    config.grabTimeout = 5000; // retrieveBuffer() timeout in ms
117
    config.grabMode = FlyCapture2::DROP_FRAMES;
117
    config.grabMode = FlyCapture2::DROP_FRAMES;
118
    config.isochBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
118
    config.isochBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
119
    config.highPerformanceRetrieveBuffer = true;
119
    config.highPerformanceRetrieveBuffer = true;
120
    //config.asyncBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
120
    //config.asyncBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
121
    error = cam.SetConfiguration(&config);
121
    error = cam.SetConfiguration(&config);
122
    if (error != FlyCapture2::PGRERROR_OK)
122
    if (error != FlyCapture2::PGRERROR_OK)
123
        PrintError(error);
123
        PrintError(error);
124
 
124
 
125
 
125
 
126
    // Get the camera information
126
    // Get the camera information
127
    FlyCapture2::CameraInfo camInfo;
127
    FlyCapture2::CameraInfo camInfo;
128
    error = cam.GetCameraInfo(&camInfo);
128
    error = cam.GetCameraInfo(&camInfo);
129
    if (error != FlyCapture2::PGRERROR_OK)
129
    if (error != FlyCapture2::PGRERROR_OK)
130
        PrintError(error);
130
        PrintError(error);
131
 
131
 
132
    std::cout << camInfo.vendorName << "  " << camInfo.modelName << "  " << camInfo.serialNumber << std::endl;
132
    std::cout << camInfo.vendorName << "  " << camInfo.modelName << "  " << camInfo.serialNumber << std::endl;
133
 
133
 
134
    // Turn off auto settings
134
    // Turn off auto settings
135
    FlyCapture2::Property property;
135
    FlyCapture2::Property property;
136
    property.type = FlyCapture2::AUTO_EXPOSURE;
136
    property.type = FlyCapture2::AUTO_EXPOSURE;
137
    property.onOff = false;
137
    property.onOff = false;
138
    error = cam.SetProperty(&property);
138
    error = cam.SetProperty(&property);
139
    if (error != FlyCapture2::PGRERROR_OK)
139
    if (error != FlyCapture2::PGRERROR_OK)
140
        PrintError(error);
140
        PrintError(error);
141
 
141
 
142
    property.type = FlyCapture2::GAMMA;
142
    property.type = FlyCapture2::GAMMA;
143
    property.onOff = true;
143
    property.onOff = true;
144
    property.absControl = true;
144
    property.absControl = true;
145
    property.absValue = 1.0;
145
    property.absValue = 1.0;
146
    error = cam.SetProperty(&property);
146
    error = cam.SetProperty(&property);
147
    if (error != FlyCapture2::PGRERROR_OK)
147
    if (error != FlyCapture2::PGRERROR_OK)
148
        PrintError(error);
148
        PrintError(error);
149
 
149
 
150
    // Set frame rate to 6
150
    // Set frame rate to 6
151
    property.type = FlyCapture2::FRAME_RATE;
151
    property.type = FlyCapture2::FRAME_RATE;
152
    property.onOff = true;
152
    property.onOff = true;
153
    property.absControl = true;
153
    property.absControl = true;
154
    property.autoManualMode = false;
154
    property.autoManualMode = false;
155
    property.absValue = 6.0;
155
    property.absValue = 6.0;
156
    error = cam.SetProperty(&property);
156
    error = cam.SetProperty(&property);
157
    if (error != FlyCapture2::PGRERROR_OK)
157
    if (error != FlyCapture2::PGRERROR_OK)
158
        PrintError(error);
158
        PrintError(error);
159
 
159
 
160
    // Set white balance to match LED projector light
160
    // Set white balance to match LED projector light
161
    property.type = FlyCapture2::WHITE_BALANCE;
161
    property.type = FlyCapture2::WHITE_BALANCE;
162
    property.onOff = true;
162
    property.onOff = true;
163
    property.absControl = false;
163
    property.absControl = false;
164
    property.autoManualMode = false;
164
    property.autoManualMode = false;
165
    property.valueA = 666; //red
165
    property.valueA = 666; //red
166
    property.valueB = 777; //blue
166
    property.valueB = 777; //blue
167
    error = cam.SetProperty(&property);
167
    error = cam.SetProperty(&property);
168
    if (error != FlyCapture2::PGRERROR_OK)
168
    if (error != FlyCapture2::PGRERROR_OK)
169
        PrintError(error);
169
        PrintError(error);
170
 
170
 
171
    // Set reasonable default settings
171
    // Set reasonable default settings
172
    CameraSettings settings;
172
    CameraSettings settings;
173
    //settings.shutter = 8.33;
173
    //settings.shutter = 8.33;
174
    settings.shutter = 66.66;
174
    settings.shutter = 66.66;
175
    settings.gain = 0.0;
175
    settings.gain = 0.0;
176
    this->setCameraSettings(settings);
176
    this->setCameraSettings(settings);
177
 
177
 
178
    return;
178
    return;
179
}
179
}
180
 
180
 
181
CameraSettings CameraPointGrey::getCameraSettings(){
181
CameraSettings CameraPointGrey::getCameraSettings(){
182
 
182
 
183
    FlyCapture2::Property property;
183
    FlyCapture2::Property property;
184
 
184
 
185
    // Get settings:
185
    // Get settings:
186
    CameraSettings settings;
186
    CameraSettings settings;
187
 
187
 
188
    property.type = FlyCapture2::SHUTTER;
188
    property.type = FlyCapture2::SHUTTER;
189
    cam.GetProperty(&property);
189
    cam.GetProperty(&property);
190
    settings.shutter = property.absValue;
190
    settings.shutter = property.absValue;
191
 
191
 
192
    property.type = FlyCapture2::GAIN;
192
    property.type = FlyCapture2::GAIN;
193
    cam.GetProperty(&property);
193
    cam.GetProperty(&property);
194
    settings.gain = property.absValue;
194
    settings.gain = property.absValue;
195
 
195
 
196
    return settings;
196
    return settings;
197
}
197
}
198
 
198
 
199
void CameraPointGrey::setCameraSettings(CameraSettings settings){
199
void CameraPointGrey::setCameraSettings(CameraSettings settings){
200
 
200
 
201
    FlyCapture2::Property property;
201
    FlyCapture2::Property property;
202
    property.onOff = true;
202
    property.onOff = true;
203
    property.absControl = true;
203
    property.absControl = true;
204
 
204
 
205
    property.type = FlyCapture2::SHUTTER;
205
    property.type = FlyCapture2::SHUTTER;
206
    property.absValue = settings.shutter;
206
    property.absValue = settings.shutter;
207
    cam.SetProperty(&property);
207
    cam.SetProperty(&property);
208
 
208
 
209
    property.type = FlyCapture2::GAIN;
209
    property.type = FlyCapture2::GAIN;
210
    property.absValue = settings.gain;
210
    property.absValue = settings.gain;
211
    cam.SetProperty(&property);
211
    cam.SetProperty(&property);
212
 
212
 
213
}
213
}
214
 
214
 
215
void CameraPointGrey::startCapture(){
215
void CameraPointGrey::startCapture(){
216
 
216
 
217
    FlyCapture2::Error error;
217
    FlyCapture2::Error error;
218
 
218
 
219
    if(triggerMode == triggerModeHardware){
219
    if(triggerMode == triggerModeHardware){
220
        // Configure for hardware trigger
220
        // Configure for hardware trigger
221
        FlyCapture2::TriggerMode triggerMode;
221
        FlyCapture2::TriggerMode triggerMode;
222
        triggerMode.onOff = true;
222
        triggerMode.onOff = true;
223
        triggerMode.polarity = 0;
223
        triggerMode.polarity = 0;
224
        triggerMode.source = 0;
224
        triggerMode.source = 0;
225
        triggerMode.mode = 14;
225
        triggerMode.mode = 14;
226
        error = cam.SetTriggerMode(&triggerMode);
226
        error = cam.SetTriggerMode(&triggerMode);
227
        if (error != FlyCapture2::PGRERROR_OK)
227
        if (error != FlyCapture2::PGRERROR_OK)
228
            PrintError(error);
228
            PrintError(error);
229
 
229
 
230
    } else if(triggerMode == triggerModeSoftware){
230
    } else if(triggerMode == triggerModeSoftware){
231
        // Configure software trigger
231
        // Configure software trigger
232
        FlyCapture2::TriggerMode triggerMode;
232
        FlyCapture2::TriggerMode triggerMode;
233
        triggerMode.onOff = true;
233
        triggerMode.onOff = true;
234
        triggerMode.polarity = 0;
234
        triggerMode.polarity = 0;
235
        triggerMode.source = 7; // software
235
        triggerMode.source = 7; // software
236
        triggerMode.mode = 0;
236
        triggerMode.mode = 0;
237
        error = cam.SetTriggerMode(&triggerMode);
237
        error = cam.SetTriggerMode(&triggerMode);
238
        if (error != FlyCapture2::PGRERROR_OK)
238
        if (error != FlyCapture2::PGRERROR_OK)
239
            PrintError(error);
239
            PrintError(error);
240
    }
240
    }
241
 
241
 
242
    // Set the trigger timeout to 1000 ms
242
    // Set the trigger timeout to 1000 ms
243
    FlyCapture2::FC2Config config;
243
    FlyCapture2::FC2Config config;
244
    config.grabTimeout = 1000;
244
    config.grabTimeout = 5000;
245
    error = cam.SetConfiguration(&config);
245
    error = cam.SetConfiguration(&config);
246
    if (error != FlyCapture2::PGRERROR_OK)
246
    if (error != FlyCapture2::PGRERROR_OK)
247
        PrintError(error);
247
        PrintError(error);
248
 
248
 
249
    // TODO this segfaults if another instance is running
249
    // TODO this segfaults if another instance is running
250
    if(!capturing)
250
    if(!capturing)
251
        error = cam.StartCapture();
251
        error = cam.StartCapture();
252
    if (error != FlyCapture2::PGRERROR_OK)
252
    if (error != FlyCapture2::PGRERROR_OK)
253
        PrintError(error);
253
        PrintError(error);
254
 
254
 
255
    capturing = true;
255
    capturing = true;
256
}
256
}
257
 
257
 
258
void CameraPointGrey::stopCapture(){
258
void CameraPointGrey::stopCapture(){
259
 
259
 
260
    FlyCapture2::Error error = cam.StopCapture();
260
    FlyCapture2::Error error = cam.StopCapture();
261
    if (error != FlyCapture2::PGRERROR_OK)
261
    if (error != FlyCapture2::PGRERROR_OK)
262
        PrintError(error);
262
        PrintError(error);
263
 
263
 
264
    capturing = false;
264
    capturing = false;
265
}
265
}
266
 
266
 
267
void CameraPointGrey::trigger(){
267
void CameraPointGrey::trigger(){
268
 
268
 
269
    FlyCapture2::Error error;
269
    FlyCapture2::Error error;
270
 
270
 
271
    // Fire software trigger
271
    // Fire software trigger
272
    // broadcasting not supported on some platforms
272
    // broadcasting not supported on some platforms
273
    error = cam.FireSoftwareTrigger(false);
273
    error = cam.FireSoftwareTrigger(false);
274
 
274
 
275
    if (error != FlyCapture2::PGRERROR_OK)
275
    if (error != FlyCapture2::PGRERROR_OK)
276
        PrintError(error);
276
        PrintError(error);
277
 
277
 
278
}
278
}
279
 
279
 
280
CameraFrame CameraPointGrey::getFrame(){
280
CameraFrame CameraPointGrey::getFrame(){
281
 
281
 
282
    FlyCapture2::Error error;
282
    FlyCapture2::Error error;
283
 
283
 
284
    // Retrieve the image
284
    // Retrieve the image
285
    FlyCapture2::Image rawImage;
285
    FlyCapture2::Image rawImage;
286
    error = cam.RetrieveBuffer(&rawImage);
286
    error = cam.RetrieveBuffer(&rawImage);
287
    if (error != FlyCapture2::PGRERROR_OK)
287
    if (error != FlyCapture2::PGRERROR_OK)
288
        PrintError(error);
288
        PrintError(error);
289
 
289
 
290
//    rawImage.SetColorProcessing(FlyCapture2::IPP);
290
//    rawImage.SetColorProcessing(FlyCapture2::IPP);
291
 
291
 
292
//    // de-Bayer
292
//    // de-Bayer
293
//    rawImage.Convert(FlyCapture2::PIXEL_FORMAT_RGB8, &currentImage);
293
//    rawImage.Convert(FlyCapture2::PIXEL_FORMAT_RGB8, &currentImage);
294
 
294
 
295
//    CameraFrame frame;
295
//    CameraFrame frame;
296
 
296
 
297
//    frame.timeStamp = currentImage.GetTimeStamp().cycleCount;
297
//    frame.timeStamp = currentImage.GetTimeStamp().cycleCount;
298
//    frame.height = currentImage.GetRows();
298
//    frame.height = currentImage.GetRows();
299
//    frame.width = currentImage.GetCols();
299
//    frame.width = currentImage.GetCols();
300
//    frame.bitDepth = 8;
300
//    frame.bitDepth = 8;
301
//    frame.channels = 3;
301
//    frame.channels = 3;
302
//    frame.memory = (unsigned short*)currentImage.GetData();
302
//    frame.memory = (unsigned short*)currentImage.GetData();
303
 
303
 
304
    CameraFrame frame;
304
    CameraFrame frame;
305
 
305
 
306
    frame.timeStamp = rawImage.GetTimeStamp().cycleCount;
306
    frame.timeStamp = rawImage.GetTimeStamp().cycleCount;
307
    frame.height = rawImage.GetRows();
307
    frame.height = rawImage.GetRows();
308
    frame.width = rawImage.GetCols();
308
    frame.width = rawImage.GetCols();
309
    frame.bitDepth = 8;
309
    frame.bitDepth = 8;
310
    frame.channels = 1;
310
    frame.channels = 1;
311
    frame.memory = rawImage.GetData();
311
    frame.memory = rawImage.GetData();
312
 
312
 
313
    return frame;
313
    return frame;
314
}
314
}
315
 
315
 
316
 
316
 
317
size_t CameraPointGrey::getFrameSizeBytes(){
317
size_t CameraPointGrey::getFrameSizeBytes(){
318
    
318
    
319
    FlyCapture2::Format7ImageSettings format7Settings;
319
    FlyCapture2::Format7ImageSettings format7Settings;
320
    cam.GetFormat7Configuration(&format7Settings, NULL, NULL);
320
    cam.GetFormat7Configuration(&format7Settings, NULL, NULL);
321
 
321
 
322
    return format7Settings.height*format7Settings.width*3*2;
322
    return format7Settings.height*format7Settings.width*3*2;
323
}
323
}
324
 
324
 
325
size_t CameraPointGrey::getFrameWidth(){
325
size_t CameraPointGrey::getFrameWidth(){
326
 
326
 
327
    FlyCapture2::Format7ImageSettings format7Settings;
327
    FlyCapture2::Format7ImageSettings format7Settings;
328
    unsigned int dummy1;
328
    unsigned int dummy1;
329
    float dummy2;
329
    float dummy2;
330
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
330
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
331
    if (error != FlyCapture2::PGRERROR_OK)
331
    if (error != FlyCapture2::PGRERROR_OK)
332
        PrintError(error);
332
        PrintError(error);
333
 
333
 
334
    return format7Settings.width;
334
    return format7Settings.width;
335
}
335
}
336
 
336
 
337
size_t CameraPointGrey::getFrameHeight(){
337
size_t CameraPointGrey::getFrameHeight(){
338
 
338
 
339
    FlyCapture2::Format7ImageSettings format7Settings;
339
    FlyCapture2::Format7ImageSettings format7Settings;
340
    unsigned int dummy1;
340
    unsigned int dummy1;
341
    float dummy2;
341
    float dummy2;
342
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
342
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
343
    if (error != FlyCapture2::PGRERROR_OK)
343
    if (error != FlyCapture2::PGRERROR_OK)
344
        PrintError(error);
344
        PrintError(error);
345
 
345
 
346
    return format7Settings.height;
346
    return format7Settings.height;
347
 
347
 
348
 
348
 
349
}
349
}
350
 
350
 
351
 
351
 
352
CameraPointGrey::~CameraPointGrey(){
352
CameraPointGrey::~CameraPointGrey(){
353
 
353
 
354
    if(capturing){
354
    if(capturing){
355
        // Stop camera transmission
355
        // Stop camera transmission
356
        stopCapture();
356
        stopCapture();
357
    }
357
    }
358
 
358
 
359
    // Gracefulle destruct the camera
359
    // Gracefulle destruct the camera
360
    cam.Disconnect();
360
    cam.Disconnect();
361
 
361
 
362
    std::cout << "Closed camera!" << std::endl << std::flush;
362
    std::cout << "Closed camera!" << std::endl << std::flush;
363
}
363
}
364
 
364
 
365
 
365
 
366
 
366
 
367
 
367