feat(src): added feature of syncing timestamp for 200B
This commit is contained in:
@@ -125,6 +125,7 @@ make_executable2(ctrl_imu_low_pass_filter SRCS control/imu_low_pass_filter.cc WI
|
||||
make_executable2(ctrl_imu_range SRCS control/imu_range.cc WITH_OPENCV)
|
||||
make_executable2(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV)
|
||||
make_executable2(ctrl_iic_adress SRCS control/iic_address.cc WITH_OPENCV)
|
||||
make_executable2(ctrl_sync_timestamp SRCS control/sync_timestamp.cc WITH_OPENCV)
|
||||
make_executable2(ctrl_auto_exposure
|
||||
SRCS control/auto_exposure.cc util/cv_painter.cc
|
||||
WITH_OPENCV
|
||||
|
||||
56
samples/tutorials/control/sync_timestamp.cc
Normal file
56
samples/tutorials/control/sync_timestamp.cc
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
#include "mynteye/logger.h"
|
||||
#include "mynteye/api/api.h"
|
||||
|
||||
MYNTEYE_USE_NAMESPACE
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
auto &&api = API::Create(argc, argv);
|
||||
if (!api) return 1;
|
||||
|
||||
bool ok;
|
||||
auto &&request = api->SelectStreamRequest(&ok);
|
||||
if (!ok) return 1;
|
||||
api->ConfigStreamRequest(request);
|
||||
|
||||
Model model = api->GetModel();
|
||||
|
||||
if (model != Model::STANDARD200B) {
|
||||
LOG(INFO) << "Sorry, This device don't support sync timestamp";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (model == Model::STANDARD200B) {
|
||||
std::uint64_t value = 10;
|
||||
auto ok = api->SetOptionValue(Option::SYNC_TIMESTAMP, value);
|
||||
if (ok) {
|
||||
LOG(INFO) << "Set timestamp is successful.";
|
||||
} else {
|
||||
LOG(INFO) << "Set timestamp is failed.";
|
||||
}
|
||||
}
|
||||
|
||||
api->Start(Source::VIDEO_STREAMING);
|
||||
|
||||
cv::namedWindow("frame");
|
||||
|
||||
while (true) {
|
||||
api->WaitForStreams();
|
||||
|
||||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
cv::imshow("frame", img);
|
||||
|
||||
char key = static_cast<char>(cv::waitKey(1));
|
||||
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
api->Stop(Source::VIDEO_STREAMING);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user