Skip to content

Commit 14f57ce

Browse files
authored
Merge pull request #271 from luxonis/stereo_fixes_2
Stereo fixes 2
2 parents d9f9032 + 9eae2fa commit 14f57ce

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

examples/rgb_depth_aligned.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Create pipeline
1212
pipeline = dai.Pipeline()
13-
queueNames = None
13+
queueNames = []
1414

1515
# Define sources and outputs
1616
camRgb = pipeline.createColorCamera()

src/DatatypeBindings.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <pybind11/chrono.h>
3737
#include <pybind11/numpy.h>
3838

39+
// #include "spdlog/spdlog.h"
3940

4041
void DatatypeBindings::bind(pybind11::module& m){
4142

@@ -493,10 +494,15 @@ void DatatypeBindings::bind(pybind11::module& m){
493494
}
494495

495496
// Check if enough data
497+
long actualSize = img.getData().size();
496498
long requiredSize = dtype.itemsize();
497499
for(const auto& dim : shape) requiredSize *= dim;
498-
if(img.getData().size() < requiredSize){
499-
throw std::runtime_error("ImgFrame doesn't have enough data to encode specified frame. Maybe metadataOnly transfer was made?");
500+
if(actualSize < requiredSize){
501+
throw std::runtime_error("ImgFrame doesn't have enough data to encode specified frame, required " + std::to_string(requiredSize)
502+
+ ", actual " + std::to_string(actualSize) + ". Maybe metadataOnly transfer was made?");
503+
} else if(actualSize > requiredSize) {
504+
// FIXME check build on Windows
505+
// spdlog::warn("ImgFrame has excess data: actual {}, expected {}", actualSize, requiredSize);
500506
}
501507
if(img.getWidth() <= 0 || img.getHeight() <= 0){
502508
throw std::runtime_error("ImgFrame size invalid (width: " + std::to_string(img.getWidth()) + ", height: " + std::to_string(img.getHeight()) + ")");

0 commit comments

Comments
 (0)