Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Bug 928115 - Support Flea3 FL3-U3-13Y3M + variable framerate in point…
Browse files Browse the repository at this point in the history
… grey capture program;r=davehunt
  • Loading branch information
wlach committed Oct 24, 2013
1 parent 6e78810 commit b335560
Showing 1 changed file with 57 additions and 6 deletions.
63 changes: 57 additions & 6 deletions src/videocapture/videocapture/pointgrey/Capture.cpp
Expand Up @@ -31,7 +31,8 @@ int usage(char *progname, int status)
" -d Output debugging information\n"
" -o If specified, print frame numbers while capturing\n"
" -f <outputdir> Directory video files will be written to\n"
" -n <frames> Max number of frames to capture (default is 20 * 60)\n"
" -r <framerate> Framerate to capture at (default is 60)\n"
" -n <frames> Max number of frames to capture (default is 20 * framerate)\n"
"\n"
"Capture video to a set of pngs.\n"
"\n"
Expand All @@ -51,7 +52,7 @@ int main(int argc, char *argv[])
Error error;
int ch;
const char *videoOutputDir = NULL;
int maxFrames = 20*60; // 20 seconds at 60fps
int maxFrames = 0;
int fps = 60;
bool printFrameNums = false;
bool debug = false;
Expand All @@ -73,6 +74,9 @@ int main(int argc, char *argv[])
case 'n':
maxFrames = atoi(optarg);
break;
case 'r':
fps = atoi(optarg);
break;
case '?':
case 'h':
usage(argv[0], 0);
Expand All @@ -84,6 +88,11 @@ int main(int argc, char *argv[])
exit(1);
}

if (!maxFrames)
{
maxFrames = 20 * fps;
}

BusManager busMgr;
PGRGuid guid;
error = busMgr.GetCameraFromIndex(0, &guid);
Expand All @@ -101,21 +110,63 @@ int main(int argc, char *argv[])
return -1;
}

FrameRate frameRate = FRAMERATE_60; // hardcoded for now

error = cam.SetVideoModeAndFrameRate(VIDEOMODE_1280x960Y8,
frameRate);
// do different things depending on camera model detected...
CameraInfo camInfo;
error = cam.GetCameraInfo(&camInfo);
if (error != PGRERROR_OK)
{
printError(error);
return -1;
}

if (strcmp(camInfo.modelName, "Flea3 FL3-U3-13Y3M") == 0)
{
Format7ImageSettings f7Settings;
f7Settings.width = 1280;
f7Settings.height = 1024;
f7Settings.pixelFormat = PIXEL_FORMAT_RAW8;
error = cam.SetFormat7Configuration(&f7Settings, (unsigned int)24764);
if (error != PGRERROR_OK)
{
printError(error);
return -1;
}

Property frameRateProp;
frameRateProp.type = FRAME_RATE;
cam.GetProperty(&frameRateProp);
frameRateProp.onOff = true;
frameRateProp.autoManualMode = false;
frameRateProp.valueA = fps;
frameRateProp.absValue = (float)fps;
cam.SetProperty(&frameRateProp);
}
else
{
if (fps != 60)
{
fprintf(stderr, "Currently only 60fps is supported with this model\n");
exit(1);
}

FrameRate frameRate = FRAMERATE_60; // hardcoded for now

error = cam.SetVideoModeAndFrameRate(VIDEOMODE_1280x960Y8,
frameRate);
if (error != PGRERROR_OK)
{
printError(error);
return -1;
}
}
// turn off all auto adjustments for eideticker
PropertyType propTypes[5] = { AUTO_EXPOSURE, SHARPNESS, SHUTTER, GAIN, WHITE_BALANCE };
for (int i=0; i<5; i++) {
Property prop;
prop.type = propTypes[i];
cam.GetProperty(&prop);
if (propTypes[i] == AUTO_EXPOSURE)
prop.onOff = true;
prop.autoManualMode = false;
cam.SetProperty(&prop);
}
Expand Down

0 comments on commit b335560

Please sign in to comment.