change the resolution

This commit is contained in:
KalmanSLightech 2018-07-07 23:20:57 +08:00
parent 27eb9e6cb2
commit 6c25f06005

View File

@ -108,7 +108,7 @@ int main(int argc, char *argv[]) {
const auto frame_empty = [&frame]() { return frame == nullptr; }; const auto frame_empty = [&frame]() { return frame == nullptr; };
uvc::set_device_mode( uvc::set_device_mode(
*device, 752, 480, static_cast<int>(Format::YUYV), 25, *device, 1280, 480, static_cast<int>(Format::YUYV), 25,
[&mtx, &cv, &frame, &frame_ready]( [&mtx, &cv, &frame, &frame_ready](
const void *data, std::function<void()> continuation) { const void *data, std::function<void()> continuation) {
// reinterpret_cast<const std::uint8_t *>(data); // reinterpret_cast<const std::uint8_t *>(data);
@ -143,7 +143,7 @@ int main(int argc, char *argv[]) {
} }
// only lastest frame is valid // only lastest frame is valid
cv::Mat img(480, 752, CV_8UC2, const_cast<void *>(frame->data)); cv::Mat img(480, 1280, CV_8UC2, const_cast<void *>(frame->data));
cv::cvtColor(img, img, cv::COLOR_YUV2BGR_YUY2); cv::cvtColor(img, img, cv::COLOR_YUV2BGR_YUY2);
cv::imshow("frame", img); cv::imshow("frame", img);