void DeviceController::printVideoModes() { const SensorInfo* colorSensorInfo = device.getSensorInfo(SENSOR_COLOR); const Array<VideoMode>& colorVideoModes= colorSensorInfo->getSupportedVideoModes(); ofLogVerbose() << "\n--------COLOR MODES--------\n"; for (int i=0; i<colorVideoModes.getSize(); i++) { ofLogVerbose() << "COLOR MODE: " << i; printVideoMode(colorVideoModes[i]); } const SensorInfo* depthSensorInfo = device.getSensorInfo(SENSOR_DEPTH); const Array<VideoMode>& depthVideoModes = depthSensorInfo->getSupportedVideoModes(); ofLogVerbose() << "\n--------DEPTH MODES--------\n"; for (int i=0; i<depthVideoModes.getSize(); i++) { ofLogVerbose() << "DEPTH MODE: " << i; printVideoMode(depthVideoModes[i]); } const SensorInfo* irSensorInfo = device.getSensorInfo(SENSOR_IR); const Array<VideoMode>& irVideoModes = irSensorInfo->getSupportedVideoModes(); ofLogVerbose() << "\n--------IR MODES--------\n"; for (int i=0; i<irVideoModes.getSize(); i++) { ofLogVerbose() << "IR MODE: " << i; printVideoMode(irVideoModes[i]); } }
//The Kinect/freenect driver does not find anything, The Xtion Pro has options const VideoMode* DeviceController::findMode(SensorType sensorType) { const VideoMode* mode = NULL; const SensorInfo* sensorInfo = device.getSensorInfo(sensorType); const Array<VideoMode>& videoModes = sensorInfo->getSupportedVideoModes(); for (int i=0; i<videoModes.getSize(); i++) { const VideoMode& currentMode = videoModes[i]; ofLogVerbose() << i; switch (sensorType) { case SENSOR_DEPTH: { if( currentMode.getPixelFormat() == settings.depthPixelFormat && currentMode.getResolutionX() == settings.width && currentMode.getResolutionY() == settings.height && currentMode.getFps() == settings.fps ){ mode = ¤tMode; printVideoMode(*mode); return mode; } break; } case SENSOR_COLOR: { if( currentMode.getPixelFormat() == settings.colorPixelFormat && currentMode.getResolutionX() == settings.width && currentMode.getResolutionY() == settings.height && currentMode.getFps() == settings.fps ){ mode = ¤tMode; printVideoMode(*mode); return mode; } break; } case SENSOR_IR: { if( currentMode.getPixelFormat() == settings.irPixelFormat && currentMode.getResolutionX() == settings.width && currentMode.getResolutionY() == settings.height && currentMode.getFps() == settings.fps ){ mode = ¤tMode; printVideoMode(*mode); return mode; } break; } } } return mode; }
int main(int argc, char *argv[]) { FILE* imagefile; dc1394camera_t *camera; unsigned int width, height; dc1394video_frame_t *frame=NULL; //dc1394featureset_t features; dc1394_t * d; dc1394camera_list_t * list; dc1394error_t err; int i,j; d = dc1394_new (); if (!d) return 1; err=dc1394_camera_enumerate (d, &list); DC1394_ERR_RTN(err,"Failed to enumerate cameras"); if (list->num == 0) { dc1394_log_error("No cameras found"); return 1; } printf("Total cameras found %d\n",list->num); camera = dc1394_camera_new (d, list->ids[0].guid); if (!camera) { dc1394_log_error("Failed to initialize camera with guid %llx", list->ids[0].guid); return 1; } dc1394_camera_free_list (list); printf("Using camera with GUID %"PRIx64"\n", camera->guid); dc1394video_modes_t video_modes; err=dc1394_video_get_supported_modes(camera,&video_modes); DC1394_ERR_RTN(err,"Failed get camera modes"); printf("Video Modes:\n"); for( i = 0; i < video_modes.num; i++ ) { printVideoMode(video_modes.modes[i]); if( video_modes.modes[i] < DC1394_VIDEO_MODE_FORMAT7_0 ) { dc1394framerates_t rates; err=dc1394_video_get_supported_framerates(camera,video_modes.modes[i],&rates); DC1394_ERR_RTN(err,"Failed get mode frame rates"); for( j = 0; j < rates.num; j++ ) { printFrameRates(rates.framerates[j]); } } else { dc1394color_codings_t codings; err=dc1394_format7_get_color_codings(camera,video_modes.modes[i],&codings); DC1394_ERR_RTN(err,"Failed get format7 color codings"); for( j = 0; j < codings.num; j++ ) { printColorCodings(codings.codings[j]); } uint32_t width,height; err=dc1394_format7_get_max_image_size(camera,video_modes.modes[i],&width,&height); DC1394_ERR_RTN(err,"Failed get format7 max size"); printf(" Max dimension = %d %d\n",width,height); } } dc1394_camera_free(camera); dc1394_free (d); return 0; }