Skip to content

GPU implementation of a Full Search Block Matching Motion Estimation Algorithm

License

Notifications You must be signed in to change notification settings

RaymondCM/UOL-FinalYearProject

Repository files navigation

ParallelCardiacImaging

Presented is a GPU implementation of a Full Search Block Matching Motion Estimation algorithm using sum of absolute difference error criterion and a novel criterion to find optimal block displacement, and to estimate the heart rate of apical four chamber view ultrasound images. With the rapid growth of GPU processing power in recent years an effective deployment medium for parallelisation of traditionally serial algorithms exists. This project will attempt to evaluate the feasibility of using heterogeneous systems for motion estimation by comparing algorithm execution times and accuracy on the CPU and GPU. This thesis concludes by showing the GPU implementation is sufficiently fast enough for real-time processing and can shorten computation time of accurate heart rate estimates by a factor of 450 times (Link).

Execution

You can run the software in two different modes, ROI selection and fullscreen. ROI selection mode will prompt the user to select a region for analysis and the fullscreen mode will perform analysis on the whole image. This property can be changed by setting the set_roi flag to true in main.cpp. Below are two examples of the modes, the fullscreen mode also demonstrates motion vector plotting and HSV plotting.

Fullscreen

Fullscreen

ROI Selection

ROI Selection

Dependencies

DCMTK

Instructions below for Ubuntu 14.04, the stable release has compiler issues so a snapshot from GitHub is used.

wget http://git.dcmtk.org/?p=dcmtk.git;a=snapshot;h=681e3182ccfe3873b95824b07a4565c8b54a8a18;sf=tgz
tar xzvf index.html\?p=dcmtk.git\;a=snapshot\;h=681e3182ccfe3873b95824b07a4565c8b54a8a18\;sf=tgz
cmake-gui & #Configure and Generate make files to build_folder
cd build_folder
cmake --build .
make #(Optional?)
sudo make install

OpenCV

Windows

Follow instructions at RaymondKirk/OpenCV-InstallScript or download the OpenCV source and build with cmake (See instructions below). Build the binaries for debug and release to "C:/OpenCV/build" with OPENCL. Build INSTALL to produce system headers and dynamic linked libraries. Add a system environment variable to the installed OpenCV_DIR (C:\OpenCV\build\install\x86\vc15 for Visual Studio 15 2017). Finally add a variable to system PATH (%OpenCV_DIR%/bin). See OpenCV documentation for guidelines and resources.

To build use CMake-GUI with these options WITH_CUDA=0, WITH_OPENCL=1 and BUILD_opencv_java=0. Optionally add both python interpreters.

cmake -H./ -BC:/OpenCV/build/ -G "Visual Studio 15 2017" -DWITH_CUDA=0 -DWITH_OPENCL=1 -DBUILD_opencv_java=0 #USE CMake-GUI

To set environment variables to installed location.

setx -m OpenCV_DIR C:\OpenCV\build\install\x86\vc15
setx -m PATH=%PATH%;%OpenCV_DIR%\bin

When compiling add -DCMAKE_PREFIX_PATH=C:\OpenCV\build\install for ProjectY3 target when OpenCV cannot be found.

Linux (Ubuntu)

For OSX/Linux download the C++ Source and run the following commands to install under usr/local, replace opencv_downloaded_source with the source location. For other platforms instructions can be found on imebra docs

cd opencv_downloaded_source
mkdir opencv_bin
cd opencv_bin
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

OpenCV dependencies (ubuntu) listed below.

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

OpenCL

OSX

C++ bindings not included by default with OpenCL, download and include them.

Compile

On ubuntu from project root run cmake -H./ -B./build or use CMake for VSCode.

To execute the program type the following code from the root of the file structure.

cd build/
make clean #OPTIONAL
make ProjectY3
./ProjectY3

About

GPU implementation of a Full Search Block Matching Motion Estimation Algorithm

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published