Subversion Repositories seema-scanner

Rev

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

Rev 128 Rev 134
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;
-
 
96
//    format7Settings.height = 1888;
-
 
97
//    format7Settings.offsetX = (3376-2496)/2;
-
 
98
//    format7Settings.offsetY = (2704-1888)/2;
-
 
99
 
95
    // Validate and set mode
100
    // Validate and set mode
96
    FlyCapture2::Format7PacketInfo packetInfo;
101
    FlyCapture2::Format7PacketInfo packetInfo;
97
    bool valid;
102
    bool valid;
98
    error = cam.ValidateFormat7Settings(&format7Settings, &valid, &packetInfo);
103
    error = cam.ValidateFormat7Settings(&format7Settings, &valid, &packetInfo);
99
    if (error != FlyCapture2::PGRERROR_OK)
104
    if (error != FlyCapture2::PGRERROR_OK)
100
        PrintError(error);
105
        PrintError(error);
101
    // packetsize configures maximum frame rate
106
    // packetsize configures maximum frame rate
102
    error = cam.SetFormat7Configuration(&format7Settings, packetInfo.recommendedBytesPerPacket);
107
    error = cam.SetFormat7Configuration(&format7Settings, packetInfo.recommendedBytesPerPacket);
103
    if (error != FlyCapture2::PGRERROR_OK)
108
    if (error != FlyCapture2::PGRERROR_OK)
104
        PrintError(error);
109
        PrintError(error);
105
 
110
 
106
    // Configure general
111
    // Configure general
107
    FlyCapture2::FC2Config config;
112
    FlyCapture2::FC2Config config;
108
    config.numBuffers = 5;
113
    config.numBuffers = 5;
109
    config.grabTimeout = 1000; // retrieveBuffer() timeout in ms
114
    config.grabTimeout = 1000; // retrieveBuffer() timeout in ms
110
    config.grabMode = FlyCapture2::DROP_FRAMES;
115
    config.grabMode = FlyCapture2::DROP_FRAMES;
111
    config.isochBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
116
    config.isochBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
112
    config.highPerformanceRetrieveBuffer = true;
117
    config.highPerformanceRetrieveBuffer = true;
113
    //config.asyncBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
118
    //config.asyncBusSpeed = FlyCapture2::BUSSPEED_S_FASTEST;
114
    error = cam.SetConfiguration(&config);
119
    error = cam.SetConfiguration(&config);
115
    if (error != FlyCapture2::PGRERROR_OK)
120
    if (error != FlyCapture2::PGRERROR_OK)
116
        PrintError(error);
121
        PrintError(error);
117
 
122
 
118
 
123
 
119
    // Get the camera information
124
    // Get the camera information
120
    FlyCapture2::CameraInfo camInfo;
125
    FlyCapture2::CameraInfo camInfo;
121
    error = cam.GetCameraInfo(&camInfo);
126
    error = cam.GetCameraInfo(&camInfo);
122
    if (error != FlyCapture2::PGRERROR_OK)
127
    if (error != FlyCapture2::PGRERROR_OK)
123
        PrintError(error);
128
        PrintError(error);
124
 
129
 
125
    std::cout << camInfo.vendorName << "  " << camInfo.modelName << "  " << camInfo.serialNumber << std::endl;
130
    std::cout << camInfo.vendorName << "  " << camInfo.modelName << "  " << camInfo.serialNumber << std::endl;
126
 
131
 
127
    // Turn off auto settings
132
    // Turn off auto settings
128
    FlyCapture2::Property property;
133
    FlyCapture2::Property property;
129
    property.type = FlyCapture2::AUTO_EXPOSURE;
134
    property.type = FlyCapture2::AUTO_EXPOSURE;
130
    property.onOff = false;
135
    property.onOff = false;
131
    error = cam.SetProperty(&property);
136
    error = cam.SetProperty(&property);
132
    if (error != FlyCapture2::PGRERROR_OK)
137
    if (error != FlyCapture2::PGRERROR_OK)
133
        PrintError(error);
138
        PrintError(error);
134
 
139
 
135
    property.type = FlyCapture2::GAMMA;
140
    property.type = FlyCapture2::GAMMA;
136
    property.onOff = true;
141
    property.onOff = true;
137
    property.absControl = true;
142
    property.absControl = true;
138
    property.absValue = 1.0;
143
    property.absValue = 1.0;
139
    error = cam.SetProperty(&property);
144
    error = cam.SetProperty(&property);
140
    if (error != FlyCapture2::PGRERROR_OK)
145
    if (error != FlyCapture2::PGRERROR_OK)
141
        PrintError(error);
146
        PrintError(error);
142
 
147
 
143
    // Set frame rate to 6
148
    // Set frame rate to 6
144
    property.type = FlyCapture2::FRAME_RATE;
149
    property.type = FlyCapture2::FRAME_RATE;
145
    property.onOff = true;
150
    property.onOff = true;
146
    property.absControl = true;
151
    property.absControl = true;
147
    property.autoManualMode = false;
152
    property.autoManualMode = false;
148
    property.absValue = 6.0;
153
    property.absValue = 6.0;
149
    error = cam.SetProperty(&property);
154
    error = cam.SetProperty(&property);
150
    if (error != FlyCapture2::PGRERROR_OK)
155
    if (error != FlyCapture2::PGRERROR_OK)
151
        PrintError(error);
156
        PrintError(error);
152
 
157
 
153
    // Set white balance to match LED projector light
158
    // Set white balance to match LED projector light
154
    property.type = FlyCapture2::WHITE_BALANCE;
159
    property.type = FlyCapture2::WHITE_BALANCE;
155
    property.onOff = true;
160
    property.onOff = true;
156
    property.absControl = false;
161
    property.absControl = false;
157
    property.autoManualMode = false;
162
    property.autoManualMode = false;
158
    property.valueA = 666; //red
163
    property.valueA = 666; //red
159
    property.valueB = 777; //blue
164
    property.valueB = 777; //blue
160
    error = cam.SetProperty(&property);
165
    error = cam.SetProperty(&property);
161
    if (error != FlyCapture2::PGRERROR_OK)
166
    if (error != FlyCapture2::PGRERROR_OK)
162
        PrintError(error);
167
        PrintError(error);
163
 
168
 
164
    // Set reasonable default settings
169
    // Set reasonable default settings
165
    CameraSettings settings;
170
    CameraSettings settings;
166
    //settings.shutter = 8.33;
171
    //settings.shutter = 8.33;
167
    settings.shutter = 66.66;
172
    settings.shutter = 66.66;
168
    settings.gain = 0.0;
173
    settings.gain = 0.0;
169
    this->setCameraSettings(settings);
174
    this->setCameraSettings(settings);
170
 
175
 
171
    return;
176
    return;
172
}
177
}
173
 
178
 
174
CameraSettings CameraPointGrey::getCameraSettings(){
179
CameraSettings CameraPointGrey::getCameraSettings(){
175
 
180
 
176
    FlyCapture2::Property property;
181
    FlyCapture2::Property property;
177
 
182
 
178
    // Get settings:
183
    // Get settings:
179
    CameraSettings settings;
184
    CameraSettings settings;
180
 
185
 
181
    property.type = FlyCapture2::SHUTTER;
186
    property.type = FlyCapture2::SHUTTER;
182
    cam.GetProperty(&property);
187
    cam.GetProperty(&property);
183
    settings.shutter = property.absValue;
188
    settings.shutter = property.absValue;
184
 
189
 
185
    property.type = FlyCapture2::GAIN;
190
    property.type = FlyCapture2::GAIN;
186
    cam.GetProperty(&property);
191
    cam.GetProperty(&property);
187
    settings.gain = property.absValue;
192
    settings.gain = property.absValue;
188
 
193
 
189
    return settings;
194
    return settings;
190
}
195
}
191
 
196
 
192
void CameraPointGrey::setCameraSettings(CameraSettings settings){
197
void CameraPointGrey::setCameraSettings(CameraSettings settings){
193
 
198
 
194
    FlyCapture2::Property property;
199
    FlyCapture2::Property property;
195
    property.onOff = true;
200
    property.onOff = true;
196
    property.absControl = true;
201
    property.absControl = true;
197
 
202
 
198
    property.type = FlyCapture2::SHUTTER;
203
    property.type = FlyCapture2::SHUTTER;
199
    property.absValue = settings.shutter;
204
    property.absValue = settings.shutter;
200
    cam.SetProperty(&property);
205
    cam.SetProperty(&property);
201
 
206
 
202
    property.type = FlyCapture2::GAIN;
207
    property.type = FlyCapture2::GAIN;
203
    property.absValue = settings.gain;
208
    property.absValue = settings.gain;
204
    cam.SetProperty(&property);
209
    cam.SetProperty(&property);
205
 
210
 
206
}
211
}
207
 
212
 
208
void CameraPointGrey::startCapture(){
213
void CameraPointGrey::startCapture(){
209
 
214
 
210
    FlyCapture2::Error error;
215
    FlyCapture2::Error error;
211
 
216
 
212
    CameraSettings settings = this->getCameraSettings();
217
    CameraSettings settings = this->getCameraSettings();
213
    std::cout << "\tShutter: " << settings.shutter << "ms" << std::endl;
218
    std::cout << "\tShutter: " << settings.shutter << "ms" << std::endl;
214
    std::cout << "\tGain: " << settings.gain << "dB" << std::endl;
219
    std::cout << "\tGain: " << settings.gain << "dB" << std::endl;
215
 
220
 
216
    if(triggerMode == triggerModeHardware){
221
    if(triggerMode == triggerModeHardware){
217
        // Configure for hardware trigger
222
        // Configure for hardware trigger
218
        FlyCapture2::TriggerMode triggerMode;
223
        FlyCapture2::TriggerMode triggerMode;
219
        triggerMode.onOff = true;
224
        triggerMode.onOff = true;
220
        triggerMode.polarity = 0;
225
        triggerMode.polarity = 0;
221
        triggerMode.source = 0;
226
        triggerMode.source = 0;
222
        triggerMode.mode = 14;
227
        triggerMode.mode = 14;
223
        error = cam.SetTriggerMode(&triggerMode);
228
        error = cam.SetTriggerMode(&triggerMode);
224
        if (error != FlyCapture2::PGRERROR_OK)
229
        if (error != FlyCapture2::PGRERROR_OK)
225
            PrintError(error);
230
            PrintError(error);
226
 
231
 
227
    } else if(triggerMode == triggerModeSoftware){
232
    } else if(triggerMode == triggerModeSoftware){
228
        // Configure software trigger
233
        // Configure software trigger
229
        FlyCapture2::TriggerMode triggerMode;
234
        FlyCapture2::TriggerMode triggerMode;
230
        triggerMode.onOff = true;
235
        triggerMode.onOff = true;
231
        triggerMode.polarity = 0;
236
        triggerMode.polarity = 0;
232
        triggerMode.source = 7; // software
237
        triggerMode.source = 7; // software
233
        triggerMode.mode = 0;
238
        triggerMode.mode = 0;
234
        error = cam.SetTriggerMode(&triggerMode);
239
        error = cam.SetTriggerMode(&triggerMode);
235
        if (error != FlyCapture2::PGRERROR_OK)
240
        if (error != FlyCapture2::PGRERROR_OK)
236
            PrintError(error);
241
            PrintError(error);
237
    }
242
    }
238
 
243
 
239
    // Set the trigger timeout to 1000 ms
244
    // Set the trigger timeout to 1000 ms
240
    FlyCapture2::FC2Config config;
245
    FlyCapture2::FC2Config config;
241
    config.grabTimeout = 1000;
246
    config.grabTimeout = 1000;
242
    error = cam.SetConfiguration(&config);
247
    error = cam.SetConfiguration(&config);
243
    if (error != FlyCapture2::PGRERROR_OK)
248
    if (error != FlyCapture2::PGRERROR_OK)
244
        PrintError(error);
249
        PrintError(error);
245
 
250
 
246
    error = cam.StartCapture();
251
    error = cam.StartCapture();
247
    if (error != FlyCapture2::PGRERROR_OK)
252
    if (error != FlyCapture2::PGRERROR_OK)
248
        PrintError(error);
253
        PrintError(error);
249
 
254
 
250
    capturing = true;
255
    capturing = true;
251
}
256
}
252
 
257
 
253
void CameraPointGrey::stopCapture(){
258
void CameraPointGrey::stopCapture(){
254
 
259
 
255
    FlyCapture2::Error error = cam.StopCapture();
260
    FlyCapture2::Error error = cam.StopCapture();
256
    if (error != FlyCapture2::PGRERROR_OK)
261
    if (error != FlyCapture2::PGRERROR_OK)
257
        PrintError(error);
262
        PrintError(error);
258
 
263
 
259
    capturing = false;
264
    capturing = false;
260
}
265
}
261
 
266
 
262
void CameraPointGrey::trigger(){
267
void CameraPointGrey::trigger(){
263
 
268
 
264
    FlyCapture2::Error error;
269
    FlyCapture2::Error error;
265
 
270
 
266
    // Fire software trigger
271
    // Fire software trigger
267
    // broadcasting not supported on some platforms
272
    // broadcasting not supported on some platforms
268
    error = cam.FireSoftwareTrigger(false);
273
    error = cam.FireSoftwareTrigger(false);
269
 
274
 
270
    if (error != FlyCapture2::PGRERROR_OK)
275
    if (error != FlyCapture2::PGRERROR_OK)
271
        PrintError(error);
276
        PrintError(error);
272
 
277
 
273
}
278
}
274
 
279
 
275
CameraFrame CameraPointGrey::getFrame(){
280
CameraFrame CameraPointGrey::getFrame(){
276
 
281
 
277
    FlyCapture2::Error error;
282
    FlyCapture2::Error error;
278
 
283
 
279
    // Retrieve the image
284
    // Retrieve the image
280
    FlyCapture2::Image rawImage;
285
    FlyCapture2::Image rawImage;
281
    error = cam.RetrieveBuffer(&rawImage);
286
    error = cam.RetrieveBuffer(&rawImage);
282
    if (error != FlyCapture2::PGRERROR_OK)
287
    if (error != FlyCapture2::PGRERROR_OK)
283
        PrintError(error);
288
        PrintError(error);
284
 
289
 
285
//    rawImage.SetColorProcessing(FlyCapture2::IPP);
290
//    rawImage.SetColorProcessing(FlyCapture2::IPP);
286
 
291
 
287
//    // de-Bayer
292
//    // de-Bayer
288
//    rawImage.Convert(FlyCapture2::PIXEL_FORMAT_RGB8, &currentImage);
293
//    rawImage.Convert(FlyCapture2::PIXEL_FORMAT_RGB8, &currentImage);
289
 
294
 
290
//    CameraFrame frame;
295
//    CameraFrame frame;
291
 
296
 
292
//    frame.timeStamp = currentImage.GetTimeStamp().cycleCount;
297
//    frame.timeStamp = currentImage.GetTimeStamp().cycleCount;
293
//    frame.height = currentImage.GetRows();
298
//    frame.height = currentImage.GetRows();
294
//    frame.width = currentImage.GetCols();
299
//    frame.width = currentImage.GetCols();
295
//    frame.bitDepth = 8;
300
//    frame.bitDepth = 8;
296
//    frame.channels = 3;
301
//    frame.channels = 3;
297
//    frame.memory = (unsigned short*)currentImage.GetData();
302
//    frame.memory = (unsigned short*)currentImage.GetData();
298
 
303
 
299
    CameraFrame frame;
304
    CameraFrame frame;
300
 
305
 
301
    frame.timeStamp = rawImage.GetTimeStamp().cycleCount;
306
    frame.timeStamp = rawImage.GetTimeStamp().cycleCount;
302
    frame.height = rawImage.GetRows();
307
    frame.height = rawImage.GetRows();
303
    frame.width = rawImage.GetCols();
308
    frame.width = rawImage.GetCols();
304
    frame.bitDepth = 16;
309
    frame.bitDepth = 8;
305
    frame.channels = 1;
310
    frame.channels = 1;
306
    frame.memory = rawImage.GetData();
311
    frame.memory = rawImage.GetData();
307
 
312
 
308
    return frame;
313
    return frame;
309
}
314
}
310
 
315
 
311
 
316
 
312
size_t CameraPointGrey::getFrameSizeBytes(){
317
size_t CameraPointGrey::getFrameSizeBytes(){
313
    
318
    
314
    FlyCapture2::Format7ImageSettings format7Settings;
319
    FlyCapture2::Format7ImageSettings format7Settings;
315
    cam.GetFormat7Configuration(&format7Settings, NULL, NULL);
320
    cam.GetFormat7Configuration(&format7Settings, NULL, NULL);
316
 
321
 
317
    return format7Settings.height*format7Settings.width*3*2;
322
    return format7Settings.height*format7Settings.width*3*2;
318
}
323
}
319
 
324
 
320
size_t CameraPointGrey::getFrameWidth(){
325
size_t CameraPointGrey::getFrameWidth(){
321
 
326
 
322
    FlyCapture2::Format7ImageSettings format7Settings;
327
    FlyCapture2::Format7ImageSettings format7Settings;
323
    unsigned int dummy1;
328
    unsigned int dummy1;
324
    float dummy2;
329
    float dummy2;
325
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
330
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
326
    if (error != FlyCapture2::PGRERROR_OK)
331
    if (error != FlyCapture2::PGRERROR_OK)
327
        PrintError(error);
332
        PrintError(error);
328
 
333
 
329
    return format7Settings.width;
334
    return format7Settings.width;
330
}
335
}
331
 
336
 
332
size_t CameraPointGrey::getFrameHeight(){
337
size_t CameraPointGrey::getFrameHeight(){
333
 
338
 
334
    FlyCapture2::Format7ImageSettings format7Settings;
339
    FlyCapture2::Format7ImageSettings format7Settings;
335
    unsigned int dummy1;
340
    unsigned int dummy1;
336
    float dummy2;
341
    float dummy2;
337
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
342
    FlyCapture2::Error error = cam.GetFormat7Configuration(&format7Settings, &dummy1, &dummy2);
338
    if (error != FlyCapture2::PGRERROR_OK)
343
    if (error != FlyCapture2::PGRERROR_OK)
339
        PrintError(error);
344
        PrintError(error);
340
 
345
 
341
    return format7Settings.height;
346
    return format7Settings.height;
342
 
347
 
343
 
348
 
344
}
349
}
345
 
350
 
346
 
351
 
347
CameraPointGrey::~CameraPointGrey(){
352
CameraPointGrey::~CameraPointGrey(){
348
 
353
 
349
    if(capturing){
354
    if(capturing){
350
        // Stop camera transmission
355
        // Stop camera transmission
351
        stopCapture();
356
        stopCapture();
352
    }
357
    }
353
 
358
 
354
    // Gracefulle destruct the camera
359
    // Gracefulle destruct the camera
355
    cam.Disconnect();
360
    cam.Disconnect();
356
 
361
 
357
    std::cout << "Closed camera!" << std::endl << std::flush;
362
    std::cout << "Closed camera!" << std::endl << std::flush;
358
}
363
}
359
 
364
 
360
 
365
 
361
 
366
 
362
 
367