Skip to content

Commit

Permalink
Renaming cast examples (#1032)
Browse files Browse the repository at this point in the history
* Renaming cast examples

* Updating CMake examples
  • Loading branch information
jakaskerl authored May 30, 2024
1 parent 9048745 commit 879bedb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
13 changes: 7 additions & 6 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,13 @@ dai_add_example(thermal_align ImageAlign/thermal_align.cpp OFF OFF)
dai_add_example(depth_align ImageAlign/depth_align.cpp ON OFF)

# Cast
dai_add_example(blur Cast/blur.cpp ON OFF)
target_compile_definitions(blur PRIVATE BLOB_PATH="${blur_model}")
dai_add_example(concat Cast/concat.cpp ON OFF)
target_compile_definitions(concat PRIVATE BLOB_PATH="${concat_model}")
dai_add_example(diff Cast/diff.cpp ON OFF)
target_compile_definitions(diff PRIVATE BLOB_PATH="${diff_model}")
dai_add_example(cast_blur Cast/cast_blur.cpp ON OFF)
target_compile_definitions(cast_blur PRIVATE BLOB_PATH="${blur_model}")
dai_add_example(cast_concat Cast/cast_concat.cpp ON OFF)
target_compile_definitions(cast_concat PRIVATE BLOB_PATH="${concat_model}")
dai_add_example(cast_diff Cast/cast_diff.cpp ON OFF)
target_compile_definitions(cast_diff PRIVATE BLOB_PATH="${diff_model}")


# ToF
dai_add_example(spatial_tiny_yolo_tof_v3 SpatialDetection/spatial_tiny_yolo_tof.cpp OFF OFF)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 3 additions & 9 deletions examples/ImageAlign/image_align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ constexpr auto FPS = 30.0;

constexpr auto RGB_SOCKET = dai::CameraBoardSocket::CAM_A;
constexpr auto LEFT_SOCKET = dai::CameraBoardSocket::CAM_B;
constexpr auto RIGHT_SOCKET = dai::CameraBoardSocket::CAM_C;
constexpr auto ALIGN_SOCKET = LEFT_SOCKET;

constexpr auto COLOR_RESOLUTION = dai::ColorCameraProperties::SensorResolution::THE_1080_P;
Expand All @@ -35,12 +34,12 @@ class FPSCounter {
};

double rgbWeight = 0.4;
double depthWeight = 0.6;
double leftWeight = 0.6;
int staticDepthPlane = 0;

void updateBlendWeights(int percentRgb, void*) {
rgbWeight = static_cast<double>(percentRgb) / 100.0;
depthWeight = 1.0 - rgbWeight;
leftWeight = 1.0 - rgbWeight;
}

void updateDepthPlane(int depth, void*) {
Expand All @@ -52,7 +51,6 @@ int main() {

auto camRgb = pipeline.create<dai::node::ColorCamera>();
auto left = pipeline.create<dai::node::MonoCamera>();
auto right = pipeline.create<dai::node::MonoCamera>();
auto sync = pipeline.create<dai::node::Sync>();
auto out = pipeline.create<dai::node::XLinkOut>();
auto align = pipeline.create<dai::node::ImageAlign>();
Expand All @@ -62,10 +60,6 @@ int main() {
left->setBoardSocket(LEFT_SOCKET);
left->setFps(FPS);

right->setResolution(LEFT_RIGHT_RESOLUTION);
right->setBoardSocket(RIGHT_SOCKET);
right->setFps(FPS);

camRgb->setBoardSocket(RGB_SOCKET);
camRgb->setResolution(COLOR_RESOLUTION);
camRgb->setFps(FPS);
Expand Down Expand Up @@ -115,7 +109,7 @@ int main() {
}

cv::Mat blended;
cv::addWeighted(frameRgbCv, rgbWeight, leftCv, depthWeight, 0, blended);
cv::addWeighted(frameRgbCv, rgbWeight, leftCv, leftWeight, 0, blended);
cv::imshow(windowName, blended);
}

Expand Down

0 comments on commit 879bedb

Please sign in to comment.