• DepthAI-v2
  • Oak-D Pro PoE tutorial on Microsoft Visual Studio Desktop C++

halosome

Step 1: Install Microsoft Visual Studio

  1. Download and install Microsoft Visual Studio from the official website.
  2. During installation, make sure to select the "Desktop development with C++" workload.

Step 2: Set Up DepthAI

  1. Download DepthAI SDK:

  2. Install Dependencies:

    • Install dependencies required by DepthAI. This might include additional libraries such as OpenCV. Ensure you have a package manager like vcpkg installed.
    • To install vcpkg, follow the instructions on the vcpkg GitHub repository.
  3. Install OpenCV:

    • Use vcpkg to install OpenCV.
         git clone https://github.com/microsoft/vcpkg.git
         ./vcpkg/bootstrap-vcpkg.bat
         ./vcpkg/vcpkg integrate install
         ./vcpkg/vcpkg install opencv

Step 3: Create a New Project in Visual Studio

  1. Open Visual Studio.
  2. Create a new project:
    • Go to File -> New -> Project.
    • Select Console App under C++ and click Next.
    • Name your project and choose a location to save it. Click Create.

Step 4: Configure Project Properties

  1. Open the project properties by right-clicking on the project in the Solution Explorer and selecting Properties.

  2. Navigate to VC++ Directories and add the include and library directories for DepthAI and OpenCV.

    • Include Directories: Add paths to DepthAI headers and OpenCV include directory (C:\path\to\vcpkg\installed\x64-windows\include).
    • Library Directories: Add paths to DepthAI and OpenCV library directories (C:\path\to\vcpkg\installed\x64-windows\lib).
  3. Navigate to Linker -> Input and add the required libraries (opencv_worldXXX.lib where XXX is your OpenCV version, and DepthAI library files).

Step 5: Write Code to Use Oak-D Pro PoE

  1. Include necessary headers in your main.cpp file:

       #include <depthai/depthai.hpp>
       #include <opencv2/opencv.hpp>
  2. Initialize DepthAI and set up a pipeline:

       int main() {
           dai::Pipeline pipeline;
           auto camRgb = pipeline.create<dai::node::ColorCamera>();
           auto xoutRgb = pipeline.create<dai::node::XLinkOut>();
    
           xoutRgb->setStreamName("rgb");
           camRgb->video.link(xoutRgb->input);
    
           dai::Device device(pipeline);
    
           auto rgbQueue = device.getOutputQueue("rgb", 8, false);
    
           while(true) {
               auto inRgb = rgbQueue->get<dai::ImgFrame>();
               cv::imshow("rgb", inRgb->getCvFrame());
               if(cv::waitKey(1) == 'q') {
                   break;
               }
           }
    
           return 0;
       }

Step 6: Build and Run the Project

  1. Build the project by clicking Build -> Build Solution.
  2. Run the project by clicking Debug -> Start Without Debugging or pressing Ctrl + F5.

Step 7: Troubleshooting

  • Ensure all paths to includes and libraries are correctly set.
  • Verify that the correct versions of libraries are linked.
  • Check if DepthAI device is properly connected and recognized by the system.

https://docs.luxonis.com/hardware/platform/deploy/poe-deployment-guide/

This should set up a basic application to capture and display video from the Oak-D Pro PoE using Microsoft Visual Studio and C++. You can expand on this by adding more functionality as needed.