Subversion Repositories seema-scanner

Rev

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

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