Commit 415eb692 authored by Matt Clarkson's avatar Matt Clarkson

Add arrayfire_opencv interop.

parent 3ff497c9
......@@ -4,3 +4,6 @@
[submodule "Code/Lib/PythonBoost/pyboostcvconverter"]
path = Code/PythonBoost/pyboostcvconverter
url = https://github.com/Algomorph/pyboostcvconverter.git
[submodule "Code/Lib/arrayfire_opencv"]
path = Code/Lib/arrayfire_opencv
url = https://github.com/arrayfire-community/arrayfire_opencv
......@@ -79,8 +79,8 @@ if(NOT DEFINED OpenCV_DIR)
-DBUILD_opencv_features2d:BOOL=ON
-DBUILD_opencv_flann:BOOL=ON
-DBUILD_opencv_gapi:BOOL=OFF
-DBUILD_opencv_highgui:BOOL=OFF
-DBUILD_opencv_imgcodecs:BOOL=OFF
-DBUILD_opencv_highgui:BOOL=ON
-DBUILD_opencv_imgcodecs:BOOL=ON
-DBUILD_opencv_java_bindings_generator:BOOL=OFF
-DBUILD_opencv_js:BOOL=OFF
-DBUILD_opencv_ml:BOOL=OFF
......@@ -90,8 +90,8 @@ if(NOT DEFINED OpenCV_DIR)
-DBUILD_opencv_python_bindings_generator:BOOL=OFF
-DBUILD_opencv_stitching:BOOL=OFF
-DBUILD_opencv_ts:BOOL=OFF
-DBUILD_opencv_video:BOOL=OFF
-DBUILD_opencv_videoio:BOOL=OFF
-DBUILD_opencv_video:BOOL=ON
-DBUILD_opencv_videoio:BOOL=ON
-DBUILD_opencv_world:BOOL=OFF
)
else()
......
......@@ -18,10 +18,15 @@ set(SKSURGERYGPUCPP_LIBRARY_SRCS
sksBasicTypes.cpp
sksMyFunctions.cpp
sksException.cpp
arrayfire_opencv/af_cv.cpp
sksFourierTransform.cpp
)
include_directories(arrayfire_opencv)
set(SKSURGERYGPUCPP_LIBRARY_HDRS
sksExceptionMacro.h
arrayfire_opencv/af_cv.hpp
)
add_library(${SKSURGERYGPUCPP_LIBRARY_NAME} ${SKSURGERYGPUCPP_LIBRARY_HDRS} ${SKSURGERYGPUCPP_LIBRARY_SRCS})
......
Subproject commit 2d933f909484e150d99f912f6d5aeaec4fe9e428
/*=============================================================================
SKSURGERYGPUCPP: Image-guided surgery functions, in C++, using GPU.
Copyright (c) University College London (UCL). All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
See LICENSE.txt in the top level directory for details.
=============================================================================*/
#include "sksFourierTransform.h"
#include <af_cv.hpp>
#include <iostream>
namespace sks {
//-----------------------------------------------------------------------------
void FourierTransform(const cv::Mat& input, cv::Mat& output)
{
// Do some validation.
// Is output image meant to be float etc.
// Force user to pass right image types in.
af::array imageAsArrayFire = mat_to_array(input);
// Do FFT
array_to_mat(imageAsArrayFire, output, CV_32F, true);
}
//-----------------------------------------------------------------------------
void InverseFourierTransform(const cv::Mat& input, cv::Mat& output)
{
// Do some validation.
// Is output image meant to be float etc.
// Force user to pass right image types in.
af::array imageAsArrayFire = mat_to_array(input);
// Do iFFT
array_to_mat(imageAsArrayFire, output, CV_32F, true);
}
} // end namespace
/*=============================================================================
SKSURGERYGPUCPP: Image-guided surgery functions, in C++, using GPU.
Copyright (c) University College London (UCL). All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
See LICENSE.txt in the top level directory for details.
=============================================================================*/
#ifndef sksFourierTransform_h
#define sksFourierTransform_h
#include <opencv2/core.hpp>
#include "sksWin32ExportHeader.h"
/**
* \file sksFourierTransform.h
* \brief Fourier and inverse Fourier Transforms.
* \ingroup imaging
*/
namespace sks
{
/**
* \brief Computes the Fourier transform of the input image.
*/
SKSURGERYGPUCPP_WINEXPORT void FourierTransform(const cv::Mat& input, cv::Mat& output);
/**
* \brief Computes the inverse Fourier transform of the input image.
*/
SKSURGERYGPUCPP_WINEXPORT void InverseFourierTransform(const cv::Mat& input, cv::Mat& output);
} // end namespace
#endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment