Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codeplaysoftware/visioncpp
A machine vision library written in SYCL and C++ that shows performance-portable implementation of graph algorithms
https://github.com/codeplaysoftware/visioncpp
sycl
Last synced: 2 months ago
JSON representation
A machine vision library written in SYCL and C++ that shows performance-portable implementation of graph algorithms
- Host: GitHub
- URL: https://github.com/codeplaysoftware/visioncpp
- Owner: codeplaysoftware
- License: apache-2.0
- Archived: true
- Created: 2016-09-05T13:23:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-18T09:07:22.000Z (9 months ago)
- Last Synced: 2024-08-02T15:09:48.160Z (5 months ago)
- Topics: sycl
- Language: C++
- Size: 14.3 MB
- Stars: 160
- Watchers: 44
- Forks: 55
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-oneapi - visionicpp - A machine vision library written in SYCL and C++ that shows performance-portable implementation of graph algorithms (Table of Contents / AI - Computer Vision)
README
# 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](https://www.khronos.org/registry/SYCL/specs/sycl-1.2.1.pdf) and compiled/tested with [ComputeCpp](https://codeplay.com/products/computesuite/computecpp) to accelerate vision code using OpenCL devices.
## Table of contents
* [Integration](#integration)
* [Tutorials](#visioncpp-tutorials)
* [Sample Code](#sample-code)
* [Requirements](#requirements)
* [Build](#build)
* [Examples](#examples)
* [Documentation](#documentation)
* [Contributing](#contributing)
* [Resources](#resources)
* [License](#license)
* [Known Issues](#known-issues)## Integration
You will need to install ComputeCpp in order to use VisionCpp, you can follow the [ComputeCpp Getting Started guide](https://developer.codeplay.com/products/computecpp/ce/guides/getting-started) 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. )~~~~~~~~~~~~~~~{.cpp}
#include //all that is needed
~~~~~~~~~~~~~~~## VisionCpp Tutorials
There are some tutorials explaining how to perform different operations using VisionCpp. These cover basic [Hello World](https://github.com/codeplaysoftware/visioncpp/wiki/Example:-Hello-World), [Anisotropic Diffusion](https://github.com/codeplaysoftware/visioncpp/wiki/Example:-Anisotropic-Diffusion), [Bayer Filter Demosaic](https://github.com/codeplaysoftware/visioncpp/wiki/Example:-Bayer-Filter-Demosaic), [Dense Depth Reconstruction with Block Matching Algorithm](https://github.com/codeplaysoftware/visioncpp/wiki/Example:-Dense-Depth-Reconstruction-with-Block-Matching-Algorithm) and [Harris Corner Detection](https://github.com/codeplaysoftware/visioncpp/wiki/Example:-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.~~~~~~~~~~~~~~~{.cpp}
// main, args, checks and all the boring stuff// ...
// where VisionCpp will run.
auto dev = visioncpp::make_device();// create a host container for input data
std::shared_ptr 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]);// create a host container for output data
std::shared_ptr out_hsv(new unsigned char[3],
[](unsigned char *dataMem) { delete[] dataMem;});// exiting this scope will sync data
{
// definition of the VisionCpp pipeline:// create terminal nodes - a leaf node ( data node ) of the expression tree.
// terminal struct takes 4 arguments
// 1st template parameter specifies the data U8 (unsigned char) C3 (three
// channels)
// 2nd number of columns in the storage
// 3rd number of rows in the storage
// 4th underlying storage type - currently only Buffer2D supported
auto data =
visioncpp::terminal(in_rgb.get());
auto data_out =
visioncpp::terminal(out_hsv.get());// unsigned char -> float RGB storage conversion
auto node = visioncpp::point_operation(data);
// float RGB to float HSV conversion
auto node2 = visioncpp::point_operation(node);
// helper node that allows display of HSV
// for unsigned char: V <- 255*V, S <- 255*S, H <- H/2 ( to fit in range of 0..255 )
auto node3 = visioncpp::point_operation(node2);// assign operation that writes output of the pipe to output terminal node
auto pipe = visioncpp::assign(data_out, node3);
// execute the pipeline
// 1st template parameter defines if VisionCpp back-end fuses the expression
// 2nd & 3rd shared memory sizes ( column, row )
// 4th & 5th local work group size ( column , row )
visioncpp::execute(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]);~~~~~~~~~~~~~~~
## Requirements
To successfully compile VisionCpp tests, you will need:
* ComputeCpp (https://codeplay.com/products/computesuite/computecpp)
* OpenCV 3.2 (https://github.com/opencv/opencv) - used for camera access, window display and as a testing reference.
* GTest (https://github.com/google/googletest) - testing framework.
* OpenCL 1.2## Build
Assuming you are in the root of a git repo:
~~~~~~~~~~~~~~~{.sh}
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.
~~~~~~~~~~~~~~~{.sh}
| - 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](https://codeplaysoftware.github.io/visioncpp/).The documentation is created using [Doxygen](http://www.stack.nl/~dimitri/doxygen/).
~~~~~~~~~~~~~~~{.sh}
make doc
~~~~~~~~~~~~~~~The documentation will be created in html folder in build directory.
~~~~~~~~~~~~~~~{.sh}
| - build
| - doc
~~~~~~~~~~~~~~~## Contributing
Contributors always welcome! See CONTRIBUTING.md for details.The list of contributors.
## Resources
* [Kernel composition in SYCL](http://opus.bath.ac.uk/49695/)
* [VisionCPP: A SYCL-based Computer Vision Framework](http://dl.acm.org/citation.cfm?doid=2909437.2909444)
* [Wiki](https://github.com/codeplaysoftware/visioncpp/wiki)## License
The Apache License, Version 2.0 License. See [LICENSE](https://github.com/codeplaysoftware/visioncpp/blob/master/LICENSE) for more.## Known Issues
* The Tuple class works only with clang++.