Subversion Repositories seema-scanner

Rev

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

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