Skip to content

Commit eacbc8d

Browse files
committed
[Warp] Exposed HW engines used and interpolation
1 parent 56de7f7 commit eacbc8d

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

examples/Warp/warp_mesh.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,26 @@
2424
WARP1_OUTPUT_FRAME_SIZE = (992,500)
2525
warp1.setOutputSize(WARP1_OUTPUT_FRAME_SIZE)
2626
warp1.setMaxOutputFrameSize(WARP1_OUTPUT_FRAME_SIZE[0] * WARP1_OUTPUT_FRAME_SIZE[1] * 3)
27+
warp1.setHwIds([1])
28+
warp1.setInterpolation(dai.node.Warp.Properties.Interpolation.BYPASS)
2729

2830
camRgb.preview.link(warp1.inputImage)
2931
xout1 = pipeline.create(dai.node.XLinkOut)
3032
xout1.setStreamName('out1')
3133
warp1.out.link(xout1.input)
3234

3335
# Warp preview frame 2
34-
warp2 = pipeline.create(dai.node.Warp);
36+
warp2 = pipeline.create(dai.node.Warp)
3537
# Create a custom warp mesh
3638
mesh2 = [
3739
(20, 20), (250, 100), (460, 20),
3840
(100, 250), (250, 250), (400, 250),
3941
(20, 480), (250, 400), (460,480)
4042
]
41-
warp2.setWarpMesh(mesh2, 3, 3);
42-
warp2.setMaxOutputFrameSize(maxFrameSize);
43+
warp2.setWarpMesh(mesh2, 3, 3)
44+
warp2.setMaxOutputFrameSize(maxFrameSize)
45+
warp1.setHwIds([2])
46+
warp2.setInterpolation(dai.node.Warp.Properties.Interpolation.BICUBIC)
4347

4448
camRgb.preview.link(warp2.inputImage);
4549
xout2 = pipeline.create(dai.node.XLinkOut)

src/pipeline/node/WarpBindings.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ void bind_warp(pybind11::module& m, void* pCallstack){
1212

1313
// Node and Properties declare upfront
1414
// TODO(themarpe) - properties
15+
py::class_<Warp::Properties> warpProperties(m, "WarpProperties", DOC(dai, WarpProperties));
16+
py::enum_<Warp::Properties::Interpolation> warpPropertiesInterpolation(warpProperties, "Interpolation", DOC(dai, WarpProperties, Interpolation));
1517
auto warp = ADD_NODE(Warp);
1618

1719
///////////////////////////////////////////////////////////////////////
@@ -26,6 +28,13 @@ void bind_warp(pybind11::module& m, void* pCallstack){
2628
///////////////////////////////////////////////////////////////////////
2729
///////////////////////////////////////////////////////////////////////
2830

31+
// properties
32+
warpPropertiesInterpolation
33+
.value("BILINEAR", Warp::Properties::Interpolation::BILINEAR)
34+
.value("BICUBIC", Warp::Properties::Interpolation::BICUBIC)
35+
.value("BYPASS", Warp::Properties::Interpolation::BYPASS)
36+
;
37+
2938
// ImageManip Node
3039
warp
3140
// .def_readonly("inputConfig", &Warp::inputConfig, DOC(dai, node, Warp, inputConfig))
@@ -44,6 +53,13 @@ void bind_warp(pybind11::module& m, void* pCallstack){
4453

4554
.def("setWarpMesh", py::overload_cast<const std::vector<Point2f>&, int, int>(&Warp::setWarpMesh), DOC(dai, node, Warp, setWarpMesh))
4655
.def("setWarpMesh", py::overload_cast<const std::vector<std::pair<float,float>>&, int, int>(&Warp::setWarpMesh), DOC(dai, node, Warp, setWarpMesh))
56+
57+
.def("setHwIds", &Warp::setHwIds, DOC(dai, node, Warp, setHwIds))
58+
.def("getHwIds", &Warp::getHwIds, DOC(dai, node, Warp, getHwIds))
59+
.def("setInterpolation", &Warp::setInterpolation, DOC(dai, node, Warp, setInterpolation))
60+
.def("getInterpolation", &Warp::getInterpolation, DOC(dai, node, Warp, getInterpolation))
4761
;
4862

63+
daiNodeModule.attr("Warp").attr("Properties") = warpProperties;
64+
4965
}

0 commit comments

Comments
 (0)