Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ module(
)

# Import external dependencies
bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_foreign_cc", version = "0.11.1")
bazel_dep(name = "rules_python", version = "0.40.0")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "apple_support", version = "1.17.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "curl", version = "8.8.0")
bazel_dep(name = "nlohmann_json", version = "3.11.3")
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
bazel_dep(name = "flatbuffers", version = "24.3.25")
bazel_dep(name = "opentelemetry-cpp", version = "1.19.0")
bazel_dep(name = "opencv", version = "4.11.0.bcr.2")

# Hedron's Compile Commands Extractor for Bazel
git_override(
Expand Down
36 changes: 15 additions & 21 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ FULL_SIDEBAR = NO
# Minimum value: 0, maximum value: 20, default value: 4.
# This tag requires that the tag GENERATE_HTML is set to YES.

ENUM_VALUES_PER_LINE = 4
ENUM_VALUES_PER_LINE = 1

# When the SHOW_ENUM_VALUES tag is set doxygen will show the specified
# enumeration values besides the enumeration mnemonics.
Expand Down Expand Up @@ -2813,7 +2813,7 @@ DIR_GRAPH_MAX_DEPTH = 1
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_IMAGE_FORMAT = png
DOT_IMAGE_FORMAT = svg

# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
Expand Down
2 changes: 1 addition & 1 deletion framework/include/vx_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
/*! \brief Maximum number of parameters to a kernel.
* \ingroup group_int_defines
*/
#define VX_INT_MAX_PARAMS (15)
#define VX_INT_MAX_PARAMS (22)

/*! \brief Maximum number of loadable modules.
* \ingroup group_int_defines
Expand Down
8 changes: 7 additions & 1 deletion framework/src/vx_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ VX_API_ENTRY vx_status VX_API_CALL vxLoadKernels(vx_context context, const vx_ch
status = publish((vx_context)context);
if (status != VX_SUCCESS)
{
VX_PRINT(VX_ZONE_ERROR, "Failed to publish kernels in module\n");
VX_PRINT(VX_ZONE_ERROR,
"Failed to publish kernels in module with status %d\n", status);
Osal::unloadModule(context->modules[m].handle);
context->modules[m].handle = nullptr;
}
Expand Down Expand Up @@ -875,6 +876,8 @@ VX_API_ENTRY vx_status VX_API_CALL vxAddParameterToKernel(vx_kernel kernel,
(Parameter::isValidDirection(dir) == vx_false_e) ||
(Parameter::isValidState(state) == vx_false_e))
{
VX_PRINT(VX_ZONE_ERROR,
"Invalid data type, param direction, or param state!\n");
status = VX_ERROR_INVALID_PARAMETERS;
}
else
Expand All @@ -893,6 +896,8 @@ VX_API_ENTRY vx_status VX_API_CALL vxAddParameterToKernel(vx_kernel kernel,
(Parameter::isValidState(state) == vx_false_e)) ||
(data_type == VX_TYPE_DELAY && dir != VX_INPUT))
{
VX_PRINT(VX_ZONE_ERROR,
"Invalid data type, param direction, or param state!\n");
status = VX_ERROR_INVALID_PARAMETERS;
}
else
Expand All @@ -906,6 +911,7 @@ VX_API_ENTRY vx_status VX_API_CALL vxAddParameterToKernel(vx_kernel kernel,
}
else
{
VX_PRINT(VX_ZONE_ERROR, "Invalid number of parameters associated!\n");
status = VX_ERROR_INVALID_PARAMETERS;
}
}
Expand Down
2 changes: 1 addition & 1 deletion framework/src/vx_parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Parameter::~Parameter()

vx_bool Parameter::isValidDirection(vx_enum dir)
{
if ((dir == VX_INPUT) || (dir == VX_OUTPUT)) /* Bidirectional is not valid for user kernels */
if ((dir == VX_INPUT) || (dir == VX_OUTPUT) || (dir == VX_BIDIRECTIONAL))
{
return vx_true_e;
}
Expand Down
4 changes: 2 additions & 2 deletions include/VX/vx_corevx_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
*/

/*!
* \brief The OpenVX CoreVX Vendor Extension.
* \defgroup group_corevx_ext Extension: CoreVX
* \brief The OpenVX EdgeAI Vendor Extension.
* \defgroup group_corevx_ext Extension: AI/ML
* \ingroup group_extensions
*
* \defgroup group_ort_function_cpu_inference Kernel: ORT Inference
Expand Down
38 changes: 38 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

<p align="center"><img width="50%" src="https://upload.wikimedia.org/wikipedia/commons/d/dd/OpenVX_logo.svg" /></p>

# Sample Applications

<a href="https://www.khronos.org/openvx/" target="_blank">Khronos OpenVX™</a> is an open, royalty-free standard for cross-platform acceleration of computer vision applications. OpenVX enables performance and power-optimized computer vision processing, especially important in embedded and real-time use cases such as face, body, and gesture tracking, smart video surveillance, advanced driver assistance systems (ADAS), object and scene reconstruction, augmented reality, visual inspection, robotics and more.

In this project, we provide samples that use our optimized libraries to build applications that showcase potential usage or may used as reference to develop your own products.

## Bubble Pop

In this sample we will create an OpenVX graph to run Bubble Pop on a live camera. This sample application uses <a href="https://en.wikipedia.org/wiki/OpenCV" target="_blank">OpenCV</a> to decode input image, draw bubbles/donuts and display the output.

<p align="center"><img width="60%" src="images/vx-pop-app.gif" /></p>

## Canny Edge Detector

In this sample we will create an OpenVX graph to run canny edge detection on an image or a live camera. This sample application uses <a href="https://en.wikipedia.org/wiki/OpenCV" target="_blank">OpenCV</a> to decode input image and display the output.

<p align="center"><img width="60%" src="images/canny_image.PNG" /></p>

## Optical Flow

This sample [application](./optical_flow/README.md#openvx-samples) we will create an OpenVX graph to run Optical Flow on a video/live. This sample application uses <a href="https://en.wikipedia.org/wiki/OpenCV" target="_blank">OpenCV</a> to decode input video and display the output.

<p align="center"> <img width="60%" src="https://raw.githubusercontent.com/ROCm/MIVisionX/master/docs/data/optical_flow_video.gif"> </p>

## Skin Tone Detector

In this sample we will create an OpenVX graph to run skintone detection on an image or a live camera. This sample application uses <a href="https://en.wikipedia.org/wiki/OpenCV" target="_blank">OpenCV</a> to decode input image and display the output.

<p align="center"><img width="60%" src="images/skintone-detect-app.png" /></p>

## ORB (Oriented FAST and Rotated BRIEF)
In this sample we will create an OpenVX graph to run ORB (Oriented FAST and Rotated BRIEF) on a live camera. This sample application uses <a href="https://en.wikipedia.org/wiki/OpenCV" target="_blank">OpenCV</a> to detect and display keypoints.

<p align="center"><img width="60%" src="images/orb_kp.jpg" /></p>
57 changes: 57 additions & 0 deletions samples/bubble-pop/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@


cc_import(
name = "import_vx_pop",
shared_library = ":vx_pop",
)

cc_shared_library(
name = "vx_pop",
deps = [":vx_pop_a"]
)

cc_library(
name = "vx_pop_a",
srcs = [
"source/AMD_VX_Pop_Bubble.cpp",
"source/AMD_VX_Pop_Donut.cpp",
"source/internal_dataTranslator.cpp",
"source/internal_publishKernels.cpp",
"source/internal_vxNodes.cpp"
],
deps = [
"//:corevx",
"@opencv",
"//targets/ai_server:imported_openvx_ai_server",
"//targets/c_model:imported_openvx_c_model",
"//targets/debug:imported_openvx_debug",
"//targets/extras:imported_openvx_extras",
"//targets/liteRT:imported_openvx_liteRT",
"//targets/opencl:imported_openvx_opencl",
"//targets/onnxRT:imported_openvx_onnxRT",
"//targets/executorch:imported_openvx_torch",
"//third_party:opencv-prebuilt",
],
hdrs = glob([
"include/*.h"
]),
includes = ["include"],
)

cc_binary(
name = "bubble-pop",
srcs = [
"source/AMD_app.cpp",
"include/vx_ext_pop.h",
"include/vx_pop.h",
],
includes = ["include"],
data = [
"image/bubble.png",
],
deps = [
":vx_pop_a",
":import_vx_pop"
],
visibility = ["//visibility:public"],
)
65 changes: 65 additions & 0 deletions samples/bubble-pop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## Bubble Pop Sample
In this sample we will create an OpenVX graph to run Bubble Pop on a live camera. This sample application uses <a href="https://en.wikipedia.org/wiki/OpenCV" target="_blank">OpenCV</a> to decode input image, draw bubbles/donuts and display the output.

<p align="center"><img width="60%" src="../images/vx-pop-app.gif" /></p>

### Prerequisites

* [Conformant OpenVX Implementation](https://github.com/KhronosGroup/Khronosdotorg/blob/master/api/openvx/resources.md)

* [OpenCV](https://github.com/opencv/opencv/releases/tag/3.4.0)

* Camera

### Steps to run the Bubble Pop sample

* **Step - 1:** Build and install [Conformant OpenVX Implementation](https://github.com/KhronosGroup/OpenVX-sample-impl). In this example we will use the OpenVX Sample Implementation available on [GitHub](https://github.com/KhronosGroup/OpenVX-sample-impl)

```
Build OpenVX on Linux

* Git Clone project with a recursive flag to get submodules

git clone --recursive https://github.com/KhronosGroup/OpenVX-sample-impl.git

* Use Build.py script

cd OpenVX-sample-impl/
python Build.py --os=Linux --arch=64 --conf=Debug --conf_vision --enh_vision --conf_nn
```

* **Step - 2:** Export OpenVX Directory Path

```
export OPENVX_DIR=$(pwd)/install/Linux/x64/Debug
```

* **Step - 3:** Clone the OpenVX Samples project and build the bubble pop application

```
cd ~/ && mkdir OpenVXSample-pop
cd OpenVXSample-pop/
git clone https://github.com/kiritigowda/openvx-samples.git
```

* **Step - 4:** CMake and Build the pop application

```
mkdir pop-build && cd pop-build
cmake -DOPENVX_INCLUDES=$OPENVX_DIR/include -DOPENVX_LIBRARIES=$OPENVX_DIR/bin/libopenvx.so ../openvx-samples/bubble-pop/
make
```

* **Step - 5:** Run VX Pop application

* **Bubbles**

```
./vxPop --bubble
```

* **Donuts**

````
./vxPop --donut
````
Binary file added samples/bubble-pop/image/bubble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading