fix(api): device stream data dup frames remove
This commit is contained in:
parent
af8e188ae1
commit
d453f98b6d
|
@ -43,9 +43,11 @@ int main(int argc, char *argv[]) {
|
|||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
cv::imshow("frame", img);
|
||||
}
|
||||
|
||||
auto &&depth_data = api->GetStreamData(Stream::DEPTH);
|
||||
if (!depth_data.frame.empty()) {
|
||||
|
|
|
@ -43,9 +43,11 @@ int main(int argc, char *argv[]) {
|
|||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
cv::imshow("frame", img);
|
||||
}
|
||||
|
||||
// auto &&disp_data = api->GetStreamData(Stream::DISPARITY);
|
||||
// if (!disp_data.frame.empty()) {
|
||||
|
|
|
@ -44,6 +44,7 @@ int main(int argc, char *argv[]) {
|
|||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
|
||||
|
@ -68,6 +69,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
cv::imshow("frame", img);
|
||||
}
|
||||
|
||||
char key = static_cast<char>(cv::waitKey(1));
|
||||
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
|
||||
|
|
|
@ -61,6 +61,10 @@ int main(int argc, char *argv[]) {
|
|||
<< ", diff_prev=" << (img_stamp - prev_img_stamp);
|
||||
prev_img_stamp = img_stamp;
|
||||
|
||||
// if (left_data.frame.empty() || right_data.frame.empty()) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
|
||||
|
|
|
@ -41,10 +41,11 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
cv::imshow("frame", img);
|
||||
}
|
||||
|
||||
auto &&points_data = api->GetStreamData(Stream::POINTS);
|
||||
if (!points_data.frame.empty()) {
|
||||
|
|
|
@ -37,8 +37,10 @@ int main(int argc, char *argv[]) {
|
|||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
cv::Mat img;
|
||||
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
||||
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
|
||||
|
|
|
@ -34,9 +34,6 @@ class DepthProcessor : public Processor {
|
|||
std::string Name() override;
|
||||
|
||||
protected:
|
||||
inline Processor::process_type ProcessOutputConnection() override {
|
||||
return Processor::WITHOUT_CLONE;
|
||||
}
|
||||
inline Processor::process_type ProcessInputConnection() override {
|
||||
return Processor::WITHOUT_CLONE;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,6 @@ class DepthProcessorOCV : public Processor {
|
|||
virtual ~DepthProcessorOCV();
|
||||
|
||||
std::string Name() override;
|
||||
inline Processor::process_type ProcessOutputConnection() override {
|
||||
return Processor::WITHOUT_CLONE;
|
||||
}
|
||||
|
||||
protected:
|
||||
Object *OnCreateOutput() override;
|
||||
|
|
|
@ -44,9 +44,6 @@ class DisparityProcessor : public Processor {
|
|||
inline Processor::process_type ProcessOutputConnection() override {
|
||||
return Processor::WITHOUT_CLONE;
|
||||
}
|
||||
inline Processor::process_type ProcessInputConnection() override {
|
||||
return Processor::WITHOUT_CLONE;
|
||||
}
|
||||
Object *OnCreateOutput() override;
|
||||
bool OnProcess(
|
||||
Object *const in, Object *const out,
|
||||
|
|
|
@ -116,7 +116,15 @@ api::StreamData s1s2Processor::GetStreamData(const Stream &stream) {
|
|||
}
|
||||
}
|
||||
if (enable_mode == Synthetic::MODE_ON) {
|
||||
return data2api(device_->GetStreamData(stream));
|
||||
auto res = data2api(device_->GetStreamData(stream));
|
||||
if (res.img == nullptr ||
|
||||
res.img->timestamp == last_frame_id_cd ||
|
||||
res.frame.empty()) {
|
||||
return {};
|
||||
}
|
||||
last_frame_id_cd = res.img->timestamp;
|
||||
return res;
|
||||
// return data2api(device_->GetStreamData(stream));
|
||||
}
|
||||
LOG(ERROR) << "Failed to get device stream data of " << stream
|
||||
<< ", unsupported or disabled";
|
||||
|
|
Loading…
Reference in New Issue
Block a user