Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/upload-artifactory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ curl -fL https://getcli.jfrog.io | sh
cd wheelhouse/audited/ || exit 1
export PATH_PREFIX=luxonis-python-snapshot-local/depthai

../../jfrog rt config --url=$ARTIFACTORY_URL --user=$ARTIFACTORY_USER --password=$ARTIFACTORY_PASS
../../jfrog config add --artifactory-url=$ARTIFACTORY_URL --user=$ARTIFACTORY_USER --password=$ARTIFACTORY_PASS
../../jfrog rt u "*" "$PATH_PREFIX/"
2 changes: 1 addition & 1 deletion depthai-core
41 changes: 21 additions & 20 deletions src/DatatypeBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ void DatatypeBindings::bind(pybind11::module& m){
.def_readwrite("instanceNum", &RawImgFrame::instanceNum)
.def_readwrite("sequenceNum", &RawImgFrame::sequenceNum)
.def_property("ts",
[](const RawImgFrame& o){
double ts = o.ts.sec + o.ts.nsec / 1000000000.0;
return ts;
[](const RawImgFrame& o){
double ts = o.ts.sec + o.ts.nsec / 1000000000.0;
return ts;
},
[](RawImgFrame& o, double ts){
o.ts.sec = ts;
o.ts.nsec = (ts - o.ts.sec) * 1000000000.0;
}
[](RawImgFrame& o, double ts){
o.ts.sec = ts;
o.ts.nsec = (ts - o.ts.sec) * 1000000000.0;
}
)
;

Expand Down Expand Up @@ -150,7 +150,7 @@ void DatatypeBindings::bind(pybind11::module& m){
.value("FP32", TensorInfo::DataType::FP32)
.value("I8", TensorInfo::DataType::I8)
;

py::enum_<TensorInfo::StorageOrder>(tensorInfo, "StorageOrder")
.value("NHWC", TensorInfo::StorageOrder::NHWC)
.value("NHCW", TensorInfo::StorageOrder::NHCW)
Expand Down Expand Up @@ -194,7 +194,7 @@ void DatatypeBindings::bind(pybind11::module& m){
.def(py::init<>())
.def_readwrite("detections", &RawSpatialImgDetections::detections)
;

// Bind RawImageManipConfig
py::class_<RawImageManipConfig, RawBuffer, std::shared_ptr<RawImageManipConfig>> rawImageManipConfig(m, "RawImageManipConfig", DOC(dai, RawImageManipConfig));
rawImageManipConfig
Expand Down Expand Up @@ -277,7 +277,7 @@ void DatatypeBindings::bind(pybind11::module& m){
.value("TRACKED", Tracklet::TrackingStatus::TRACKED)
.value("LOST", Tracklet::TrackingStatus::LOST)
;

// Bind RawTracklets
py::class_<RawTracklets, RawBuffer, std::shared_ptr<RawTracklets>> rawTacklets(m, "RawTracklets", DOC(dai, RawTracklets));
rawTacklets
Expand Down Expand Up @@ -410,7 +410,7 @@ void DatatypeBindings::bind(pybind11::module& m){

py::array contiguous = numpy.attr("ascontiguousarray")(arr);
frm.getData().resize(contiguous.nbytes());
memcpy(frm.getData().data(), contiguous.data(), contiguous.nbytes());
memcpy(frm.getData().data(), contiguous.data(), contiguous.nbytes());

}, py::arg("array"), "Copies array bytes to ImgFrame buffer")
.def("getFrame", [](py::object &obj, bool copy){
Expand All @@ -426,14 +426,14 @@ void DatatypeBindings::bind(pybind11::module& m){
// obj is "Python" object, which we used then to bind the numpy view lifespan to
// creates numpy array (zero-copy) which holds correct information such as shape, ...
auto& img = obj.cast<dai::ImgFrame&>();

// shape
bool valid = img.getWidth() > 0 && img.getHeight() > 0;
std::vector<std::size_t> shape = {img.getData().size()};
py::dtype dtype = py::dtype::of<uint8_t>();

switch(img.getType()){

case ImgFrame::Type::RGB888i :
case ImgFrame::Type::BGR888i :
// HWC
Expand Down Expand Up @@ -463,12 +463,12 @@ void DatatypeBindings::bind(pybind11::module& m){
break;

case ImgFrame::Type::GRAYF16:
shape = {img.getHeight(), img.getWidth()};
shape = {img.getHeight(), img.getWidth()};
dtype = py::dtype("half");
break;

case ImgFrame::Type::RAW16:
shape = {img.getHeight(), img.getWidth()};
shape = {img.getHeight(), img.getWidth()};
dtype = py::dtype::of<uint16_t>();
break;

Expand All @@ -477,7 +477,7 @@ void DatatypeBindings::bind(pybind11::module& m){
shape = {img.getHeight(), img.getWidth(), 3};
dtype = py::dtype("half");
break;

case ImgFrame::Type::RGBF16F16F16p:
case ImgFrame::Type::BGRF16F16F16p:
shape = {3, img.getHeight(), img.getWidth()};
Expand All @@ -488,7 +488,7 @@ void DatatypeBindings::bind(pybind11::module& m){
default:
shape = {img.getData().size()};
dtype = py::dtype::of<uint8_t>();
break;
break;
}

// Check if enough data
Expand All @@ -504,13 +504,13 @@ void DatatypeBindings::bind(pybind11::module& m){
if(copy){
py::array a(dtype, shape);
std::memcpy(a.mutable_data(), img.getData().data(), std::min( (long) (img.getData().size()), (long) (a.nbytes())));
return a;
return a;
} else {
return py::array(dtype, shape, img.getData().data(), obj);
}

}, py::arg("copy") = false, "Returns numpy array with shape as specified by width, height and type")

.def("getCvFrame", [](py::object &obj){
using namespace pybind11::literals;

Expand Down Expand Up @@ -744,9 +744,10 @@ void DatatypeBindings::bind(pybind11::module& m){
.def(py::init<>())
.def_readwrite("config", &SpatialLocations::config)
.def_readwrite("depthAverage", &SpatialLocations::depthAverage)
.def_readwrite("depthAveragePixelCount", &SpatialLocations::depthAveragePixelCount)
.def_readwrite("spatialCoordinates", &SpatialLocations::spatialCoordinates)
;


py::class_<Rect> (m, "Rect", DOC(dai, Rect))
.def(py::init<>())
Expand Down