mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
cleaned up super_resolution sample from old OCL
This commit is contained in:
parent
c7fe162829
commit
2e8579fe9b
100
.project
100
.project
@ -1,100 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>opencv</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
|
||||||
<triggers>clean,full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
<dictionary>
|
|
||||||
<key>?children?</key>
|
|
||||||
<value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\||</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>?name?</key>
|
|
||||||
<value></value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
|
||||||
<value>true</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
|
||||||
<value>all</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
|
||||||
<value></value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
|
||||||
<value>make</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
|
||||||
<value>/home/ilya/Documents/Programming/Builds/opencv_debug/bin</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
|
||||||
<value>clean</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.contents</key>
|
|
||||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
|
||||||
<value>false</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
|
||||||
<value>true</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
|
||||||
<value>true</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
|
||||||
<value>all</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
|
||||||
<value>true</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
|
||||||
<value>true</value>
|
|
||||||
</dictionary>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
|
||||||
<triggers>full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.codan.core.codanBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
|
||||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
|
||||||
<nature>org.eclipse.cdt.codan.core.codanNature</nature>
|
|
||||||
</natures>
|
|
||||||
<linkedResources>
|
|
||||||
<link>
|
|
||||||
<name>bin</name>
|
|
||||||
<type>2</type>
|
|
||||||
<location>/home/ilya/Documents/Programming/Builds/opencv_debug/bin</location>
|
|
||||||
</link>
|
|
||||||
</linkedResources>
|
|
||||||
</projectDescription>
|
|
@ -85,10 +85,9 @@ public:
|
|||||||
OPENGL_BUFFER = 7 << KIND_SHIFT,
|
OPENGL_BUFFER = 7 << KIND_SHIFT,
|
||||||
CUDA_MEM = 8 << KIND_SHIFT,
|
CUDA_MEM = 8 << KIND_SHIFT,
|
||||||
GPU_MAT = 9 << KIND_SHIFT,
|
GPU_MAT = 9 << KIND_SHIFT,
|
||||||
OCL_MAT =10 << KIND_SHIFT,
|
UMAT =10 << KIND_SHIFT,
|
||||||
UMAT =11 << KIND_SHIFT,
|
STD_VECTOR_UMAT =11 << KIND_SHIFT,
|
||||||
STD_VECTOR_UMAT =12 << KIND_SHIFT,
|
UEXPR =12 << KIND_SHIFT
|
||||||
UEXPR =13 << KIND_SHIFT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_InputArray();
|
_InputArray();
|
||||||
|
@ -736,7 +736,7 @@ void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D)
|
|||||||
|
|
||||||
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
||||||
|
|
||||||
cl_command_queue q = (cl_command_queue)CommandQueue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
status = clEnqueueAcquireD3D11ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
status = clEnqueueAcquireD3D11ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed");
|
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed");
|
||||||
@ -795,7 +795,7 @@ void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst
|
|||||||
|
|
||||||
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
||||||
|
|
||||||
cl_command_queue q = (cl_command_queue)CommandQueue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
status = clEnqueueAcquireD3D11ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
status = clEnqueueAcquireD3D11ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed");
|
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed");
|
||||||
@ -884,7 +884,7 @@ void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D)
|
|||||||
|
|
||||||
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
||||||
|
|
||||||
cl_command_queue q = (cl_command_queue)CommandQueue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
status = clEnqueueAcquireD3D10ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
status = clEnqueueAcquireD3D10ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed");
|
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed");
|
||||||
@ -943,7 +943,7 @@ void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst
|
|||||||
|
|
||||||
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
||||||
|
|
||||||
cl_command_queue q = (cl_command_queue)CommandQueue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
status = clEnqueueAcquireD3D10ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
status = clEnqueueAcquireD3D10ObjectsKHR(q, 1, &clImage, 0, NULL, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed");
|
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed");
|
||||||
@ -1038,7 +1038,7 @@ void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurfa
|
|||||||
|
|
||||||
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_READ);
|
||||||
|
|
||||||
cl_command_queue q = (cl_command_queue)CommandQueue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
status = clEnqueueAcquireDX9MediaSurfacesKHR(q, 1, &clImage, 0, NULL, NULL);
|
status = clEnqueueAcquireDX9MediaSurfacesKHR(q, 1, &clImage, 0, NULL, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed");
|
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed");
|
||||||
@ -1104,7 +1104,7 @@ void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArr
|
|||||||
|
|
||||||
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_WRITE);
|
cl_mem clBuffer = (cl_mem)u.handle(ACCESS_WRITE);
|
||||||
|
|
||||||
cl_command_queue q = (cl_command_queue)CommandQueue::getDefault().ptr();
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
|
||||||
status = clEnqueueAcquireDX9MediaSurfacesKHR(q, 1, &clImage, 0, NULL, NULL);
|
status = clEnqueueAcquireDX9MediaSurfacesKHR(q, 1, &clImage, 0, NULL, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed");
|
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed");
|
||||||
|
@ -1496,11 +1496,6 @@ Size _InputArray::size(int i) const
|
|||||||
return d_mat->size();
|
return d_mat->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( k == OCL_MAT )
|
|
||||||
{
|
|
||||||
CV_Error(CV_StsNotImplemented, "This method is not implemented for oclMat yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
CV_Assert( k == CUDA_MEM );
|
CV_Assert( k == CUDA_MEM );
|
||||||
//if( k == CUDA_MEM )
|
//if( k == CUDA_MEM )
|
||||||
{
|
{
|
||||||
@ -1680,11 +1675,6 @@ int _InputArray::dims(int i) const
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( k == OCL_MAT )
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
CV_Assert( k == CUDA_MEM );
|
CV_Assert( k == CUDA_MEM );
|
||||||
//if( k == CUDA_MEM )
|
//if( k == CUDA_MEM )
|
||||||
{
|
{
|
||||||
@ -1842,11 +1832,6 @@ bool _InputArray::empty() const
|
|||||||
if( k == OPENGL_BUFFER )
|
if( k == OPENGL_BUFFER )
|
||||||
return ((const ogl::Buffer*)obj)->empty();
|
return ((const ogl::Buffer*)obj)->empty();
|
||||||
|
|
||||||
if( k == OCL_MAT )
|
|
||||||
{
|
|
||||||
CV_Error(CV_StsNotImplemented, "This method is not implemented for oclMat yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
if( k == GPU_MAT )
|
if( k == GPU_MAT )
|
||||||
return ((const cuda::GpuMat*)obj)->empty();
|
return ((const cuda::GpuMat*)obj)->empty();
|
||||||
|
|
||||||
@ -1882,7 +1867,7 @@ bool _InputArray::isContinuous(int i) const
|
|||||||
return vv[i].isContinuous();
|
return vv[i].isContinuous();
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_Error(CV_StsNotImplemented, "This method is not implemented for oclMat yet");
|
CV_Error(CV_StsNotImplemented, "Unknown/unsupported array type");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3365,7 +3365,7 @@ protected:
|
|||||||
{
|
{
|
||||||
CV_DbgAssert(entry.clBuffer_ == NULL);
|
CV_DbgAssert(entry.clBuffer_ == NULL);
|
||||||
entry.capacity_ = alignSize(size, (int)_allocationGranularity(size));
|
entry.capacity_ = alignSize(size, (int)_allocationGranularity(size));
|
||||||
Context2& ctx = Context2::getDefault();
|
Context& ctx = Context::getDefault();
|
||||||
cl_int retval = CL_SUCCESS;
|
cl_int retval = CL_SUCCESS;
|
||||||
entry.clBuffer_ = clCreateBuffer((cl_context)ctx.ptr(), CL_MEM_READ_WRITE, entry.capacity_, 0, &retval);
|
entry.clBuffer_ = clCreateBuffer((cl_context)ctx.ptr(), CL_MEM_READ_WRITE, entry.capacity_, 0, &retval);
|
||||||
CV_Assert(retval == CL_SUCCESS);
|
CV_Assert(retval == CL_SUCCESS);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other oclMaterials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
//
|
//
|
||||||
// * The name of the copyright holders may not be used to endorse or promote products
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
// derived from this software without specific prior written permission.
|
// derived from this software without specific prior written permission.
|
||||||
|
@ -119,7 +119,7 @@ CV_EXPORTS void randu(InputOutputArray dst);
|
|||||||
inline void safeFinish()
|
inline void safeFinish()
|
||||||
{
|
{
|
||||||
if (cv::ocl::useOpenCL())
|
if (cv::ocl::useOpenCL())
|
||||||
cv::ocl::finish2();
|
cv::ocl::finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace perf
|
} // namespace perf
|
||||||
|
@ -10,14 +10,10 @@
|
|||||||
#include "opencv2/superres/optical_flow.hpp"
|
#include "opencv2/superres/optical_flow.hpp"
|
||||||
#include "opencv2/opencv_modules.hpp"
|
#include "opencv2/opencv_modules.hpp"
|
||||||
|
|
||||||
#if defined(HAVE_OPENCV_OCL)
|
|
||||||
#include "opencv2/ocl/ocl.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace cv::superres;
|
using namespace cv::superres;
|
||||||
bool useOclChanged;
|
|
||||||
#define MEASURE_TIME(op) \
|
#define MEASURE_TIME(op) \
|
||||||
{ \
|
{ \
|
||||||
TickMeter tm; \
|
TickMeter tm; \
|
||||||
@ -50,40 +46,11 @@ static Ptr<DenseOpticalFlowExt> createOptFlow(const string& name, bool useGpu)
|
|||||||
else if (name == "pyrlk")
|
else if (name == "pyrlk")
|
||||||
return createOptFlow_PyrLK_CUDA();
|
return createOptFlow_PyrLK_CUDA();
|
||||||
else
|
else
|
||||||
{
|
|
||||||
cerr << "Incorrect Optical Flow algorithm - " << name << endl;
|
cerr << "Incorrect Optical Flow algorithm - " << name << endl;
|
||||||
}
|
|
||||||
return Ptr<DenseOpticalFlowExt>();
|
return Ptr<DenseOpticalFlowExt>();
|
||||||
}
|
}
|
||||||
#if defined(HAVE_OPENCV_OCL)
|
|
||||||
static Ptr<DenseOpticalFlowExt> createOptFlow(const string& name)
|
|
||||||
{
|
|
||||||
if (name == "farneback")
|
|
||||||
{
|
|
||||||
return createOptFlow_Farneback_OCL();
|
|
||||||
}
|
|
||||||
else if (name == "simple")
|
|
||||||
{
|
|
||||||
useOclChanged = true;
|
|
||||||
std::cout<<"simple on OpenCL has not been implemented. Use CPU instead!\n";
|
|
||||||
return createOptFlow_Simple();
|
|
||||||
}
|
|
||||||
else if (name == "tvl1")
|
|
||||||
return createOptFlow_DualTVL1_OCL();
|
|
||||||
else if (name == "brox")
|
|
||||||
{
|
|
||||||
std::cout<<"brox has not been implemented!\n";
|
|
||||||
return Ptr<DenseOpticalFlowExt>();
|
|
||||||
}
|
|
||||||
else if (name == "pyrlk")
|
|
||||||
return createOptFlow_PyrLK_OCL();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cerr << "Incorrect Optical Flow algorithm - " << name << endl;
|
|
||||||
}
|
|
||||||
return Ptr<DenseOpticalFlowExt>();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
int main(int argc, const char* argv[])
|
int main(int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
useOclChanged = false;
|
useOclChanged = false;
|
||||||
@ -94,7 +61,7 @@ int main(int argc, const char* argv[])
|
|||||||
"{ i iterations | 180 | Iteration count }"
|
"{ i iterations | 180 | Iteration count }"
|
||||||
"{ t temporal | 4 | Radius of the temporal search area }"
|
"{ t temporal | 4 | Radius of the temporal search area }"
|
||||||
"{ f flow | farneback | Optical flow algorithm (farneback, simple, tvl1, brox, pyrlk) }"
|
"{ f flow | farneback | Optical flow algorithm (farneback, simple, tvl1, brox, pyrlk) }"
|
||||||
"{ g | false | CPU as default device, cuda for CUDA and ocl for OpenCL }"
|
"{ g | false | CPU as default device, cuda for CUDA }"
|
||||||
"{ h help | false | Print help message }"
|
"{ h help | false | Print help message }"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -102,7 +69,7 @@ int main(int argc, const char* argv[])
|
|||||||
{
|
{
|
||||||
cout << "This sample demonstrates Super Resolution algorithms for video sequence" << endl;
|
cout << "This sample demonstrates Super Resolution algorithms for video sequence" << endl;
|
||||||
cmd.printMessage();
|
cmd.printMessage();
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const string inputVideoName = cmd.get<string>("video");
|
const string inputVideoName = cmd.get<string>("video");
|
||||||
@ -115,60 +82,19 @@ int main(int argc, const char* argv[])
|
|||||||
|
|
||||||
std::transform(gpuOption.begin(), gpuOption.end(), gpuOption.begin(), ::tolower);
|
std::transform(gpuOption.begin(), gpuOption.end(), gpuOption.begin(), ::tolower);
|
||||||
|
|
||||||
bool useCuda = false;
|
bool useCuda = gpuOption.compare("cuda") == 0;
|
||||||
bool useOcl = false;
|
|
||||||
|
|
||||||
if(gpuOption.compare("ocl") == 0)
|
|
||||||
useOcl = true;
|
|
||||||
else if(gpuOption.compare("cuda") == 0)
|
|
||||||
useCuda = true;
|
|
||||||
|
|
||||||
#ifndef HAVE_OPENCV_OCL
|
|
||||||
if(useOcl)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
cout<<"OPENCL is not compiled\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_OPENCV_OCL)
|
|
||||||
if(useCuda)
|
|
||||||
{
|
|
||||||
CV_Assert(!useOcl);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Ptr<SuperResolution> superRes;
|
Ptr<SuperResolution> superRes;
|
||||||
|
|
||||||
|
if (useCuda)
|
||||||
#if defined(HAVE_OPENCV_OCL)
|
superRes = createSuperResolution_BTVL1_CUDA();
|
||||||
if(useOcl)
|
|
||||||
{
|
|
||||||
Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow);
|
|
||||||
if (of.empty())
|
|
||||||
exit(-1);
|
|
||||||
if(useOclChanged)
|
|
||||||
{
|
|
||||||
superRes = createSuperResolution_BTVL1();
|
|
||||||
useOcl = !useOcl;
|
|
||||||
}else
|
|
||||||
superRes = createSuperResolution_BTVL1_OCL();
|
|
||||||
superRes->set("opticalFlow", of);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
superRes = createSuperResolution_BTVL1();
|
||||||
{
|
|
||||||
if (useCuda)
|
|
||||||
superRes = createSuperResolution_BTVL1_CUDA();
|
|
||||||
else
|
|
||||||
superRes = createSuperResolution_BTVL1();
|
|
||||||
|
|
||||||
Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow, useCuda);
|
Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow, useCuda);
|
||||||
|
|
||||||
if (of.empty())
|
if (of.empty())
|
||||||
exit(-1);
|
return EXIT_FAILURE;
|
||||||
superRes->set("opticalFlow", of);
|
superRes->set("opticalFlow", of);
|
||||||
}
|
|
||||||
|
|
||||||
superRes->set("scale", scale);
|
superRes->set("scale", scale);
|
||||||
superRes->set("iterations", iterations);
|
superRes->set("iterations", iterations);
|
||||||
@ -201,11 +127,7 @@ int main(int argc, const char* argv[])
|
|||||||
cout << "Iterations : " << iterations << endl;
|
cout << "Iterations : " << iterations << endl;
|
||||||
cout << "Temporal radius : " << temporalAreaRadius << endl;
|
cout << "Temporal radius : " << temporalAreaRadius << endl;
|
||||||
cout << "Optical Flow : " << optFlow << endl;
|
cout << "Optical Flow : " << optFlow << endl;
|
||||||
#if defined(HAVE_OPENCV_OCL)
|
|
||||||
cout << "Mode : " << (useCuda ? "CUDA" : useOcl? "OpenCL" : "CPU") << endl;
|
|
||||||
#else
|
|
||||||
cout << "Mode : " << (useCuda ? "CUDA" : "CPU") << endl;
|
cout << "Mode : " << (useCuda ? "CUDA" : "CPU") << endl;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
superRes->setInput(frameSource);
|
superRes->setInput(frameSource);
|
||||||
@ -217,32 +139,8 @@ int main(int argc, const char* argv[])
|
|||||||
cout << '[' << setw(3) << i << "] : ";
|
cout << '[' << setw(3) << i << "] : ";
|
||||||
Mat result;
|
Mat result;
|
||||||
|
|
||||||
#if defined(HAVE_OPENCV_OCL)
|
MEASURE_TIME(superRes->nextFrame(result));
|
||||||
cv::ocl::oclMat result_;
|
|
||||||
|
|
||||||
if(useOcl)
|
|
||||||
{
|
|
||||||
MEASURE_TIME(
|
|
||||||
{
|
|
||||||
superRes->nextFrame(result_);
|
|
||||||
ocl::finish();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
MEASURE_TIME(superRes->nextFrame(result));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_OPENCV_OCL
|
|
||||||
if(useOcl)
|
|
||||||
{
|
|
||||||
if(!result_.empty())
|
|
||||||
{
|
|
||||||
result_.download(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (result.empty())
|
if (result.empty())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user