Subversion Repositories seema-scanner

Rev

Rev 157 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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