Any tutorials for beginner? Thanks!
Oak-D Pro PoE tutorial on Microsoft Visual Studio Desktop C++
- Edited
Step 1: Install Microsoft Visual Studio
- Download and install Microsoft Visual Studio from the official website.
- During installation, make sure to select the "Desktop development with C++" workload.
Step 2: Set Up DepthAI
Download DepthAI SDK:
- Visit the DepthAI GitHub repository and download the latest release of the SDK.
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.
- Install dependencies required by DepthAI. This might include additional libraries such as OpenCV. Ensure you have a package manager like
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
- Use
Step 3: Create a New Project in Visual Studio
- Open Visual Studio.
- Create a new project:
- Go to
File -> New -> Project
. - Select
Console App
underC++
and clickNext
. - Name your project and choose a location to save it. Click
Create
.
- Go to
Step 4: Configure Project Properties
Open the project properties by right-clicking on the project in the Solution Explorer and selecting
Properties
.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
).
- Include Directories: Add paths to DepthAI headers and OpenCV include directory (
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
Include necessary headers in your
main.cpp
file:#include <depthai/depthai.hpp> #include <opencv2/opencv.hpp>
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
- Build the project by clicking
Build -> Build Solution
. - Run the project by clicking
Debug -> Start Without Debugging
or pressingCtrl + 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.