Overview
VisionCpp is a lightweight header-only library for computer vision and image processing. The aim of the library is to provide a toolbox that enables performance portability for heterogeneous platforms using modern C++.
Written using SYCL 1.2.1 and compiled/tested with ComputeCpp to accelerate vision code using OpenCL devices.
Table of contents
Integration
You will need to install ComputeCpp in order to use VisionCpp, you can follow the ComputeCpp Getting Started guide that outlines the installation process. All you need to do is include the VisionCpp.hpp header in your project and you are good to go! ( assuming that OpenCL and ComputeCPP is installed correctly. )
This file is collection of headers that makes VisionCpp library.
VisionCpp Tutorials
There are some tutorials explaining how to perform different operations using VisionCpp. These cover basic Hello World, Anisotropic Diffusion, Bayer Filter Demosaic, Dense Depth Reconstruction with Block Matching Algorithm and Harris Corner Detection.
Sample Code
Below is a very simple application that will do the conversion RGB -> HSV. Full source code can be found in the examples folder. RGB is assumed to be a three-channel unsigned char storage with a reasonable channel order.
std::shared_ptr<unsigned char> in_rgb(new unsigned char[3],
[](unsigned char *dataMem) { delete[] dataMem;});
in_rgb.get()[0] = atoi(argv[1]);
in_rgb.get()[1] = atoi(argv[2]);
in_rgb.get()[2] = atoi(argv[3]);
std::shared_ptr<unsigned char> out_hsv(new unsigned char[3],
[](unsigned char *dataMem) { delete[] dataMem;});
{
auto data =
auto data_out =
auto node = visioncpp::point_operation<visioncpp::OP_U8C3ToF32C3>(data);
auto node2 = visioncpp::point_operation<visioncpp::OP_RGBToHSV>(node);
auto node3 = visioncpp::point_operation<visioncpp::OP_HSVToU8C3>(node2);
visioncpp::execute<visioncpp::policy::Fuse, 1, 1, 1, 1>(pipe, dev);
}
printf("RGB: %u %u %u \nHSV: %u %u %u \n", in_rgb.get()[0], in_rgb.get()[1],
in_rgb.get()[2], out_hsv.get()[0], out_hsv.get()[1], out_hsv.get()[2]);
static constexpr size_t Buffer2D
Storage< unsigned char, 3 > U8C3
@ sycl
represents sycl backend.
auto assign(LHS lhs, RHS rhs) -> internal::Assign< LHS, RHS, LHS::Type::Cols, LHS::Type::Rows, LHS::Type::LeafType, 1+internal::tools::StaticIf<(LHS::Level > RHS::Level), LHS, RHS >::Type::Level >
assign function
internal::Device_< BK, DV > make_device()
template deduction function for Device_ class
@ cpu
represents the cpu device.
auto terminal(typename internal::MemoryProperties< ElemTp >::ChannelType *dt) -> internal::LeafNode< internal::VisionMemory< true, internal::MemoryProperties< ElemTp >::ElementCategory, MemoryType, typename internal::MemoryProperties< ElemTp >::ChannelType, Cols, Rows, ElemTp, internal::MemoryProperties< ElemTp >::ChannelSize, Sc, 0 >, 0 >
template deduction of LeafNode for buffer/image/host 2d where the element_category is Struct
Requirements
To successfully compile VisionCpp tests, you will need:
Build
Assuming you are in the root of a git repo:
mkdir build
cd build
cmake .. -DComputeCpp_DIR={PATH_TO_COMPUTECPP_ROOT} -DCMAKE_CXX_COMPILER={FAVORITE_CXX_COMPILER}
make -j8
make test
The output binaries will be catalogued in bin folder.
| - build
| - bin
| - example
| - test
Examples
There is a set of example code in the /example/ folder of the repository. Most of the examples are performing image operations from the camera input.
Documentation
Online documentation can be found here.
The documentation is created using Doxygen.
The documentation will be created in html folder in build directory.
Contributing
Contributors always welcome! See CONTRIBUTING.md for details.
The list of contributors.
Resources
License
The Apache License, Version 2.0 License. See LICENSE for more.
Known Issues
- The Tuple class works only with clang++.