├── EnergyPerFrameResults.png ├── .gitmodules ├── FPGATests └── README.md ├── LICENSE ├── GPUTests ├── README.md ├── Geometric Transforms │ ├── testResize │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUResize.cpp │ ├── testRemap │ │ └── CMakeLists.txt │ ├── testWarpAffine │ │ └── CMakeLists.txt │ └── testWarpPerspective │ │ └── CMakeLists.txt ├── Image Analysis │ ├── testCalcHist │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUCalcHist.cpp │ ├── testIntegral │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUIntegral.cpp │ ├── testMeanStdDev │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUMeanStdDev.cpp │ ├── testMinMaxLoc │ │ └── CMakeLists.txt │ └── testEqualizeHist │ │ ├── CMakeLists.txt │ │ └── src │ │ └── testGPUEqualizeHist.cpp ├── Image Features │ ├── testCanny │ │ └── CMakeLists.txt │ ├── testFast │ │ └── CMakeLists.txt │ └── testCornerHarris │ │ └── CMakeLists.txt ├── Input Processing │ ├── testLUT │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPULUT.cpp │ ├── testExtract │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUSplit.cpp │ ├── testConvertTo │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUConvertTo.cpp │ ├── testCombine │ │ └── CMakeLists.txt │ └── testCvtColor │ │ ├── CMakeLists.txt │ │ └── src │ │ └── testGPUCvtColor.cpp ├── Optical Flow & Depth │ ├── testStereoBM │ │ └── CMakeLists.txt │ └── testOpticalFlowPyr │ │ └── CMakeLists.txt ├── Image Arithmatic │ ├── testAdd │ │ └── CMakeLists.txt │ ├── testPhase │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUPhase.cpp │ ├── testAbsDiff │ │ └── CMakeLists.txt │ ├── testMultiply │ │ └── CMakeLists.txt │ ├── testSubtract │ │ └── CMakeLists.txt │ ├── testAccumulate │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUAccumulate.cpp │ ├── testBitwise_not │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUBitwise_not.cpp │ ├── testBitwise_or │ │ └── CMakeLists.txt │ ├── testBitwise_xor │ │ └── CMakeLists.txt │ ├── testThreshold │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── testGPUThreshold.cpp │ ├── testBitwise_and │ │ └── CMakeLists.txt │ ├── testMagnitude │ │ └── CMakeLists.txt │ ├── testAccumulateSquare │ │ └── CMakeLists.txt │ └── testAccumulateWeighted │ │ └── CMakeLists.txt └── Image Filters │ ├── testMedianBlur │ └── CMakeLists.txt │ ├── testPyrUp │ ├── CMakeLists.txt │ └── src │ │ └── testGPUPyrUp.cpp │ ├── testPyrDown │ └── CMakeLists.txt │ ├── testBoxFilter │ └── CMakeLists.txt │ ├── testErode │ └── CMakeLists.txt │ ├── testDilate │ └── CMakeLists.txt │ └── testFilter2D │ └── CMakeLists.txt └── README.md /EnergyPerFrameResults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ISU-RCL/cvBench/HEAD/EnergyPerFrameResults.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "PYNQ-ComputerVision"] 2 | path = PYNQ-ComputerVision 3 | url = https://github.com/Xilinx/PYNQ-ComputerVision.git 4 | -------------------------------------------------------------------------------- /FPGATests/README.md: -------------------------------------------------------------------------------- 1 | ## FPGA CV Benchmark tests: 2 | 3 | The steps to compile, run and measure the perfomance of vision kernels (xfOpenCV library) on Xilinx ZCU102/104 platforms can be found in: 4 | 5 | [Building C++ Unit Tests for PYNQ: CMake based sds++ cross-compilation](https://github.com/Xilinx/PYNQ-ComputerVision/blob/v2018.2/applicationCode/unitTests/testC%2B%2B/README.md) 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Iowa State University 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /GPUTests/README.md: -------------------------------------------------------------------------------- 1 | ## GPU OpenCV Benchmark tests 2 | 3 | This section shows how to compile, run and measure performance of vision kernels on NVIDIA Jetson TX1/TX2 platforms (Pascal GPU or ARM Cortex-A57). 4 | 5 | Each test code has three different implementations: 6 | * OpenCV C++ implementation. (ARM Cortex-A57) 7 | * CUDA implementation. (Pascal GPU) 8 | * VisionWork implementation. (Pascal GPU) 9 | 10 | ### Building source code 11 | 12 | To build test code for a vision kernel (i.e. *Filter2D*), navigate to the kernel's directory, and create *build* folder: 13 | 14 | ```commandline 15 | $ cd ./cvBench/GPUTests/Image Filters/testFilter2D/ 16 | $ mkdir build 17 | $ cd build 18 | ``` 19 | 20 | #### (1) OpenCV Implementation. (ARM Cortex-A57): 21 | 22 | To compile test code to run on the ARM-57 CPU of Jetson platform, execute: 23 | 24 | ```commandline 25 | $ cmake .. 26 | $ make testFilter2D 27 | ``` 28 | #### (2) CUDA implementation. (Pascal GPU): 29 | 30 | To enable compiling test code with CUDA support, execute: 31 | 32 | ```commandline 33 | $ cmake .. -DWITH_CUDA=ON 34 | $ make testFilter2D 35 | ``` 36 | **Note:** make sure that you built your opencv library with -DWITH_CUDA=ON . 37 | 38 | #### (3) VisionWork implementation. (Pascal GPU): 39 | 40 | To enable compiling tests with VisionWorks support, execute: 41 | 42 | ```commandline 43 | $ cmake .. -DWITH_OPENVX=ON 44 | $ make testFilter2D 45 | ``` 46 | 47 | ### Maximizing Performance 48 | 49 | To maximize performance of Jetson TX1/TX2 platforms, execute: 50 | 51 | ```commandline 52 | $ sudo nvpmodel -m 0 53 | $ sudo ~/jetson_clocks.sh 54 | ``` 55 | 56 | ### Running Test Code 57 | 58 | When the build complete successfully, an executable file will be created. To run test code on *InputImage.png* input image for 100 iterations and display the results, use this command line: 59 | 60 | ```commandline 61 | $ ./testFilter2D ./InputImage.png -d -n=100 62 | ``` 63 | 64 | __Terminal Output__: 65 | 66 | ```commandline 67 | Elapsed time over 100 SW call(s): 12420 us or 124 us per frame. 68 | comparing CUDA versus CPU 69 | number of differences: 0, average error per pixel: 0 70 | ``` 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /GPUTests/Geometric Transforms/testResize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUResize) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | # ---- goldenOpenCV ---- 54 | SET (currentTarget testGPUResize) 55 | 56 | add_executable(${currentTarget} src/testGPUResize.cpp) 57 | 58 | target_link_libraries(${currentTarget} 59 | OpenCVUtils 60 | HRTimer 61 | ${OpenCV_LIBS} 62 | ${VisionWorks_LIBRARIES} 63 | ${VisionWorks-NVXIO_LIBRARIES} 64 | ) 65 | 66 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testCalcHist/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUCalcHist) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | # ---- goldenOpenCV---- 54 | SET (currentTarget testGPUCalcHist) 55 | 56 | add_executable(${currentTarget} src/testGPUCalcHist.cpp) 57 | 58 | target_link_libraries(${currentTarget} 59 | OpenCVUtils 60 | HRTimer 61 | ${OpenCV_LIBS} 62 | ${VisionWorks_LIBRARIES} 63 | ${VisionWorks-NVXIO_LIBRARIES} 64 | ) 65 | 66 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testIntegral/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUIntegral) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUIntegral) 56 | 57 | add_executable(${currentTarget} src/testGPUIntegral.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Features/testCanny/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUFilter2D) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCVCanny ---- 55 | SET (currentTarget testGPUCanny) 56 | 57 | add_executable(${currentTarget} src/testGPUCanny.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testLUT/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPULUT) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPULUT) 56 | 57 | add_executable(${currentTarget} src/testGPULUT.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Geometric Transforms/testRemap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUFilter2D) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENVX option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCVFilter2D ---- 55 | SET (currentTarget testGPURemap) 56 | 57 | add_executable(${currentTarget} src/testGPURemap.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Features/testFast/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUFast) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | 45 | add_definitions(-DIVX_USE_OPENCV) 46 | 47 | # add subdirectories 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 49 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 50 | include_directories( 51 | ${PROJECT_SOURCE_DIR}/inc 52 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 53 | ${OpenCV_INCLUDE_DIRS} 54 | ) 55 | 56 | # ---- goldenOpenCVFilter2D ---- 57 | SET (currentTarget testGPUFast) 58 | 59 | add_executable(${currentTarget} src/testGPUFast.cpp) 60 | 61 | target_link_libraries(${currentTarget} 62 | OpenCVUtils 63 | HRTimer 64 | ${OpenCV_LIBS} 65 | ${VisionWorks_LIBRARIES} 66 | ${VisionWorks-NVXIO_LIBRARIES} 67 | ) 68 | 69 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testMeanStdDev/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUMeanStdDev) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENVX option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | # ---- goldenOpenCV---- 55 | SET (currentTarget testGPUMeanStdDev) 56 | 57 | add_executable(${currentTarget} src/testGPUMeanStdDev.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testMinMaxLoc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUMinMaxLoc) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV---- 56 | SET (currentTarget testGPUMinMaxLoc) 57 | 58 | add_executable(${currentTarget} src/testGPUMinMaxLoc.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testExtract/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUSplit) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUSplit) 56 | 57 | add_executable(${currentTarget} src/testGPUSplit.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testEqualizeHist/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUEqualizeHist) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUEqualizeHist) 56 | 57 | add_executable(${currentTarget} src/testGPUEqualizeHist.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Optical Flow & Depth/testStereoBM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUStereoBM) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUStereoBM) 57 | 58 | add_executable(${currentTarget} src/testGPUStereoBM.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Geometric Transforms/testWarpAffine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUWarpAffine) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUWarpAffine) 57 | 58 | add_executable(${currentTarget} src/testGPUWarpAffine.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testAdd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUAdd) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUAdd) 57 | 58 | add_executable(${currentTarget} src/testGPUAdd.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Features/testCornerHarris/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUCornerHarris) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | 45 | add_definitions(-DIVX_USE_OPENCV) 46 | 47 | # add subdirectories 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 49 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 50 | include_directories( 51 | ${PROJECT_SOURCE_DIR}/inc 52 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 53 | ${OpenCV_INCLUDE_DIRS} 54 | ) 55 | 56 | # ---- goldenOpenCV ---- 57 | SET (currentTarget testGPUCornerHarris) 58 | 59 | add_executable(${currentTarget} src/testGPUCornerHarris.cpp) 60 | 61 | target_link_libraries(${currentTarget} 62 | OpenCVUtils 63 | HRTimer 64 | ${OpenCV_LIBS} 65 | ${VisionWorks_LIBRARIES} 66 | ${VisionWorks-NVXIO_LIBRARIES} 67 | ) 68 | 69 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testMedianBlur/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUMedian) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | # ---- goldenOpenCV ---- 54 | SET (currentTarget testGPUMedian) 55 | 56 | add_executable(${currentTarget} src/testGPUMedian.cpp) 57 | 58 | target_link_libraries(${currentTarget} 59 | OpenCVUtils 60 | HRTimer 61 | ${OpenCV_LIBS} 62 | ${VisionWorks_LIBRARIES} 63 | ${VisionWorks-NVXIO_LIBRARIES} 64 | ) 65 | 66 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testPyrUp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUPyrUp) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUPyrUp) 56 | 57 | add_executable(${currentTarget} src/testGPUPyrUp.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testConvertTo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUConvertTo) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUConvertTo) 57 | 58 | add_executable(${currentTarget} src/testGPUConvertTo.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Geometric Transforms/testWarpPerspective/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUWarpPerspective) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUWarpPerspective) 56 | 57 | add_executable(${currentTarget} src/testGPUWarpPerspective.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testPhase/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUPhase) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | 55 | # ---- goldenOpenCV---- 56 | SET (currentTarget testGPUPhase) 57 | 58 | add_executable(${currentTarget} src/testGPUPhase.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testPyrDown/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUPyrDown) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUPyrDown) 56 | 57 | add_executable(${currentTarget} src/testGPUPyrDown.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testCombine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUCombine) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENVX option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUCombine) 56 | 57 | add_executable(${currentTarget} src/testGPUCombine.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testCvtColor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUCvtColor) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | 56 | 57 | # ---- goldenOpenCV ---- 58 | SET (currentTarget testGPUCvtColor) 59 | 60 | add_executable(${currentTarget} src/testGPUCvtColor.cpp) 61 | 62 | target_link_libraries(${currentTarget} 63 | OpenCVUtils 64 | HRTimer 65 | ${OpenCV_LIBS} 66 | ${VisionWorks_LIBRARIES} 67 | ${VisionWorks-NVXIO_LIBRARIES} 68 | ) 69 | 70 | -------------------------------------------------------------------------------- /GPUTests/Optical Flow & Depth/testOpticalFlowPyr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUOpticalFlowPyr) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUOpticalFlowPyr) 57 | 58 | add_executable(${currentTarget} src/testGPUOpticalFlowPyr.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testAbsDiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUAbsDiff) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | # add subdirectories 45 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 47 | include_directories( 48 | ${PROJECT_SOURCE_DIR}/inc 49 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 50 | ${OpenCV_INCLUDE_DIRS} 51 | ) 52 | 53 | # ---- goldenOpenCVAbsDiff ---- 54 | SET (currentTarget testGPUAbsDiff) 55 | 56 | add_executable(${currentTarget} src/testGPUAbsDiff.cpp) 57 | 58 | target_link_libraries(${currentTarget} 59 | OpenCVUtils 60 | HRTimer 61 | ${OpenCV_LIBS} 62 | ${VisionWorks_LIBRARIES} 63 | ${VisionWorks-NVXIO_LIBRARIES} 64 | ) 65 | 66 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testMultiply/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUMultiply) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | 37 | # add macro for WITH_OPENVX option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUMultiply) 56 | 57 | add_executable(${currentTarget} src/testGPUMultiply.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testSubtract/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUSubtract) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENVX option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUSubtract) 56 | 57 | add_executable(${currentTarget} src/testGPUSubtract.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testBoxFilter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUBoxFilter) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENVX option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUBoxFilter) 56 | 57 | add_executable(${currentTarget} src/testGPUBoxFilter.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testErode/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUFilter2D) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCVFilter2D ---- 56 | SET (currentTarget testGPUErode) 57 | 58 | add_executable(${currentTarget} src/testGPUErode.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testDilate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUFilter2D) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | 55 | # ---- goldenOpenCVFilter2D ---- 56 | SET (currentTarget testGPUDilate) 57 | 58 | add_executable(${currentTarget} src/testGPUDilate.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testAccumulate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUAccumulate) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUAccumulate) 57 | 58 | add_executable(${currentTarget} src/testGPUAccumulate.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testBitwise_not/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUBitwise_not) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUBitwise_not) 56 | 57 | add_executable(${currentTarget} src/testGPUBitwise_not.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testBitwise_or/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUBitwise_or) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUBitwise_or) 57 | 58 | add_executable(${currentTarget} src/testGPUBitwise_or.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testBitwise_xor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUBitwise_xor) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENVX option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCV ---- 55 | SET (currentTarget testGPUBitwise_xor) 56 | 57 | add_executable(${currentTarget} src/testGPUBitwise_xor.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testThreshold/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUThreshold) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENVX option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | # ---- goldenOpenCVFilter2D ---- 55 | SET (currentTarget testGPUThreshold) 56 | 57 | add_executable(${currentTarget} src/testGPUThreshold.cpp) 58 | 59 | target_link_libraries(${currentTarget} 60 | OpenCVUtils 61 | HRTimer 62 | ${OpenCV_LIBS} 63 | ${VisionWorks_LIBRARIES} 64 | ${VisionWorks-NVXIO_LIBRARIES} 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testBitwise_and/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUBitwise_and) 16 | project(${ProjectName}) 17 | 18 | 19 | # Find packages. 20 | # OpenCV uses environment variable OpenCV_DIR 21 | find_package(OpenCV REQUIRED) 22 | find_package(VisionWorks REQUIRED) 23 | 24 | message(STATUS "OpenCV library status:") 25 | message(STATUS " version: ${OpenCV_VERSION}") 26 | message(STATUS " libraries: ${OpenCV_LIBS}") 27 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 28 | 29 | # add macro for WITH_CUDA option 30 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 31 | if (WITH_CUDA) 32 | add_definitions(-DWITH_CUDA) 33 | message(STATUS "INFO: setting WITH_CUDA directive") 34 | endif (WITH_CUDA) 35 | 36 | # add macro for WITH_OPENCL option 37 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 38 | if (WITH_OPENVX) 39 | add_definitions(-DWITH_OPENVX) 40 | message(STATUS "INFO: setting WITH_OPENVX directive") 41 | endif (WITH_OPENVX) 42 | 43 | add_definitions(-DIVX_USE_OPENCV) 44 | 45 | # add subdirectories 46 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/inc 50 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 51 | ${OpenCV_INCLUDE_DIRS} 52 | ) 53 | 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUBitwise_and) 57 | 58 | add_executable(${currentTarget} src/testGPUBitwise_and.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testMagnitude/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUMagnitude) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | 56 | # ---- goldenOpenCV---- 57 | SET (currentTarget testGPUMagnitude) 58 | 59 | add_executable(${currentTarget} src/testGPUMagnitude.cpp) 60 | 61 | target_link_libraries(${currentTarget} 62 | OpenCVUtils 63 | HRTimer 64 | ${OpenCV_LIBS} 65 | ${VisionWorks_LIBRARIES} 66 | ${VisionWorks-NVXIO_LIBRARIES} 67 | ) 68 | 69 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testAccumulateSquare/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUAccumulateSquare) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUAccumulateSquare) 57 | 58 | add_executable(${currentTarget} src/testGPUAccumulateSquare.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testAccumulateWeighted/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | 9 | # cmake needs this line 10 | cmake_minimum_required(VERSION 2.8) 11 | 12 | set(subdirLevels "../../..") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 14 | 15 | # Define project name 16 | SET (ProjectName testGPUAccumulateWeighted) 17 | project(${ProjectName}) 18 | 19 | 20 | # Find packages. 21 | # OpenCV uses environment variable OpenCV_DIR 22 | find_package(OpenCV REQUIRED) 23 | find_package(VisionWorks REQUIRED) 24 | 25 | message(STATUS "OpenCV library status:") 26 | message(STATUS " version: ${OpenCV_VERSION}") 27 | message(STATUS " libraries: ${OpenCV_LIBS}") 28 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 29 | 30 | # add macro for WITH_CUDA option 31 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 32 | if (WITH_CUDA) 33 | add_definitions(-DWITH_CUDA) 34 | message(STATUS "INFO: setting WITH_CUDA directive") 35 | endif (WITH_CUDA) 36 | 37 | # add macro for WITH_OPENCL option 38 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 39 | if (WITH_OPENVX) 40 | add_definitions(-DWITH_OPENVX) 41 | message(STATUS "INFO: setting WITH_OPENVX directive") 42 | endif (WITH_OPENVX) 43 | 44 | add_definitions(-DIVX_USE_OPENCV) 45 | 46 | # add subdirectories 47 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 49 | include_directories( 50 | ${PROJECT_SOURCE_DIR}/inc 51 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 52 | ${OpenCV_INCLUDE_DIRS} 53 | ) 54 | 55 | # ---- goldenOpenCV ---- 56 | SET (currentTarget testGPUAccumulateWeighted) 57 | 58 | add_executable(${currentTarget} src/testGPUAccumulateWeighted.cpp) 59 | 60 | target_link_libraries(${currentTarget} 61 | OpenCVUtils 62 | HRTimer 63 | ${OpenCV_LIBS} 64 | ${VisionWorks_LIBRARIES} 65 | ${VisionWorks-NVXIO_LIBRARIES} 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testFilter2D/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Iowa State University. 3 | # All rights reserved. 4 | # 5 | # Author: Murad Qasaimeh 6 | # Date: 2018/03/27 7 | 8 | # cmake needs this line 9 | cmake_minimum_required(VERSION 2.8) 10 | 11 | set(subdirLevels "../../..") 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${subdirLevels}/PYNQ-ComputerVision/frameworks/cmakeModules) 13 | 14 | # Define project name 15 | SET (ProjectName testGPUFilter2D) 16 | project(${ProjectName}) 17 | 18 | 19 | 20 | message(STATUS " version: ${OpenCV_VERSION}") 21 | 22 | # Find packages. 23 | # OpenCV uses environment variable OpenCV_DIR 24 | find_package(OpenCV REQUIRED) 25 | find_package(VisionWorks REQUIRED) 26 | 27 | message(STATUS "OpenCV library status:") 28 | message(STATUS " version: ${OpenCV_VERSION}") 29 | message(STATUS " libraries: ${OpenCV_LIBS}") 30 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 31 | 32 | # add macro for WITH_CUDA option 33 | OPTION(WITH_CUDA "Compile with CUDA" OFF) # Disabled by default 34 | if (WITH_CUDA) 35 | add_definitions(-DWITH_CUDA) 36 | message(STATUS "INFO: setting WITH_CUDA directive") 37 | endif (WITH_CUDA) 38 | 39 | # add macro for WITH_OpenVX option 40 | OPTION(WITH_OPENVX "Compile with OpenVX" OFF) # Disabled by default 41 | if (WITH_OPENVX) 42 | add_definitions(-DWITH_OPENVX) 43 | message(STATUS "INFO: setting WITH_OPENVX directive") 44 | endif (WITH_OPENVX) 45 | 46 | add_definitions(-DIVX_USE_OPENCV) 47 | # add subdirectories 48 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils ${CMAKE_CURRENT_BINARY_DIR}/OpenCVUtils) 49 | add_subdirectory(${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/HRTimer ${CMAKE_CURRENT_BINARY_DIR}/HRTimer) 50 | include_directories( 51 | ${PROJECT_SOURCE_DIR}/inc 52 | ${PROJECT_SOURCE_DIR}/../../../PYNQ-ComputerVision/frameworks/utilities/OpenCVUtils/inc 53 | ${OpenCV_INCLUDE_DIRS} 54 | ) 55 | 56 | # ---- goldenOpenCVFilter2D ---- 57 | SET (currentTarget testGPUFilter2D) 58 | 59 | add_executable(${currentTarget} src/testGPUFilter2D.cpp) 60 | 61 | target_link_libraries(${currentTarget} 62 | OpenCVUtils 63 | HRTimer 64 | ${OpenCV_LIBS} 65 | ${VisionWorks_LIBRARIES} 66 | ${VisionWorks-NVXIO_LIBRARIES} 67 | ) 68 | 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Benchmarking Analysis of Vision Kernels on Embedded CPU, GPU and FPGA: 2 | 3 | 4 |

5 | 6 | This repository contains benchmark framework for measuring and comparing energy efficiency of different vision kernels on embedded platforms. It aims to provide computer vision community an easy tool to analyze the performance of vision kernels on different hardware architectures and aids with determining which hardware architecture is most suitable for different kind of vision applications. 7 | 8 |

9 | 10 | ## Table of contents 11 | 12 | * [Repository Structure](#Repository-Structure) 13 | * [Hardware and Software Environments](#Hardware-and-Software-Environments) 14 | * [List of Vision Kernels](#List-of-Vision-Kernels) 15 | * [Installation](#Installation) 16 | * [Build Test Codes](#Build-Test-Codes) 17 | * [Results Summary](#Results-Summary) 18 | * [Reference](#reference) 19 | * [License](#license) 20 | 21 | 22 | ## Repository Structure 23 | 24 | This repository consists of: 25 | ``` 26 | . 27 | ├── FPGATests 28 | │   └── README.md 29 | ├── GPUTests 30 | │   ├── Geometric Transforms 31 | │   ├── Image Analysis 32 | │   ├── Image Arithmatic 33 | │   ├── Image Features 34 | │   ├── Image Filters 35 | │   ├── Input Processing 36 | │   ├── Optical Flow & Depth 37 | │   └── README.md 38 | ├── PYNQ-ComputerVision 39 | │   ├── applicationCode 40 | │   │   ├── overlayTests 41 | │   │   └── unitTests 42 | │   ├── boards 43 | │   │   ├── Pynq-Z1 44 | │   │   ├── Pynq-Z2 45 | │   │   ├── Ultra96 46 | │   │   └── ZCU104 47 | │   ├── components 48 | │   └── frameworks 49 | │      ├── cmakeModules 50 | │      └── utilities 51 | └── README.md 52 | ``` 53 | 54 | ## Hardware and Software Environments 55 | * Software Environments: 56 | * **OpenCV3.x** : https://www.opencv.org/ 57 | * **xfOpenCV 2018.x** : https://github.com/Xilinx/xfopencv 58 | * **VisionWorks 1.6** : https://developer.nvidia.com/embedded/jetpack 59 | 60 | * Hardware Platforms: 61 | * **FPGA board**: [Xilinx Zynq ZCU102/ZCU104](https://www.xilinx.com/products/boards-and-kits/ek-u1-zcu102-g.html), [PYNQ-Z1/2](http://www.pynq.io/board) or [Ultra96](http://zedboard.org/product/ultra96). 62 | * **GPU board**: [NVIDIA Jetson TX1/ TX2](https://developer.nvidia.com/embedded/buy/jetson-tx2). 63 | 64 | 65 | ## List of Vision Kernels 66 | 67 | 68 | | Input Processing | Image Arithmatic | Filters | Image Analysis | Geometric Transforms| Composite Kernels| 69 | | ------------- | ------------- | ------------- | ------------- | ------------- | -------------------- | 70 | | combine | AbsDiff | filter2D |calcHist | affine warp | canny | 71 | | extract | accumulate | box filter |equalizeHist |perspective warp | fast | | 72 | | convertTo |accumulate squared| dilate |integral image | resize | harris | 73 | | cvtConvert |accumulate weighted| erode |mean std dev | remap | optical flow pyramid | 74 | | table lookup | add/subtract | median |min/max loc | | stereoBM | 75 | | | mulitply | pyramidUp | | | | 76 | | | threshold | pyramidDown | | | | 77 | | | bitwise and,or,xor,not| | | | | 78 | | | magnitude | | | | | 79 | | | phase | | | | | 80 | 81 | 82 | 83 | ## Installation 84 | 85 | To clone the repository with [PYNQ-ComputerVision](https://github.com/Xilinx/PYNQ-ComputerVision.git) submodules, open a terminal and execute: 86 | 87 | ``` 88 | git clone --recursive https://github.com/ISU-RCL/cvBench.git 89 | ``` 90 | ## Build Test Codes 91 | The steps required to build and run unit tests is described in: 92 | 93 | + [GPU Implementation (GPUTest)](GPUTests/README.md) 94 | + [FPGA Implementation (PLTests)](FPGATests/README.md) 95 | 96 | ## Results Summary 97 | 98 | In our experiment, we evaluated the performance of vision kernels on two popular platforms for deploying embedded vision applications: 99 | + Nvidia Jetson TX2 (256-core Pascal GPU + ARM Cortex-A57 CPU). 100 | + Xilinx Zynq UltraScale+ ZCU102 (XCZU9EG FPGA + ARM Cortex-A53 CPU). 101 | 102 | 103 | The figures below show the **energy/frame (in mJ/f)** comparison results. 104 | 105 | 106 | ![Alt text](EnergyPerFrameResults.png?raw=true "Title") 107 | 108 | ## Reference 109 | 110 | ``` 111 | @inproceedings{EnergyEfficiencyFCCM2019, 112 | title={Analyzing the Energy-Efficiency of Vision Kernels on Embedded CPU, GPU and FPGA Platforms}, 113 | author={Qasaimeh, Murad and Kristof, Denolf and Jack, Lo and Kees, Vissers and Zambreno, Joseph and Jones, Phillip H}, 114 | booktitle={2019 IEEE 27th Annual International Symposium on Field-Programmable Custom Computing Machines (FCCM)}, 115 | year={2019}, 116 | organization={IEEE} 117 | } 118 | ``` 119 | ## License 120 | The source for this project is licensed under the [3-Clause BSD License](LICENSE) 121 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testMeanStdDev/src/testGPUMeanStdDev.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, meanSW, stdDevSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | std::cout << "running on CPU" << std::endl; 106 | 107 | //warming up 108 | cv::meanStdDev(srcIn, meanSW, stdDevSW); 109 | timer.StartTimer(); 110 | for (int i = 0; i < numberOfIterations; i++) 111 | { 112 | cv::meanStdDev(srcIn, meanSW, stdDevSW); 113 | } 114 | timer.StopTimer(); 115 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 116 | 117 | /*-------------------------- CUDA ---------------------------------------------*/ 118 | bool ranCuda = false; 119 | cv::Scalar meanCUDA, stdDevCUDA; 120 | #ifdef WITH_CUDA 121 | 122 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 123 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 124 | std::cout << "no Cuda devices available" << std::endl; 125 | } 126 | else 127 | { 128 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 129 | 130 | cv::cuda::GpuMat srcCuda; 131 | 132 | 133 | cv::cuda::Stream stream; 134 | srcCuda.upload(srcIn); 135 | 136 | std::cout << "running CUDA" << std::endl; 137 | 138 | //warming up 139 | cv::cuda::meanStdDev(srcCuda, meanCUDA, stdDevCUDA); 140 | timer.StartTimer(); 141 | for (int i = 0; i < numberOfIterations; i++) 142 | { 143 | cv::cuda::meanStdDev(srcCuda, meanCUDA, stdDevCUDA); 144 | } 145 | timer.StopTimer(); 146 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 147 | ranCuda = true; 148 | } 149 | #endif 150 | 151 | /*-------------------------- OPENVX ---------------------------------------------*/ 152 | bool ranOpenvx = false; 153 | float meanVX, stdDevVX; 154 | #ifdef WITH_OPENVX 155 | 156 | //create context 157 | ivx::Context context = ivx::Context::create(); 158 | 159 | //create src image 160 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 161 | 162 | //copy cv::Mat to vx_image 163 | ivxImage.copyFrom(0, srcIn); 164 | ivx::Scalar meanOpenVX= ivx::Scalar::create(context, 0.0); 165 | ivx::Scalar stdDevOpenVx= ivx::Scalar::create(context, 0.0); 166 | 167 | //create graph 168 | ivx::Graph graph = ivx::Graph::create(context); 169 | ivx::Node::create(graph, VX_KERNEL_MEAN_STDDEV, ivxImage, meanOpenVX, stdDevOpenVx); 170 | 171 | std::cout << "running OpenVX" << std::endl; 172 | 173 | //warming up 174 | graph.process(); 175 | timer.StartTimer(); 176 | for (int i = 0; i < numberOfIterations; i++){ 177 | graph.process(); 178 | } 179 | timer.StopTimer(); 180 | meanOpenVX.getValue(meanVX); 181 | stdDevOpenVx.getValue(stdDevVX); 182 | 183 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 184 | 185 | ranOpenvx = true; 186 | #endif 187 | 188 | /*------------- end of measurements ----------------------*/ 189 | 190 | 191 | //show results 192 | if (imShowOn) { 193 | cv::imshow("Input image", srcIn); 194 | cv::waitKey(0); 195 | std::cout<<"meanSW = "<< meanSW.at(0,0)<< "\tstdDevSW= "<< stdDevSW.at(0,0)<< std::endl; 196 | 197 | if (ranCuda) 198 | std::cout<<"meanCUDA = "<< meanCUDA(0)<< "\tstdDevCUDA= "<< stdDevCUDA(0)<< std::endl; 199 | if (ranOpenvx) 200 | std::cout<<"meanOpenVX = "<< meanVX<< "\tstdDevOpenVX= "<< stdDevVX<< std::endl; 201 | 202 | std::cout<<"\n"; 203 | 204 | } 205 | } 206 | catch (std::exception &e) 207 | { 208 | const char* errorMessage = e.what(); 209 | std::cerr << "Exception caught: " << errorMessage << std::endl; 210 | std::cout << "\nhit enter to quit..."; 211 | std::cin.get(); 212 | exit(-1); 213 | } 214 | catch (const char *e) { 215 | std::cerr << "Exception caught: " << e << std::endl; 216 | std::cout << "\nhit enter to quit..."; 217 | std::cin.get(); 218 | exit(-1); 219 | } 220 | 221 | std::cout << "\nhit enter to quit..."; 222 | std::cin.get(); 223 | return 0; 224 | } 225 | 226 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testCalcHist/src/testGPUCalcHist.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include "opencv2/core.hpp" 44 | #include 45 | 46 | #include "OpenCVUtils.h" 47 | #include "opencv2/core/cuda.hpp" 48 | #include "ivx.hpp" 49 | #include 50 | 51 | int main(int argc, char** argv) 52 | { 53 | HRTimer timer; 54 | 55 | try { 56 | const cv::String keys = 57 | "{help h usage ? | | print this message }" 58 | "{@image | | input image }" 59 | "{goldenFile gf | | golden output image (from SW) }" 60 | "{outFile of | | output image (from PL) }" 61 | "{display d | | diplay result with imshow }" 62 | "{iterations n | 1 | number of iterations to measure time }" 63 | ; 64 | 65 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 66 | if (parser.has("help") || argc < 2) 67 | { 68 | parser.printMessage(); 69 | std::cout << "\nhit enter to quit..."; 70 | std::cin.get(); 71 | return 0; 72 | } 73 | 74 | cv::String filenameIn = parser.get(0); 75 | 76 | cv::String filenameSW; bool writeSWResult = false; 77 | if (parser.has("goldenFile")) { 78 | filenameSW = parser.get("goldenFile"); 79 | writeSWResult = true; 80 | } 81 | 82 | cv::String filenamePL; bool writePLResult = false; 83 | if (parser.has("outFile")) { 84 | filenamePL = parser.get("outFile"); 85 | writePLResult = true; 86 | } 87 | 88 | bool imShowOn = parser.has("display"); 89 | unsigned int numberOfIterations; 90 | if (parser.has("iterations")) 91 | numberOfIterations = parser.get("iterations"); 92 | 93 | if (!parser.check()) 94 | { 95 | parser.printErrors(); 96 | return(-1); 97 | } 98 | 99 | // Initialize 100 | cv::Mat srcIn, binIn, dstSW; 101 | initializeSingleGrayImageTest(filenameIn, srcIn); 102 | 103 | int width = srcIn.size().width; 104 | int height = srcIn.size().height; 105 | 106 | // Histogram parameters 107 | int histSize = 10; 108 | float range[] = {0, 256}; 109 | const float* histRange= {range}; 110 | 111 | std::cout << "running on CPU" << std::endl; 112 | 113 | //warming up 114 | cv::calcHist(&srcIn, 1, 0, cv::Mat(), dstSW, 1, &histSize, &histRange, 1, 0); 115 | timer.StartTimer(); 116 | for (int i = 0; i < numberOfIterations; i++) 117 | { 118 | cv::calcHist(&srcIn, 1, 0, cv::Mat(), dstSW, 1, &histSize, &histRange, 1, 0); 119 | } 120 | timer.StopTimer(); 121 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 122 | 123 | /*-------------------------- CUDA ---------------------------------------------*/ 124 | bool ranCuda = false; 125 | cv::Mat dstCudaOnHost; 126 | 127 | #ifdef WITH_CUDA 128 | 129 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 130 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 131 | std::cout << "no Cuda devices available" << std::endl; 132 | } 133 | else 134 | { 135 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 136 | 137 | cv::cuda::GpuMat srcCuda, dstCuda; 138 | cv::cuda::Stream stream; 139 | srcCuda.upload(srcIn); 140 | 141 | std::cout << "running CUDA" << std::endl; 142 | 143 | //warming up 144 | cv::cuda::histEven(srcCuda, dstCuda,histSize, 0, 255); 145 | timer.StartTimer(); 146 | for (int i = 0; i < numberOfIterations; i++) 147 | { 148 | cv::cuda::histEven(srcCuda, dstCuda, histSize, 0, 255); 149 | } 150 | timer.StopTimer(); 151 | 152 | dstCuda.download(dstCudaOnHost); 153 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 154 | ranCuda = true; 155 | } 156 | #endif 157 | 158 | /*-------------------------- OPENVX ---------------------------------------------*/ 159 | bool ranOpenvx = false; 160 | vx_uint32 dstOpenvx[histSize]; 161 | #ifdef WITH_OPENVX 162 | 163 | //create context 164 | ivx::Context context = ivx::Context::create(); 165 | 166 | //create src image 167 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 168 | 169 | //copy cv::Mat to vx_image 170 | ivxImage.copyFrom(0, srcIn); 171 | 172 | //histogram distribution 173 | ivx::Distribution dist = ivx::Distribution::create(context, histSize, 0, 256); 174 | //create graph 175 | ivx::Graph graph = ivx::Graph::create(context); 176 | ivx::Node::create(graph, VX_KERNEL_HISTOGRAM, ivxImage, dist); 177 | 178 | std::cout << "running OpenVX" << std::endl; 179 | 180 | //warming up 181 | graph.process(); 182 | timer.StartTimer(); 183 | for (int i = 0; i < numberOfIterations; i++){ 184 | graph.process(); 185 | } 186 | timer.StopTimer(); 187 | //copy dist to cv::Mat 188 | dist.copyTo(&dstOpenvx); 189 | 190 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 191 | 192 | ranOpenvx = true; 193 | #endif 194 | 195 | /*------------- end of measurements ----------------------*/ 196 | 197 | 198 | //show results 199 | if (imShowOn) { 200 | cv::imshow("Input image", srcIn); 201 | cv::waitKey(0); 202 | for(int cnt=0; cnt 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | 106 | std::cout << "running on CPU" << std::endl; 107 | 108 | //warming up 109 | cv::bitwise_not(srcIn, dstSW); 110 | timer.StartTimer(); 111 | for (int i = 0; i < numberOfIterations; i++) 112 | { 113 | cv::bitwise_not(srcIn, dstSW); 114 | } 115 | timer.StopTimer(); 116 | std::cout << "Elapsed time over " << numberOfIterations << " SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 117 | 118 | 119 | /*-------------------------- CUDA ---------------------------------------------*/ 120 | bool ranCuda = false; 121 | cv::Mat dstCudaOnHost; 122 | 123 | #ifdef WITH_CUDA 124 | 125 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 126 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 127 | std::cout << "no Cuda devices available" << std::endl; 128 | } 129 | else 130 | { 131 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 132 | 133 | cv::cuda::GpuMat srcCuda, dstCuda; 134 | srcCuda.upload(srcIn); 135 | cv::cuda::Stream stream; 136 | 137 | std::cout << "running CUDA" << std::endl; 138 | //warming up 139 | cv::cuda::bitwise_not(srcCuda, dstCuda); 140 | timer.StartTimer(); 141 | for (int i = 0; i < numberOfIterations; i++) 142 | { 143 | cv::cuda::bitwise_not(srcCuda, dstCuda); 144 | } 145 | timer.StopTimer(); 146 | dstCuda.download(dstCudaOnHost); 147 | std::cout << "Elapsed time over " << numberOfIterations << " CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 148 | ranCuda = true; 149 | } 150 | #endif 151 | 152 | /*-------------------------- OPENVX ---------------------------------------------*/ 153 | bool ranOpenvx = false; 154 | cv::Mat dstOpenvx; 155 | 156 | #ifdef WITH_OPENVX 157 | //create context 158 | ivx::Context context = ivx::Context::create(); 159 | 160 | //copy cv::Mat to vx_image 161 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 162 | ivxImage.copyFrom(0, srcIn); 163 | 164 | //dst image 165 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 166 | 167 | //create graph 168 | ivx::Graph graph = ivx::Graph::create(context); 169 | ivx::Node::create(graph, VX_KERNEL_NOT, ivxImage, ivxResult); 170 | 171 | //verify graph 172 | graph.verify(); 173 | 174 | std::cout << "running OpenVX" << std::endl; 175 | 176 | //warming up 177 | graph.process(); 178 | timer.StartTimer(); 179 | for (int i = 0; i < numberOfIterations; i++){ 180 | graph.process(); 181 | } 182 | timer.StopTimer(); 183 | //copy vx_image to cv::Mat 184 | ivxResult.copyTo(0, dstOpenvx); 185 | 186 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 187 | 188 | ranOpenvx = true; 189 | 190 | #endif 191 | 192 | /*------------- end of measurements ----------------------*/ 193 | 194 | // compare results 195 | int numberOfDifferences = 0; 196 | double errorPerPixel = 0; 197 | if (ranCuda) 198 | { 199 | std::cout << "comparing CUDA versus CPU" << std::endl; 200 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 201 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 202 | } 203 | if (ranOpenvx) 204 | { 205 | std::cout << "comparing Openvx versus CPU" << std::endl; 206 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 207 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 208 | } 209 | 210 | //show results 211 | if (imShowOn) { 212 | cv::imshow("Input image", srcIn); 213 | cv::imshow("Processed (SW)", dstSW); 214 | if (ranCuda) 215 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 216 | if (ranOpenvx) 217 | cv::imshow("Processed (Openvx)", dstOpenvx); 218 | cv::waitKey(0); 219 | } 220 | } 221 | catch (std::exception &e) 222 | { 223 | const char* errorMessage = e.what(); 224 | std::cerr << "Exception caught: " << errorMessage << std::endl; 225 | std::cout << "\nhit enter to quit..."; 226 | std::cin.get(); 227 | exit(-1); 228 | } 229 | catch (const char *e) { 230 | std::cerr << "Exception caught: " << e << std::endl; 231 | std::cout << "\nhit enter to quit..."; 232 | std::cin.get(); 233 | exit(-1); 234 | } 235 | 236 | std::cout << "\nhit enter to quit..."; 237 | std::cin.get(); 238 | return 0; 239 | } 240 | 241 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testEqualizeHist/src/testGPUEqualizeHist.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | std::cout << "running on CPU" << std::endl; 106 | 107 | //warming up 108 | equalizeHist(srcIn, dstSW); 109 | 110 | timer.StartTimer(); 111 | for (int i = 0; i < numberOfIterations; i++) 112 | { 113 | equalizeHist(srcIn, dstSW); 114 | } 115 | timer.StopTimer(); 116 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 117 | 118 | /*-------------------------- CUDA ---------------------------------------------*/ 119 | bool ranCuda = false; 120 | cv::Mat dstCudaOnHost; 121 | 122 | #ifdef WITH_CUDA 123 | 124 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 125 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 126 | std::cout << "no Cuda devices available" << std::endl; 127 | } 128 | else 129 | { 130 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 131 | 132 | cv::cuda::GpuMat srcCuda, dstCuda; 133 | srcCuda.upload(srcIn); 134 | 135 | std::cout << "running CUDA" << std::endl; 136 | cv::cuda::Stream stream; 137 | 138 | //warming up 139 | cv::cuda::equalizeHist(srcCuda, dstCuda, stream); 140 | timer.StartTimer(); 141 | for (int i = 0; i < numberOfIterations; i++) 142 | { 143 | cv::cuda::equalizeHist(srcCuda, dstCuda, stream); 144 | } 145 | timer.StopTimer(); 146 | dstCuda.download(dstCudaOnHost); 147 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 148 | 149 | ranCuda = true; 150 | } 151 | #endif 152 | 153 | /*-------------------------- OPENVX ---------------------------------------------*/ 154 | bool ranOpenvx = false; 155 | cv::Mat dstOpenvx; 156 | 157 | #ifdef WITH_OPENVX 158 | 159 | //create context 160 | ivx::Context context = ivx::Context::create(); 161 | 162 | //src image 163 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 164 | 165 | //dst image 166 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 167 | 168 | //copy cv::Mat to vx_image 169 | ivxImage.copyFrom(0, srcIn); 170 | 171 | //create graph 172 | ivx::Graph graph = ivx::Graph::create(context); 173 | ivx::Node::create(graph, VX_KERNEL_EQUALIZE_HISTOGRAM , ivxImage, ivxResult); 174 | 175 | std::cout << "running OpenVX" << std::endl; 176 | 177 | //warming up 178 | graph.process(); 179 | timer.StartTimer(); 180 | for (int i = 0; i < numberOfIterations; i++){ 181 | graph.process(); 182 | } 183 | timer.StopTimer(); 184 | //copy vx_image to cv::Mat 185 | ivxResult.copyTo(0, dstOpenvx); 186 | 187 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 188 | 189 | ranOpenvx = true; 190 | #endif 191 | 192 | /*------------- end of measurements ----------------------*/ 193 | 194 | // compare results 195 | int numberOfDifferences = 0; 196 | double errorPerPixel = 0; 197 | 198 | if (ranCuda) 199 | { 200 | std::cout << "comparing CUDA versus CPU" << std::endl; 201 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 202 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 203 | } 204 | if (ranOpenvx) 205 | { 206 | std::cout << "comparing Openvx versus CPU" << std::endl; 207 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 208 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 209 | } 210 | 211 | //show results 212 | if (imShowOn) { 213 | cv::imshow("Input image", srcIn); 214 | cv::imshow("Processed (SW)", dstSW); 215 | if (ranCuda) 216 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 217 | if (ranOpenvx) 218 | cv::imshow("Processed (Openvx)", dstOpenvx); 219 | cv::waitKey(0); 220 | } 221 | } 222 | catch (std::exception &e) 223 | { 224 | const char* errorMessage = e.what(); 225 | std::cerr << "Exception caught: " << errorMessage << std::endl; 226 | std::cout << "\nhit enter to quit..."; 227 | std::cin.get(); 228 | exit(-1); 229 | } 230 | catch (const char *e) { 231 | std::cerr << "Exception caught: " << e << std::endl; 232 | std::cout << "\nhit enter to quit..."; 233 | std::cin.get(); 234 | exit(-1); 235 | } 236 | 237 | std::cout << "\nhit enter to quit..."; 238 | std::cin.get(); 239 | return 0; 240 | } 241 | 242 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testCvtColor/src/testGPUCvtColor.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | 51 | int main(int argc, char** argv) 52 | { 53 | HRTimer timer; 54 | 55 | try { 56 | const cv::String keys = 57 | "{help h usage ? | | print this message }" 58 | "{@image | | input image }" 59 | "{goldenFile gf | | golden output image (from SW) }" 60 | "{outFile of | | output image (from PL) }" 61 | "{display d | | diplay result with imshow }" 62 | "{iterations n | 1 | number of iterations to measure time }" 63 | ; 64 | 65 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 66 | if (parser.has("help") || argc < 2) 67 | { 68 | parser.printMessage(); 69 | std::cout << "\nhit enter to quit..."; 70 | std::cin.get(); 71 | return 0; 72 | } 73 | 74 | cv::String filenameIn = parser.get(0); 75 | 76 | cv::String filenameSW; bool writeSWResult = false; 77 | if (parser.has("goldenFile")) { 78 | filenameSW = parser.get("goldenFile"); 79 | writeSWResult = true; 80 | } 81 | 82 | cv::String filenamePL; bool writePLResult = false; 83 | if (parser.has("outFile")) { 84 | filenamePL = parser.get("outFile"); 85 | writePLResult = true; 86 | } 87 | 88 | bool imShowOn = parser.has("display"); 89 | unsigned int numberOfIterations; 90 | if (parser.has("iterations")) 91 | numberOfIterations = parser.get("iterations"); 92 | 93 | if (!parser.check()) 94 | { 95 | parser.printErrors(); 96 | return(-1); 97 | } 98 | 99 | // Initialize 100 | cv::Mat srcIn, dstSW; 101 | srcIn = imread(filenameIn, CV_LOAD_IMAGE_COLOR); // Read the file 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | std::cout << "running on CPU" << std::endl; 106 | 107 | //warming up 108 | cv::cvtColor(srcIn, dstSW, CV_BGR2Luv); 109 | timer.StartTimer(); 110 | for (int i = 0; i < numberOfIterations; i++) 111 | { 112 | cv::cvtColor(srcIn, dstSW, CV_BGR2Luv); 113 | } 114 | timer.StopTimer(); 115 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 116 | 117 | 118 | /*-------------------------- CUDA ---------------------------------------------*/ 119 | bool ranCuda = false; 120 | cv::Mat dstCudaOnHost; 121 | 122 | #ifdef WITH_CUDA 123 | 124 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 125 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 126 | std::cout << "no Cuda devices available" << std::endl; 127 | } 128 | else 129 | { 130 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 131 | 132 | cv::cuda::GpuMat srcCuda, dstCuda; 133 | srcCuda.upload(srcIn); 134 | 135 | std::cout << "running CUDA" << std::endl; 136 | 137 | //warming up 138 | cv::cuda::cvtColor(srcCuda, dstCuda, CV_BGR2Luv); 139 | timer.StartTimer(); 140 | for (int i = 0; i < numberOfIterations; i++) 141 | { 142 | cv::cuda::cvtColor(srcCuda, dstCuda, CV_BGR2Luv); 143 | } 144 | timer.StopTimer(); 145 | dstCuda.download(dstCudaOnHost); 146 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 147 | ranCuda = true; 148 | } 149 | #endif 150 | 151 | /*-------------------------- OPENVX ---------------------------------------------*/ 152 | bool ranOpenvx = false; 153 | cv::Mat dstOpenvx; 154 | 155 | #ifdef WITH_OPENVX 156 | 157 | //create context 158 | ivx::Context context = ivx::Context::create(); 159 | 160 | //copy cv::Mat to vx_image 161 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_RGB); 162 | ivxImage.copyFrom(0, srcIn); 163 | 164 | //dst image 165 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_YUV4); 166 | 167 | //create graph 168 | ivx::Graph graph = ivx::Graph::create(context); 169 | ivx::Node::create(graph, VX_KERNEL_COLOR_CONVERT, ivxImage, ivxResult); 170 | 171 | //verify graph 172 | graph.verify(); 173 | 174 | std::cout << "running OpenVX" << std::endl; 175 | 176 | //warming up 177 | graph.process(); 178 | timer.StartTimer(); 179 | for (int i = 0; i < numberOfIterations; i++){ 180 | graph.process(); 181 | } 182 | timer.StopTimer(); 183 | //copy vx_image to cv::Mat 184 | ivxResult.copyTo(0, dstOpenvx); 185 | 186 | 187 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 188 | 189 | ranOpenvx = true; 190 | #endif 191 | 192 | /*------------- end of measurements ----------------------*/ 193 | 194 | // compare results 195 | int numberOfDifferences = 0; 196 | double errorPerPixel = 0; 197 | if (ranCuda) 198 | { 199 | std::cout << "comparing CUDA versus CPU" << std::endl; 200 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 201 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 202 | } 203 | if (ranOpenvx) 204 | { 205 | std::cout << "comparing Openvx versus CPU" << std::endl; 206 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 207 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 208 | } 209 | 210 | //show results 211 | if (imShowOn) { 212 | cv::imshow("Input image", srcIn); 213 | cv::imshow("Processed (SW)", dstSW); 214 | if (ranCuda) 215 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 216 | if (ranOpenvx) 217 | cv::imshow("Processed (Openvx)", dstOpenvx); 218 | cv::waitKey(0); 219 | } 220 | } 221 | catch (std::exception &e) 222 | { 223 | const char* errorMessage = e.what(); 224 | std::cerr << "Exception caught: " << errorMessage << std::endl; 225 | std::cout << "\nhit enter to quit..."; 226 | std::cin.get(); 227 | exit(-1); 228 | } 229 | catch (const char *e) { 230 | std::cerr << "Exception caught: " << e << std::endl; 231 | std::cout << "\nhit enter to quit..."; 232 | std::cin.get(); 233 | exit(-1); 234 | } 235 | 236 | std::cout << "\nhit enter to quit..."; 237 | std::cin.get(); 238 | return 0; 239 | } 240 | 241 | -------------------------------------------------------------------------------- /GPUTests/Image Filters/testPyrUp/src/testGPUPyrUp.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | int main(int argc, char** argv) 50 | { 51 | HRTimer timer; 52 | 53 | try { 54 | const cv::String keys = 55 | "{help h usage ? | | print this message }" 56 | "{@image | | input image }" 57 | "{goldenFile gf | | golden output image (from SW) }" 58 | "{outFile of | | output image (from PL) }" 59 | "{display d | | diplay result with imshow }" 60 | "{iterations n | 1 | number of iterations to measure time }" 61 | ; 62 | 63 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 64 | if (parser.has("help") || argc < 2) 65 | { 66 | parser.printMessage(); 67 | std::cout << "\nhit enter to quit..."; 68 | std::cin.get(); 69 | return 0; 70 | } 71 | 72 | cv::String filenameIn = parser.get(0); 73 | 74 | cv::String filenameSW; bool writeSWResult = false; 75 | if (parser.has("goldenFile")) { 76 | filenameSW = parser.get("goldenFile"); 77 | writeSWResult = true; 78 | } 79 | 80 | cv::String filenamePL; bool writePLResult = false; 81 | if (parser.has("outFile")) { 82 | filenamePL = parser.get("outFile"); 83 | writePLResult = true; 84 | } 85 | 86 | bool imShowOn = parser.has("display"); 87 | unsigned int numberOfIterations; 88 | if (parser.has("iterations")) 89 | numberOfIterations = parser.get("iterations"); 90 | 91 | if (!parser.check()) 92 | { 93 | parser.printErrors(); 94 | return(-1); 95 | } 96 | 97 | // Initialize 98 | cv::Mat srcIn, dstSW; 99 | initializeSingleGrayImageTest(filenameIn, srcIn); 100 | 101 | int width = srcIn.size().width; 102 | int height = srcIn.size().height; 103 | 104 | std::cout << "running on CPU" << std::endl; 105 | 106 | //warming up 107 | cv::pyrUp(srcIn, dstSW); 108 | 109 | timer.StartTimer(); 110 | for (int i = 0; i < numberOfIterations; i++) 111 | { 112 | cv::pyrUp(srcIn, dstSW); 113 | } 114 | timer.StopTimer(); 115 | 116 | std::cout << "Elapsed time over " << numberOfIterations << " SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 117 | 118 | /*-------------------------- CUDA ---------------------------------------------*/ 119 | bool ranCuda = false; 120 | cv::Mat dstCudaOnHost; 121 | 122 | #ifdef WITH_CUDA 123 | 124 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 125 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 126 | std::cout << "no Cuda devices available" << std::endl; 127 | } 128 | else 129 | { 130 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 131 | 132 | cv::cuda::GpuMat srcCuda, dstCuda; 133 | srcCuda.upload(srcIn); 134 | 135 | std::cout << "running CUDA" << std::endl; 136 | //warming up 137 | cv::cuda::pyrUp(srcCuda, dstCuda); 138 | 139 | timer.StartTimer(); 140 | for (int i = 0; i < numberOfIterations; i++) 141 | { 142 | cv::cuda::pyrUp(srcCuda, dstCuda); 143 | } 144 | timer.StopTimer(); 145 | 146 | dstCuda.download(dstCudaOnHost); 147 | std::cout << "Elapsed time over " << numberOfIterations << " CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 148 | ranCuda = true; 149 | } 150 | #endif 151 | 152 | /*-------------------------- OPENVX ---------------------------------------------*/ 153 | bool ranOpenvx = false; 154 | cv::Mat dstOpenvx; 155 | 156 | #ifdef WITH_OPENVX 157 | //create context 158 | ivx::Context context = ivx::Context::create(); 159 | 160 | //copy cv::Mat to vx_image 161 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 162 | ivxImage.copyFrom(0, srcIn); 163 | 164 | //dst image 165 | ivx::Image ivxResult;// = ivx::Image::create(context, 500, 500, VX_DF_IMAGE_U8); 166 | ivx::Pyramid pyramid = ivx::Pyramid::create(context, 2, VX_SCALE_PYRAMID_ORB, width, height, VX_DF_IMAGE_U8); 167 | 168 | //create graph 169 | ivx::Graph graph = ivx::Graph::create(context); 170 | ivx::Node::create(graph, VX_KERNEL_LAPLACIAN_PYRAMID, ivxImage, pyramid); 171 | 172 | 173 | std::cout << "running OpenVX" << std::endl; 174 | 175 | //warming up 176 | graph.process(); 177 | 178 | timer.StartTimer(); 179 | for (int i = 0; i < numberOfIterations; i++){ 180 | graph.process(); 181 | } 182 | timer.StopTimer(); 183 | ivxResult= pyramid.getLevel(1); 184 | //copy vx_image to cv::Mat 185 | ivxResult.copyTo(0, dstOpenvx); 186 | 187 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 188 | 189 | ranOpenvx = true; 190 | 191 | #endif 192 | 193 | /*------------- end of measurements ----------------------*/ 194 | 195 | // compare results 196 | int numberOfDifferences = 0; 197 | double errorPerPixel = 0; 198 | if (ranCuda) 199 | { 200 | std::cout << "comparing CUDA versus CPU" << std::endl; 201 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 202 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 203 | } 204 | if (ranOpenvx) 205 | { 206 | std::cout << "comparing Openvx versus CPU" << std::endl; 207 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 208 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 209 | } 210 | 211 | //show results 212 | if (imShowOn) { 213 | cv::imshow("Input image", srcIn); 214 | cv::imshow("Processed (SW)", dstSW); 215 | if (ranCuda) 216 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 217 | if (ranOpenvx) 218 | cv::imshow("Processed (Openvx)", dstOpenvx); 219 | cv::waitKey(0); 220 | } 221 | } 222 | catch (std::exception &e) 223 | { 224 | const char* errorMessage = e.what(); 225 | std::cerr << "Exception caught: " << errorMessage << std::endl; 226 | std::cout << "\nhit enter to quit..."; 227 | std::cin.get(); 228 | exit(-1); 229 | } 230 | catch (const char *e) { 231 | std::cerr << "Exception caught: " << e << std::endl; 232 | std::cout << "\nhit enter to quit..."; 233 | std::cin.get(); 234 | exit(-1); 235 | } 236 | 237 | std::cout << "\nhit enter to quit..."; 238 | std::cin.get(); 239 | return 0; 240 | } 241 | 242 | -------------------------------------------------------------------------------- /GPUTests/Geometric Transforms/testResize/src/testGPUResize.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | int main(int argc, char** argv) 50 | { 51 | HRTimer timer; 52 | 53 | try { 54 | const cv::String keys = 55 | "{help h usage ? | | print this message }" 56 | "{@image | | input image }" 57 | "{goldenFile gf | | golden output image (from SW) }" 58 | "{outFile of | | output image (from PL) }" 59 | "{display d | | diplay result with imshow }" 60 | "{iterations n | 1 | number of iterations to measure time }" 61 | ; 62 | 63 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 64 | if (parser.has("help") || argc < 2) 65 | { 66 | parser.printMessage(); 67 | std::cout << "\nhit enter to quit..."; 68 | std::cin.get(); 69 | return 0; 70 | } 71 | 72 | cv::String filenameIn = parser.get(0); 73 | 74 | cv::String filenameSW; bool writeSWResult = false; 75 | if (parser.has("goldenFile")) { 76 | filenameSW = parser.get("goldenFile"); 77 | writeSWResult = true; 78 | } 79 | 80 | cv::String filenamePL; bool writePLResult = false; 81 | if (parser.has("outFile")) { 82 | filenamePL = parser.get("outFile"); 83 | writePLResult = true; 84 | } 85 | 86 | bool imShowOn = parser.has("display"); 87 | unsigned int numberOfIterations; 88 | if (parser.has("iterations")) 89 | numberOfIterations = parser.get("iterations"); 90 | 91 | if (!parser.check()) 92 | { 93 | parser.printErrors(); 94 | return(-1); 95 | } 96 | 97 | // Initialize 98 | cv::Mat srcIn, dstSW; 99 | initializeSingleGrayImageTest(filenameIn, srcIn); 100 | 101 | int width = srcIn.size().width; 102 | int height = srcIn.size().height; 103 | 104 | std::cout << "running on CPU" << std::endl; 105 | 106 | //warming up 107 | cv::resize(srcIn, dstSW, cv::Size(2000,2000)); 108 | timer.StartTimer(); 109 | for (int i = 0; i < numberOfIterations; i++) 110 | { 111 | cv::resize(srcIn, dstSW, cv::Size(2000,2000)); 112 | } 113 | timer.StopTimer(); 114 | std::cout << "Elapsed time over " << numberOfIterations << " SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 115 | 116 | 117 | /*-------------------------- CUDA ---------------------------------------------*/ 118 | bool ranCuda = false; 119 | cv::Mat dstCudaOnHost; 120 | 121 | #ifdef WITH_CUDA 122 | 123 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 124 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 125 | std::cout << "no Cuda devices available" << std::endl; 126 | } 127 | else 128 | { 129 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 130 | 131 | cv::cuda::GpuMat srcCuda, dstCuda; 132 | srcCuda.upload(srcIn); 133 | cv::cuda::Stream stream; 134 | 135 | std::cout << "running CUDA" << std::endl; 136 | //warming up 137 | cv::cuda::resize(srcCuda, dstCuda, cv::Size(2000,2000)); 138 | timer.StartTimer(); 139 | for (int i = 0; i < numberOfIterations; i++) 140 | { 141 | cv::cuda::resize(srcCuda, dstCuda, cv::Size(2000,2000)); 142 | } 143 | timer.StopTimer(); 144 | dstCuda.download(dstCudaOnHost); 145 | std::cout << "Elapsed time over " << numberOfIterations << " CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 146 | ranCuda = true; 147 | } 148 | #endif 149 | 150 | /*-------------------------- OPENVX ---------------------------------------------*/ 151 | bool ranOpenvx = false; 152 | cv::Mat dstOpenvx; 153 | 154 | #ifdef WITH_OPENVX 155 | //create context 156 | ivx::Context context = ivx::Context::create(); 157 | 158 | //copy cv::Mat to vx_image 159 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 160 | ivxImage.copyFrom(0, srcIn); 161 | 162 | //dst image 163 | ivx::Image ivxResult = ivx::Image::create(context, 2000, 2000, VX_DF_IMAGE_U8); 164 | 165 | 166 | //create graph 167 | ivx::Graph graph = ivx::Graph::create(context); 168 | ivx::Node::create(graph, VX_KERNEL_SCALE_IMAGE, ivxImage,ivxResult, ivx::Scalar::create(context, VX_INTERPOLATION_TYPE_BILINEAR)); 169 | 170 | 171 | std::cout << "running OpenVX" << std::endl; 172 | 173 | //warming up 174 | graph.process(); 175 | timer.StartTimer(); 176 | for (int i = 0; i < numberOfIterations; i++){ 177 | graph.process(); 178 | } 179 | timer.StopTimer(); 180 | //copy vx_image to cv::Mat 181 | ivxResult.copyTo(0, dstOpenvx); 182 | 183 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 184 | 185 | ranOpenvx = true; 186 | 187 | #endif 188 | 189 | /*------------- end of measurements ----------------------*/ 190 | 191 | // compare results 192 | int numberOfDifferences = 0; 193 | double errorPerPixel = 0; 194 | if (ranCuda) 195 | { 196 | std::cout << "comparing CUDA versus CPU" << std::endl; 197 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 198 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 199 | } 200 | if (ranOpenvx) 201 | { 202 | std::cout << "comparing Openvx versus CPU" << std::endl; 203 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 204 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 205 | } 206 | 207 | //show results 208 | if (imShowOn) { 209 | cv::imshow("Input image", srcIn); 210 | cv::imshow("Processed (SW)", dstSW); 211 | if (ranCuda) 212 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 213 | if (ranOpenvx) 214 | cv::imshow("Processed (Openvx)", dstOpenvx); 215 | cv::waitKey(0); 216 | } 217 | } 218 | catch (std::exception &e) 219 | { 220 | const char* errorMessage = e.what(); 221 | std::cerr << "Exception caught: " << errorMessage << std::endl; 222 | std::cout << "\nhit enter to quit..."; 223 | std::cin.get(); 224 | exit(-1); 225 | } 226 | catch (const char *e) { 227 | std::cerr << "Exception caught: " << e << std::endl; 228 | std::cout << "\nhit enter to quit..."; 229 | std::cin.get(); 230 | exit(-1); 231 | } 232 | 233 | std::cout << "\nhit enter to quit..."; 234 | std::cin.get(); 235 | return 0; 236 | } 237 | 238 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testConvertTo/src/testGPUConvertTo.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | int width = srcIn.size().width; 102 | int height = srcIn.size().height; 103 | 104 | std::cout << "running on CPU" << std::endl; 105 | 106 | //warming up 107 | 108 | srcIn.convertTo(dstSW, CV_16S); 109 | timer.StartTimer(); 110 | for (int i = 0; i < numberOfIterations; i++) 111 | { 112 | srcIn.convertTo(dstSW, CV_16S); 113 | } 114 | timer.StopTimer(); 115 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 116 | 117 | 118 | /*-------------------------- CUDA ---------------------------------------------*/ 119 | bool ranCuda = false; 120 | cv::Mat dstCudaOnHost; 121 | 122 | #ifdef WITH_CUDA 123 | 124 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 125 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 126 | std::cout << "no Cuda devices available" << std::endl; 127 | } 128 | else 129 | { 130 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 131 | 132 | cv::cuda::GpuMat srcCuda, dstCuda; 133 | srcCuda.upload(srcIn); 134 | 135 | std::cout << "running CUDA" << std::endl; 136 | 137 | //warming up 138 | srcCuda.convertTo(dstCuda, CV_16S); 139 | timer.StartTimer(); 140 | for (int i = 0; i < numberOfIterations; i++) 141 | { 142 | srcCuda.convertTo(dstCuda, CV_16S); 143 | } 144 | timer.StopTimer(); 145 | dstCuda.download(dstCudaOnHost); 146 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 147 | ranCuda = true; 148 | } 149 | #endif 150 | 151 | /*-------------------------- OPENVX ---------------------------------------------*/ 152 | bool ranOpenvx = false; 153 | cv::Mat dstOpenvx; 154 | 155 | #ifdef WITH_OPENVX 156 | 157 | //create context 158 | ivx::Context context = ivx::Context::create(); 159 | 160 | //copy cv::Mat to vx_image 161 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 162 | ivxImage.copyFrom(0, srcIn); 163 | 164 | //dst image 165 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_S16); 166 | 167 | //create graph 168 | ivx::Graph graph = ivx::Graph::create(context); 169 | ivx::Scalar policy= ivx::Scalar::create(context, VX_CONVERT_POLICY_WRAP); 170 | 171 | ivx::Scalar shift= ivx::Scalar::create< VX_TYPE_INT32>(context, 0); 172 | 173 | ivx::Node::create(graph, VX_KERNEL_CONVERTDEPTH, ivxImage, ivxResult, policy, shift); 174 | 175 | //verify graph 176 | graph.verify(); 177 | 178 | std::cout << "running OpenVX" << std::endl; 179 | 180 | //warming up 181 | graph.process(); 182 | timer.StartTimer(); 183 | for (int i = 0; i < numberOfIterations; i++){ 184 | graph.process(); 185 | } 186 | timer.StopTimer(); 187 | //copy vx_image to cv::Mat 188 | ivxResult.copyTo(0, dstOpenvx); 189 | 190 | 191 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 192 | 193 | ranOpenvx = true; 194 | #endif 195 | 196 | /*------------- end of measurements ----------------------*/ 197 | 198 | // compare results 199 | int numberOfDifferences = 0; 200 | double errorPerPixel = 0; 201 | if (ranCuda) 202 | { 203 | std::cout << "comparing CUDA versus CPU" << std::endl; 204 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 205 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 206 | } 207 | if (ranOpenvx) 208 | { 209 | std::cout << "comparing Openvx versus CPU" << std::endl; 210 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 211 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 212 | } 213 | 214 | //show results 215 | if (imShowOn) { 216 | cv::imshow("Input image", srcIn); 217 | cv::imshow("Processed (SW)", dstSW); 218 | if (ranCuda) 219 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 220 | if (ranOpenvx) 221 | cv::imshow("Processed (Openvx)", dstOpenvx); 222 | cv::waitKey(0); 223 | } 224 | } 225 | catch (std::exception &e) 226 | { 227 | const char* errorMessage = e.what(); 228 | std::cerr << "Exception caught: " << errorMessage << std::endl; 229 | std::cout << "\nhit enter to quit..."; 230 | std::cin.get(); 231 | exit(-1); 232 | } 233 | catch (const char *e) { 234 | std::cerr << "Exception caught: " << e << std::endl; 235 | std::cout << "\nhit enter to quit..."; 236 | std::cin.get(); 237 | exit(-1); 238 | } 239 | 240 | std::cout << "\nhit enter to quit..."; 241 | std::cin.get(); 242 | return 0; 243 | } 244 | 245 | -------------------------------------------------------------------------------- /GPUTests/Image Analysis/testIntegral/src/testGPUIntegral.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include "opencv2/core.hpp" 44 | #include 45 | 46 | #include "OpenCVUtils.h" 47 | 48 | #include "opencv2/core/cuda.hpp" 49 | #include "ivx.hpp" 50 | #include 51 | 52 | int main(int argc, char** argv) 53 | { 54 | HRTimer timer; 55 | 56 | try { 57 | const cv::String keys = 58 | "{help h usage ? | | print this message }" 59 | "{@image | | input image }" 60 | "{goldenFile gf | | golden output image (from SW) }" 61 | "{outFile of | | output image (from PL) }" 62 | "{display d | | diplay result with imshow }" 63 | "{iterations n | 1 | number of iterations to measure time }" 64 | ; 65 | 66 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 67 | if (parser.has("help") || argc < 2) 68 | { 69 | parser.printMessage(); 70 | std::cout << "\nhit enter to quit..."; 71 | std::cin.get(); 72 | return 0; 73 | } 74 | 75 | cv::String filenameIn = parser.get(0); 76 | 77 | cv::String filenameSW; bool writeSWResult = false; 78 | if (parser.has("goldenFile")) { 79 | filenameSW = parser.get("goldenFile"); 80 | writeSWResult = true; 81 | } 82 | 83 | cv::String filenamePL; bool writePLResult = false; 84 | if (parser.has("outFile")) { 85 | filenamePL = parser.get("outFile"); 86 | writePLResult = true; 87 | } 88 | 89 | bool imShowOn = parser.has("display"); 90 | unsigned int numberOfIterations; 91 | if (parser.has("iterations")) 92 | numberOfIterations = parser.get("iterations"); 93 | 94 | if (!parser.check()) 95 | { 96 | parser.printErrors(); 97 | return(-1); 98 | } 99 | 100 | // Initialize 101 | cv::Mat srcIn, dstSW, dstSW_croped; 102 | initializeSingleGrayImageTest(filenameIn, srcIn); 103 | 104 | int width = srcIn.size().width; 105 | int height = srcIn.size().height; 106 | 107 | std::cout << "running on CPU" << std::endl; 108 | 109 | //warming up 110 | cv::integral(srcIn, dstSW,CV_32S); 111 | 112 | timer.StartTimer(); 113 | for (int i = 0; i < numberOfIterations; i++) 114 | { 115 | cv::integral(srcIn, dstSW, CV_32S); 116 | } 117 | timer.StopTimer(); 118 | 119 | // remove first row and col from dstCuda 120 | cv::Rect ROI =cv::Rect(1,1,width,height); 121 | dstSW_croped=dstSW(ROI); 122 | 123 | 124 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 125 | 126 | 127 | /*-------------------------- CUDA ---------------------------------------------*/ 128 | bool ranCuda = false; 129 | cv::Mat dstCudaOnHost; 130 | 131 | #ifdef WITH_CUDA 132 | 133 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 134 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 135 | std::cout << "no Cuda devices available" << std::endl; 136 | } 137 | else 138 | { 139 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 140 | 141 | cv::cuda::GpuMat srcCuda, dstCuda; 142 | srcCuda.upload(srcIn); 143 | 144 | std::cout << "running CUDA" << std::endl; 145 | cv::cuda::Stream stream; 146 | 147 | //warming up 148 | cv::cuda::integral(srcCuda, dstCuda); 149 | timer.StartTimer(); 150 | for (int i = 0; i < numberOfIterations; i++) 151 | { 152 | cv::cuda::integral(srcCuda, dstCuda); 153 | } 154 | timer.StopTimer(); 155 | 156 | dstCuda.download(dstCudaOnHost); 157 | 158 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 159 | 160 | ranCuda = true; 161 | } 162 | #endif 163 | 164 | /*-------------------------- OPENVX ---------------------------------------------*/ 165 | bool ranOpenvx = false; 166 | cv::Mat dstOpenvx; 167 | 168 | #ifdef WITH_OPENVX 169 | 170 | //create context 171 | ivx::Context context = ivx::Context::create(); 172 | 173 | //src image 174 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 175 | 176 | //dst image 177 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U32); 178 | 179 | //copy cv::Mat to vx_image 180 | ivxImage.copyFrom(0, srcIn); 181 | 182 | //create graph 183 | ivx::Graph graph = ivx::Graph::create(context); 184 | ivx::Node::create(graph, VX_KERNEL_INTEGRAL_IMAGE , ivxImage, ivxResult); 185 | 186 | std::cout << "running OpenVX" << std::endl; 187 | 188 | //warming up 189 | graph.process(); 190 | timer.StartTimer(); 191 | for (int i = 0; i < numberOfIterations; i++){ 192 | graph.process(); 193 | } 194 | timer.StopTimer(); 195 | //copy vx_image to cv::Mat 196 | ivxResult.copyTo(0, dstOpenvx); 197 | 198 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 199 | 200 | ranOpenvx = true; 201 | #endif 202 | 203 | /*------------- end of measurements ----------------------*/ 204 | 205 | // compare results 206 | int numberOfDifferences = 0; 207 | double errorPerPixel = 0; 208 | 209 | if (ranCuda) 210 | { 211 | std::cout << "comparing CUDA versus CPU" << std::endl; 212 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 213 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 214 | } 215 | if (ranOpenvx) 216 | { 217 | std::cout << "comparing Openvx versus CPU" << std::endl; 218 | imageCompare(dstOpenvx, dstSW_croped, numberOfDifferences, errorPerPixel, true, false); 219 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 220 | } 221 | 222 | //show results 223 | if (imShowOn) { 224 | cv::imshow("Input image", srcIn); 225 | cv::imshow("Processed (SW)", dstSW_croped); 226 | if (ranCuda) 227 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 228 | if (ranOpenvx) 229 | cv::imshow("Processed (Openvx)", dstOpenvx); 230 | cv::waitKey(0); 231 | } 232 | } 233 | catch (std::exception &e) 234 | { 235 | const char* errorMessage = e.what(); 236 | std::cerr << "Exception caught: " << errorMessage << std::endl; 237 | std::cout << "\nhit enter to quit..."; 238 | std::cin.get(); 239 | exit(-1); 240 | } 241 | catch (const char *e) { 242 | std::cerr << "Exception caught: " << e << std::endl; 243 | std::cout << "\nhit enter to quit..."; 244 | std::cin.get(); 245 | exit(-1); 246 | } 247 | 248 | std::cout << "\nhit enter to quit..."; 249 | std::cin.get(); 250 | return 0; 251 | } 252 | 253 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testExtract/src/testGPUSplit.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, srcInRGB, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | cv::cvtColor(srcIn,srcInRGB, cv::COLOR_GRAY2RGB); 102 | 103 | int width = srcIn.size().width; 104 | int height = srcIn.size().height; 105 | 106 | std::vector channelsSW; 107 | 108 | std::cout << "running on CPU" << std::endl; 109 | 110 | //warming up 111 | cv::split(srcInRGB, channelsSW); 112 | timer.StartTimer(); 113 | for (int i = 0; i < numberOfIterations; i++) 114 | { 115 | cv::split(srcInRGB, channelsSW); 116 | } 117 | timer.StopTimer(); 118 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 119 | 120 | dstSW=channelsSW[0]; //assign first channel 121 | 122 | /*-------------------------- CUDA ---------------------------------------------*/ 123 | bool ranCuda = false; 124 | cv::Mat dstCudaOnHost; 125 | 126 | #ifdef WITH_CUDA 127 | 128 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 129 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 130 | std::cout << "no Cuda devices available" << std::endl; 131 | } 132 | else 133 | { 134 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 135 | 136 | cv::cuda::GpuMat srcCuda; 137 | srcCuda.upload(srcInRGB); 138 | 139 | std::vector channelsCuda; 140 | 141 | std::cout << "running CUDA" << std::endl; 142 | //warming up 143 | cv::cuda::split(srcCuda, channelsCuda); 144 | timer.StartTimer(); 145 | for (int i = 0; i < numberOfIterations; i++) 146 | { 147 | cv::cuda::split(srcCuda, channelsCuda); 148 | } 149 | timer.StopTimer(); 150 | channelsCuda[0].download(dstCudaOnHost); 151 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 152 | ranCuda = true; 153 | } 154 | #endif 155 | 156 | /*-------------------------- OPENVX ---------------------------------------------*/ 157 | bool ranOpenvx = false; 158 | cv::Mat dstOpenvx; 159 | 160 | #ifdef WITH_OPENVX 161 | //create context 162 | ivx::Context context = ivx::Context::create(); 163 | 164 | //copy cv::Mat to vx_image 165 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_RGB); 166 | ivxImage.copyFrom(0, srcInRGB); 167 | 168 | //dst image 169 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 170 | 171 | //create graph 172 | ivx::Graph graph = ivx::Graph::create(context); 173 | 174 | ivx::Node::create(graph, VX_KERNEL_CHANNEL_EXTRACT, ivxImage, ivx::Scalar::create(context, VX_CHANNEL_R), ivxResult); 175 | 176 | //verify graph 177 | graph.verify(); 178 | 179 | std::cout << "running OpenVX" << std::endl; 180 | 181 | //warming up 182 | graph.process(); 183 | timer.StartTimer(); 184 | for (int i = 0; i < numberOfIterations; i++){ 185 | graph.process(); 186 | } 187 | timer.StopTimer(); 188 | //copy vx_image to cv::Mat 189 | ivxResult.copyTo(0, dstOpenvx); 190 | 191 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 192 | 193 | ranOpenvx = true; 194 | 195 | 196 | #endif 197 | 198 | /*------------- end of measurements ----------------------*/ 199 | 200 | // compare results 201 | int numberOfDifferences = 0; 202 | double errorPerPixel = 0; 203 | if (ranCuda) 204 | { 205 | std::cout << "comparing CUDA versus CPU" << std::endl; 206 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 207 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 208 | } 209 | if (ranOpenvx) 210 | { 211 | std::cout << "comparing Openvx versus CPU" << std::endl; 212 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 213 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 214 | } 215 | 216 | //show results 217 | if (imShowOn) { 218 | cv::imshow("Input image", srcIn); 219 | cv::imshow("Processed (SW)", dstSW); 220 | if (ranCuda) 221 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 222 | if (ranOpenvx) 223 | cv::imshow("Processed (Openvx)", dstOpenvx); 224 | cv::waitKey(0); 225 | } 226 | } 227 | catch (std::exception &e) 228 | { 229 | const char* errorMessage = e.what(); 230 | std::cerr << "Exception caught: " << errorMessage << std::endl; 231 | std::cout << "\nhit enter to quit..."; 232 | std::cin.get(); 233 | exit(-1); 234 | } 235 | catch (const char *e) { 236 | std::cerr << "Exception caught: " << e << std::endl; 237 | std::cout << "\nhit enter to quit..."; 238 | std::cin.get(); 239 | exit(-1); 240 | } 241 | 242 | std::cout << "\nhit enter to quit..."; 243 | std::cin.get(); 244 | return 0; 245 | } 246 | 247 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testAccumulate/src/testGPUAccumulate.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | 47 | #include "opencv2/core/cuda.hpp" 48 | #include "ivx.hpp" 49 | #include 50 | 51 | int main(int argc, char** argv) 52 | { 53 | HRTimer timer; 54 | 55 | try { 56 | const cv::String keys = 57 | "{help h usage ? | | print this message }" 58 | "{@image | | input image }" 59 | "{goldenFile gf | | golden output image (from SW) }" 60 | "{outFile of | | output image (from PL) }" 61 | "{display d | | diplay result with imshow }" 62 | "{iterations n | 1 | number of iterations to measure time }" 63 | ; 64 | 65 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 66 | if (parser.has("help") || argc < 2) 67 | { 68 | parser.printMessage(); 69 | std::cout << "\nhit enter to quit..."; 70 | std::cin.get(); 71 | return 0; 72 | } 73 | 74 | cv::String filenameIn = parser.get(0); 75 | 76 | cv::String filenameSW; bool writeSWResult = false; 77 | if (parser.has("goldenFile")) { 78 | filenameSW = parser.get("goldenFile"); 79 | writeSWResult = true; 80 | } 81 | 82 | cv::String filenamePL; bool writePLResult = false; 83 | if (parser.has("outFile")) { 84 | filenamePL = parser.get("outFile"); 85 | writePLResult = true; 86 | } 87 | 88 | bool imShowOn = parser.has("display"); 89 | unsigned int numberOfIterations; 90 | if (parser.has("iterations")) 91 | numberOfIterations = parser.get("iterations"); 92 | 93 | if (!parser.check()) 94 | { 95 | parser.printErrors(); 96 | return(-1); 97 | } 98 | 99 | // Initialize 100 | cv::Mat srcIn; 101 | initializeSingleGrayImageTest(filenameIn, srcIn); 102 | 103 | int width = srcIn.size().width; 104 | int height = srcIn.size().height; 105 | 106 | cv::Mat dstSW= cv::Mat::zeros(height, width,CV_32F); 107 | 108 | std::cout << "running on CPU" << std::endl; 109 | 110 | //warming up 111 | cv::accumulate(srcIn, dstSW); 112 | timer.StartTimer(); 113 | for (int i = 0; i < numberOfIterations; i++) 114 | { 115 | cv::accumulate(srcIn, dstSW); 116 | } 117 | timer.StopTimer(); 118 | std::cout << "Elapsed time over " << numberOfIterations << " SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 119 | 120 | 121 | /*-------------------------- CUDA ---------------------------------------------*/ 122 | bool ranCuda = false; 123 | cv::Mat dstCudaOnHost; 124 | 125 | #ifdef WITH_CUDA 126 | 127 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 128 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 129 | std::cout << "no Cuda devices available" << std::endl; 130 | } 131 | else 132 | { 133 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 134 | // src Cuda 135 | srcIn.convertTo(srcIn, CV_32F); 136 | cv::cuda::GpuMat srcCuda(height, width, CV_32F); 137 | srcCuda.upload(srcIn); 138 | 139 | // dst Cuda 140 | cv::cuda::GpuMat dstCuda(height, width, CV_32F); 141 | dstCuda.setTo(cv::Scalar::all(0)); 142 | std::cout << "running CUDA" << std::endl; 143 | //warming up 144 | cv::cuda::add(srcCuda, dstCuda, dstCuda); // cv::cuda module doesnt have accumulate function 145 | 146 | timer.StartTimer(); 147 | for (int i = 0; i < numberOfIterations; i++) 148 | { 149 | cv::cuda::add(srcCuda, dstCuda, dstCuda); 150 | } 151 | timer.StopTimer(); 152 | dstCuda.download(dstCudaOnHost); 153 | dstCudaOnHost.convertTo(dstCudaOnHost, CV_32F); 154 | std::cout << "Elapsed time over " << numberOfIterations << " CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 155 | ranCuda = true; 156 | } 157 | #endif 158 | 159 | /*-------------------------- OPENVX ---------------------------------------------*/ 160 | bool ranOpenvx = false; 161 | cv::Mat dstOpenvx; 162 | 163 | #ifdef WITH_OPENVX 164 | 165 | //create context 166 | ivx::Context context = ivx::Context::create(); 167 | 168 | //copy cv::Mat to vx_image 169 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 170 | ivxImage.copyFrom(0, srcIn); 171 | 172 | //dst image 173 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_S16); 174 | ivxResult.copyFrom(0, cv::Mat::zeros(height,width,CV_16S)); 175 | 176 | //create graph 177 | ivx::Graph graph = ivx::Graph::create(context); 178 | ivx::Node::create(graph,VX_KERNEL_ACCUMULATE, ivxImage, ivxResult); 179 | 180 | graph.verify(); 181 | 182 | std::cout << "running OpenVX" << std::endl; 183 | 184 | //warming up 185 | graph.process(); 186 | timer.StartTimer(); 187 | for (int i = 0; i < numberOfIterations; i++){ 188 | graph.process(); 189 | } 190 | timer.StopTimer(); 191 | //copy vx_image to cv::Mat 192 | ivxResult.copyTo(0, dstOpenvx); 193 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 194 | 195 | ranOpenvx = true; 196 | dstOpenvx.convertTo(dstOpenvx, CV_32F); 197 | #endif 198 | 199 | /*------------- end of measurements ----------------------*/ 200 | 201 | // compare results 202 | int numberOfDifferences = 0; 203 | double errorPerPixel = 0; 204 | if (ranCuda) 205 | { 206 | std::cout << "comparing CUDA versus CPU" << std::endl; 207 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 208 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 209 | } 210 | if (ranOpenvx) 211 | { 212 | std::cout << "comparing Openvx versus CPU" << std::endl; 213 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 214 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 215 | } 216 | 217 | //show results 218 | if (imShowOn) { 219 | cv::imshow("Input image", srcIn); 220 | cv::imshow("Processed (SW)", dstSW); 221 | if (ranCuda) 222 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 223 | if (ranOpenvx) 224 | cv::imshow("Processed (Openvx)", dstOpenvx); 225 | cv::waitKey(0); 226 | } 227 | } 228 | catch (std::exception &e) 229 | { 230 | const char* errorMessage = e.what(); 231 | std::cerr << "Exception caught: " << errorMessage << std::endl; 232 | std::cout << "\nhit enter to quit..."; 233 | std::cin.get(); 234 | exit(-1); 235 | } 236 | catch (const char *e) { 237 | std::cerr << "Exception caught: " << e << std::endl; 238 | std::cout << "\nhit enter to quit..."; 239 | std::cin.get(); 240 | exit(-1); 241 | } 242 | 243 | std::cout << "\nhit enter to quit..."; 244 | std::cin.get(); 245 | return 0; 246 | } 247 | 248 | -------------------------------------------------------------------------------- /GPUTests/Input Processing/testLUT/src/testGPULUT.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, srcInRGB, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | // color reduction lookup table 106 | cv::Mat lookUpTable(1, 256, CV_8U); 107 | uchar* p = lookUpTable.data; 108 | for( int i = 0; i < 256; ++i) 109 | p[i] = 16 * (i/16); 110 | 111 | std::cout << "running on CPU" << std::endl; 112 | 113 | //warming up 114 | cv::LUT(srcIn, lookUpTable, dstSW); 115 | timer.StartTimer(); 116 | for (int i = 0; i < numberOfIterations; i++) 117 | { 118 | cv::LUT(srcIn, lookUpTable, dstSW); 119 | } 120 | timer.StopTimer(); 121 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 122 | 123 | 124 | 125 | /*-------------------------- CUDA ---------------------------------------------*/ 126 | bool ranCuda = false; 127 | cv::Mat dstCudaOnHost; 128 | 129 | #ifdef WITH_CUDA 130 | 131 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 132 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 133 | std::cout << "no Cuda devices available" << std::endl; 134 | } 135 | else 136 | { 137 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 138 | 139 | cv::cuda::GpuMat srcCuda, dstCuda; 140 | srcCuda.upload(srcIn); 141 | 142 | cv::Ptr LUTCuda = cv::cuda::createLookUpTable(lookUpTable); 143 | 144 | std::cout << "running CUDA" << std::endl; 145 | //warming up 146 | LUTCuda->transform(srcCuda, dstCuda); 147 | timer.StartTimer(); 148 | for (int i = 0; i < numberOfIterations; i++) 149 | { 150 | LUTCuda->transform(srcCuda, dstCuda); 151 | } 152 | timer.StopTimer(); 153 | dstCuda.download(dstCudaOnHost); 154 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 155 | ranCuda = true; 156 | } 157 | #endif 158 | 159 | /*-------------------------- OPENVX ---------------------------------------------*/ 160 | bool ranOpenvx = false; 161 | cv::Mat dstOpenvx; 162 | 163 | #ifdef WITH_OPENVX 164 | //create context 165 | ivx::Context context = ivx::Context::create(); 166 | 167 | //copy cv::Mat to vx_image 168 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 169 | ivxImage.copyFrom(0, srcIn); 170 | 171 | //dst image 172 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 173 | ivx::LUT LUTOpenVX=ivx::LUT::create(context); 174 | LUTOpenVX.copyFrom(lookUpTable); 175 | //create graph 176 | ivx::Graph graph = ivx::Graph::create(context); 177 | 178 | ivx::Node::create(graph, VX_KERNEL_TABLE_LOOKUP, ivxImage,LUTOpenVX, ivxResult); 179 | 180 | //verify graph 181 | graph.verify(); 182 | 183 | std::cout << "running OpenVX" << std::endl; 184 | 185 | //warming up 186 | graph.process(); 187 | timer.StartTimer(); 188 | for (int i = 0; i < numberOfIterations; i++){ 189 | graph.process(); 190 | } 191 | timer.StopTimer(); 192 | //copy vx_image to cv::Mat 193 | ivxResult.copyTo(0, dstOpenvx); 194 | 195 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 196 | 197 | ranOpenvx = true; 198 | 199 | 200 | #endif 201 | 202 | /*------------- end of measurements ----------------------*/ 203 | 204 | // compare results 205 | int numberOfDifferences = 0; 206 | double errorPerPixel = 0; 207 | 208 | if (ranCuda) 209 | { 210 | std::cout << "comparing CUDA versus CPU" << std::endl; 211 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 212 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 213 | } 214 | if (ranOpenvx) 215 | { 216 | std::cout << "comparing Openvx versus CPU" << std::endl; 217 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 218 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 219 | } 220 | 221 | //show results 222 | if (imShowOn) { 223 | cv::imshow("Input image", srcIn); 224 | cv::imshow("Processed (SW)", dstSW); 225 | if (ranCuda) 226 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 227 | if (ranOpenvx) 228 | cv::imshow("Processed (Openvx)", dstOpenvx); 229 | cv::waitKey(0); 230 | } 231 | } 232 | catch (std::exception &e) 233 | { 234 | const char* errorMessage = e.what(); 235 | std::cerr << "Exception caught: " << errorMessage << std::endl; 236 | std::cout << "\nhit enter to quit..."; 237 | std::cin.get(); 238 | exit(-1); 239 | } 240 | catch (const char *e) { 241 | std::cerr << "Exception caught: " << e << std::endl; 242 | std::cout << "\nhit enter to quit..."; 243 | std::cin.get(); 244 | exit(-1); 245 | } 246 | 247 | std::cout << "\nhit enter to quit..."; 248 | std::cin.get(); 249 | return 0; 250 | } 251 | 252 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testPhase/src/testGPUPhase.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, gx, gy, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | //compute gradient in x and y directions 106 | cv::Sobel(srcIn, gx, CV_32F, 1, 0, 3); 107 | cv::Sobel(srcIn, gy, CV_32F, 0, 1, 3); 108 | 109 | std::cout << "running on CPU" << std::endl; 110 | 111 | //warming up 112 | cv::phase(gx, gy, dstSW, true); // inDegree=true 113 | 114 | timer.StartTimer(); 115 | for (int i = 0; i < numberOfIterations; i++) 116 | { 117 | cv::phase(gx, gy, dstSW, true); // inDegree=true 118 | } 119 | timer.StopTimer(); 120 | 121 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 122 | 123 | 124 | /*-------------------------- CUDA ---------------------------------------------*/ 125 | bool ranCuda = false; 126 | cv::Mat dstCudaOnHost; 127 | 128 | #ifdef WITH_CUDA 129 | 130 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 131 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 132 | std::cout << "no Cuda devices available" << std::endl; 133 | } 134 | else 135 | { 136 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 137 | 138 | cv::cuda::GpuMat srcCuda1, srcCuda2, dstCuda; 139 | srcCuda1.upload(gx); 140 | srcCuda2.upload(gy); 141 | 142 | std::cout << "running CUDA" << std::endl; 143 | //warming up 144 | cv::cuda::phase(srcCuda1, srcCuda2, dstCuda, true); // inDegree=true 145 | 146 | timer.StartTimer(); 147 | for (int i = 0; i < numberOfIterations; i++) 148 | { 149 | cv::cuda::phase(srcCuda1, srcCuda2, dstCuda, true); // inDegree=true 150 | } 151 | timer.StopTimer(); 152 | 153 | dstCuda.download(dstCudaOnHost); 154 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 155 | ranCuda = true; 156 | } 157 | #endif 158 | 159 | /*-------------------------- OPENVX ---------------------------------------------*/ 160 | bool ranOpenvx = false; 161 | cv::Mat dstOpenvx; 162 | 163 | #ifdef WITH_OPENVX 164 | //create context 165 | ivx::Context context = ivx::Context::create(); 166 | 167 | //copy cv::Mat to vx_image 168 | ivx::Image ivxImage1 = ivx::Image::create(context, width, height, VX_DF_IMAGE_S16); 169 | ivxImage1.copyFrom(0, gx); 170 | 171 | ivx::Image ivxImage2 = ivx::Image::create(context, width, height, VX_DF_IMAGE_S16); 172 | ivxImage2.copyFrom(0, gy); 173 | 174 | //dst image 175 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 176 | 177 | //create graph 178 | ivx::Graph graph = ivx::Graph::create(context); 179 | ivx::Node::create(graph, VX_KERNEL_PHASE, ivxImage1, ivxImage2, ivxResult); 180 | 181 | std::cout << "running OpenVX" << std::endl; 182 | 183 | //warming up 184 | graph.process(); 185 | 186 | timer.StartTimer(); 187 | for (int i = 0; i < numberOfIterations; i++){ 188 | graph.process(); 189 | } 190 | timer.StopTimer(); 191 | 192 | //copy vx_image to cv::Mat 193 | ivxResult.copyTo(0, dstOpenvx); 194 | 195 | dstOpenvx.convertTo(dstOpenvx, CV_32F); 196 | 197 | std::cout << "Elapsed time over " << numberOfIterations << " OpenVX call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 198 | 199 | ranOpenvx = true; 200 | 201 | #endif 202 | 203 | /*------------- end of measurements ----------------------*/ 204 | 205 | // compare results 206 | int numberOfDifferences = 0; 207 | double errorPerPixel = 0; 208 | if (ranCuda) 209 | { 210 | std::cout << "comparing CUDA versus CPU" << std::endl; 211 | imageCompare(dstCudaOnHost, dstSW, numberOfDifferences, errorPerPixel, true, false); 212 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 213 | } 214 | if (ranOpenvx) 215 | { 216 | std::cout << "comparing Openvx versus CPU" << std::endl; 217 | imageCompare(dstOpenvx, dstSW, numberOfDifferences, errorPerPixel, true, false); 218 | std::cout << "number of differences: " << numberOfDifferences << " average error per pixel: " << errorPerPixel << std::endl; 219 | } 220 | 221 | //show results 222 | if (imShowOn) { 223 | cv::imshow("Input image", srcIn); 224 | cv::imshow("Processed (SW)", dstSW); 225 | if (ranCuda) 226 | cv::imshow("Processed (CUDA)", dstCudaOnHost); 227 | if (ranOpenvx) 228 | cv::imshow("Processed (Openvx)", dstOpenvx); 229 | cv::waitKey(0); 230 | } 231 | } 232 | catch (std::exception &e) 233 | { 234 | const char* errorMessage = e.what(); 235 | std::cerr << "Exception caught: " << errorMessage << std::endl; 236 | std::cout << "\nhit enter to quit..."; 237 | std::cin.get(); 238 | exit(-1); 239 | } 240 | catch (const char *e) { 241 | std::cerr << "Exception caught: " << e << std::endl; 242 | std::cout << "\nhit enter to quit..."; 243 | std::cin.get(); 244 | exit(-1); 245 | } 246 | 247 | std::cout << "\nhit enter to quit..."; 248 | std::cin.get(); 249 | return 0; 250 | } 251 | 252 | -------------------------------------------------------------------------------- /GPUTests/Image Arithmatic/testThreshold/src/testGPUThreshold.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * Copyright (c) 2019 Iowa State University 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1.Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2.Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3.Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * (c) Copyright 2019 Iowa State University. 32 | * All rights reserved. 33 | * 34 | * Author: Murad Qasaimeh 35 | * Date: 2018/03/27 36 | *****************************************************************************/ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "opencv2/core.hpp" 43 | #include 44 | 45 | #include "OpenCVUtils.h" 46 | #include "opencv2/core/cuda.hpp" 47 | #include "ivx.hpp" 48 | #include 49 | 50 | int main(int argc, char** argv) 51 | { 52 | HRTimer timer; 53 | 54 | try { 55 | const cv::String keys = 56 | "{help h usage ? | | print this message }" 57 | "{@image | | input image }" 58 | "{goldenFile gf | | golden output image (from SW) }" 59 | "{outFile of | | output image (from PL) }" 60 | "{display d | | diplay result with imshow }" 61 | "{iterations n | 1 | number of iterations to measure time }" 62 | ; 63 | 64 | cv::CommandLineParser parser(argc, argv, keys.c_str()); 65 | if (parser.has("help") || argc < 2) 66 | { 67 | parser.printMessage(); 68 | std::cout << "\nhit enter to quit..."; 69 | std::cin.get(); 70 | return 0; 71 | } 72 | 73 | cv::String filenameIn = parser.get(0); 74 | 75 | cv::String filenameSW; bool writeSWResult = false; 76 | if (parser.has("goldenFile")) { 77 | filenameSW = parser.get("goldenFile"); 78 | writeSWResult = true; 79 | } 80 | 81 | cv::String filenamePL; bool writePLResult = false; 82 | if (parser.has("outFile")) { 83 | filenamePL = parser.get("outFile"); 84 | writePLResult = true; 85 | } 86 | 87 | bool imShowOn = parser.has("display"); 88 | unsigned int numberOfIterations; 89 | if (parser.has("iterations")) 90 | numberOfIterations = parser.get("iterations"); 91 | 92 | if (!parser.check()) 93 | { 94 | parser.printErrors(); 95 | return(-1); 96 | } 97 | 98 | // Initialize 99 | cv::Mat srcIn, dstSW; 100 | initializeSingleGrayImageTest(filenameIn, srcIn); 101 | 102 | int width = srcIn.size().width; 103 | int height = srcIn.size().height; 104 | 105 | // Thresholding to convert srcIn image into binary image (black/white) 106 | int maxValue=255; 107 | int thresh= 125; 108 | 109 | std::cout << "running on CPU" << std::endl; 110 | 111 | //warming up 112 | cv::threshold(srcIn, dstSW, thresh, maxValue, cv::THRESH_BINARY); 113 | 114 | timer.StartTimer(); 115 | for (int i = 0; i < numberOfIterations; i++) 116 | { 117 | cv::threshold(srcIn, dstSW, thresh, maxValue, cv::THRESH_BINARY); 118 | } 119 | timer.StopTimer(); 120 | 121 | std::cout << "Elapsed time over " << numberOfIterations << "SW call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 122 | 123 | 124 | /*-------------------------- CUDA ---------------------------------------------*/ 125 | bool ranCuda = false; 126 | cv::Mat dstCudaOnHost; 127 | 128 | #ifdef WITH_CUDA 129 | 130 | std::cout << "CUDA gpu device count: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; 131 | if (cv::cuda::getCudaEnabledDeviceCount() < 1) { 132 | std::cout << "no Cuda devices available" << std::endl; 133 | } 134 | else 135 | { 136 | cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 137 | 138 | cv::cuda::GpuMat srcCuda, dstCuda; 139 | srcCuda.upload(srcIn); 140 | 141 | std::cout << "running CUDA" << std::endl; 142 | //warming up 143 | cv::cuda::threshold(srcCuda, dstCuda, thresh, maxValue, cv::THRESH_BINARY); 144 | 145 | timer.StartTimer(); 146 | for (int i = 0; i < numberOfIterations; i++) 147 | { 148 | cv::cuda::threshold(srcCuda, dstCuda, thresh, maxValue, cv::THRESH_BINARY); 149 | } 150 | timer.StopTimer(); 151 | 152 | 153 | dstCuda.download(dstCudaOnHost); 154 | std::cout << "Elapsed time over " << numberOfIterations << "CUDA call(s): " << timer.GetElapsedUs() << " us or " << (float)timer.GetElapsedUs() / (float)numberOfIterations << "us per frame" << std::endl; 155 | ranCuda = true; 156 | } 157 | #endif 158 | 159 | /*-------------------------- OPENVX ---------------------------------------------*/ 160 | bool ranOpenvx = false; 161 | cv::Mat dstOpenvx; 162 | 163 | #ifdef WITH_OPENVX 164 | //create context 165 | ivx::Context context = ivx::Context::create(); 166 | 167 | //copy cv::Mat to vx_image 168 | ivx::Image ivxImage = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 169 | 170 | ivxImage.copyFrom(0, srcIn); 171 | 172 | //dst image 173 | ivx::Image ivxResult = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8); 174 | 175 | //create graph 176 | ivx::Graph graph = ivx::Graph::create(context); 177 | ivx::Threshold threshold= ivx::Threshold::createRange(context,VX_TYPE_UINT8, thresh, maxValue); 178 | ivx::Node::create(graph, VX_KERNEL_THRESHOLD, ivxImage, threshold, ivxResult); 179 | 180 | std::cout << "running OpenVX" << std::endl; 181 | 182 | //warming up 183 | graph.process(); 184 | 185 | timer.StartTimer(); 186 | for (int i = 0; i < numberOfIterations; i++){ 187 | graph.process(); 188 | } 189 | timer.StopTimer(); 190 | std::cout<<"timeStamp OpenVX ends:\t"<