diff options
Diffstat (limited to 'video-ps3eye/wrapper.cxx')
-rw-r--r-- | video-ps3eye/wrapper.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/video-ps3eye/wrapper.cxx b/video-ps3eye/wrapper.cxx index eca8968d..b7f58185 100644 --- a/video-ps3eye/wrapper.cxx +++ b/video-ps3eye/wrapper.cxx @@ -52,6 +52,7 @@ int main(int argc, char** argv) volatile auto& ptr_ = *(ps3eye::shm*)mem_.ptr(); volatile auto& in = ptr_.in; volatile auto& out = ptr_.out; + int num_channels = in.channels; auto cameras = ps3eye::list_devices(); @@ -61,16 +62,18 @@ int main(int argc, char** argv) error(out, "no camera found"); auto& camera = cameras[0]; - camera->set_debug(false); + camera->set_debug(true); auto* frame = (uint8_t*)out.data_640x480; decltype(out.timecode) timecode = 0; + auto fmt = num_channels == 1 ? ps3eye::format::Gray : ps3eye::format::BGR; + { int framerate = in.framerate; if (framerate <= 0) framerate = 60; - if (!camera->init(get_mode(in.resolution), framerate)) + if (!camera->init(get_mode(in.resolution), framerate, fmt)) error(out, "camera init failed: %s", camera->error_string()); update_settings(*camera, in); @@ -94,7 +97,7 @@ int main(int argc, char** argv) int framerate = in.framerate; if (framerate <= 0) framerate = 60; - if (!camera->init(get_mode(in.resolution), framerate)) + if (!camera->init(get_mode(in.resolution), framerate, fmt)) error(out, "camera init failed: %s", camera->error_string()); if (!camera->start()) error(out, "can't start camera: %s", camera->error_string()); |