Where to find updated C++ TOP API for Vulkan-supported CPlusPlus TOPs?

Hey folks! Thought I’d spend some holiday time making a rough CPlusPlus TOP to get depth data from the OAK-D-Lite. After stubbing my toes repeatedly remembering how to do anything C++, I’ve bumped up against a trap a bit of my own making: having upgraded to the latest experimental build, I’m getting the error

TOP plugins created before the 2021.30000 can not be supported due to the changeover to Vulkan. Please upgrade the plugin to be compiled against the latest C++ TOP API.

I based this top off of the samples in the CustomOperatorSamples repo, which hasn’t been updated for a few months, and this new release doesn’t have the cpp samples in the Samples folder (as far as I can tell). I should probably just install the last non-experimental build, but if I want to continue down this path, where can I find the latest version of the C++ TOP API?

Oops, yeah they are missing from the installer. I’ll fix that for the next release. Here’s a link to the samples for now:

There is no Vulkan API sample yet, but you’ll likely want to use the CPUMemoryTOP example anyways, since that is simpler for your usage case.

2 Likes

I wasn’t able to compile it on macOS due to some Python path issue. Does the Xcode project need to be set up to refer to a Python other than macOS built-in 2.7? And how does this impact simultaneous x86_64 and arm64 support?

Also, for the next update to the Python API example, can you include a custom method that takes a string argument and a double? The current example only includes “reset” which has no args so it’s a little harder to learn from. Thanks!

Which sample are you trying to compile? The Python one I assume? Nothing in our build system uses Python 2.7, that’s for sure! You’ll want to point to the Python.framework that is included in our installation directory.
The samples try to do that, but if you move the sample to it’s own spot, then you need to re-target it.

Yes thanks I was trying the CHOPWithPythonClass example. I figured it out now. When using Xcode and CMake the gist is

set_target_properties(${PROJECT_NAME} PROPERTIES
    XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "/Library/Frameworks"
    )
find_package(Python REQUIRED COMPONENTS Interpreter Development)
target_link_libraries(${PROJECT_NAME} PUBLIC Python::Python)

and I have Python 3.9 at /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
I was missing the line for XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS.

In the default project you included, this search path property relies on ../../../Frameworks which is fine, but it would be better to find a way to make it non-relative. Then people can copy the project directory anywhere. I don’t know what’s best to accomplish this though.

To pass strings as args I just had to read Embedding Python in C: Error in linking - undefined reference to PyString_AsString - Stack Overflow and string - Python Unicode object and C API ( retrieving char* from pyunicode objects ) - Stack Overflow
and #include <Python/unicodeobject.h>

Hi! I tried to compile top samples from github, but they are on older versions of TD API. Is there any guide, how upgrade older projects to Vulkan?
I want to make custom tops with opencv, but i didn’t find any new opencv samples.

There is no Vulkan-direct workflow in the C++ TOPs yet, but in the Samples folder, there are examples that work with CPU and CUDA memory, which is likely what you want to do with OpenCV anyways.