+++ /dev/null
-<?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>
OPENGL_BUFFER = 7 << KIND_SHIFT,
CUDA_MEM = 8 << KIND_SHIFT,
GPU_MAT = 9 << KIND_SHIFT,
- OCL_MAT =10 << KIND_SHIFT,
- UMAT =11 << KIND_SHIFT,
- STD_VECTOR_UMAT =12 << KIND_SHIFT,
- UEXPR =13 << KIND_SHIFT
+ UMAT =10 << KIND_SHIFT,
+ STD_VECTOR_UMAT =11 << KIND_SHIFT,
+ UEXPR =12 << KIND_SHIFT
};
_InputArray();
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);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed");
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);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D11ObjectsKHR failed");
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);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed");
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);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireD3D10ObjectsKHR failed");
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);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed");
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);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLApiCallError, "OpenCL: clEnqueueAcquireDX9MediaSurfacesKHR failed");
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 );
//if( k == CUDA_MEM )
{
return 2;
}
- if( k == OCL_MAT )
- {
- return 2;
- }
-
CV_Assert( k == CUDA_MEM );
//if( k == CUDA_MEM )
{
if( k == OPENGL_BUFFER )
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 )
return ((const cuda::GpuMat*)obj)->empty();
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;
}
{
CV_DbgAssert(entry.clBuffer_ == NULL);
entry.capacity_ = alignSize(size, (int)_allocationGranularity(size));
- Context2& ctx = Context2::getDefault();
+ Context& ctx = Context::getDefault();
cl_int retval = CL_SUCCESS;
entry.clBuffer_ = clCreateBuffer((cl_context)ctx.ptr(), CL_MEM_READ_WRITE, entry.capacity_, 0, &retval);
CV_Assert(retval == CL_SUCCESS);
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// 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
// derived from this software without specific prior written permission.
inline void safeFinish()
{
if (cv::ocl::useOpenCL())
- cv::ocl::finish2();
+ cv::ocl::finish();
}
} // namespace perf
#include "opencv2/superres/optical_flow.hpp"
#include "opencv2/opencv_modules.hpp"
-#if defined(HAVE_OPENCV_OCL)
-#include "opencv2/ocl/ocl.hpp"
-#endif
-
using namespace std;
using namespace cv;
using namespace cv::superres;
-bool useOclChanged;
+
#define MEASURE_TIME(op) \
{ \
TickMeter tm; \
else if (name == "pyrlk")
return createOptFlow_PyrLK_CUDA();
else
- {
cerr << "Incorrect Optical Flow algorithm - " << name << endl;
- }
- 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[])
{
useOclChanged = false;
"{ i iterations | 180 | Iteration count }"
"{ t temporal | 4 | Radius of the temporal search area }"
"{ 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 }"
);
{
cout << "This sample demonstrates Super Resolution algorithms for video sequence" << endl;
cmd.printMessage();
- return 0;
+ return EXIT_SUCCESS;
}
const string inputVideoName = cmd.get<string>("video");
std::transform(gpuOption.begin(), gpuOption.end(), gpuOption.begin(), ::tolower);
- bool useCuda = false;
- 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
+ bool useCuda = gpuOption.compare("cuda") == 0;
Ptr<SuperResolution> superRes;
-
-#if defined(HAVE_OPENCV_OCL)
- 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);
- }
+ if (useCuda)
+ superRes = createSuperResolution_BTVL1_CUDA();
else
-#endif
- {
- if (useCuda)
- superRes = createSuperResolution_BTVL1_CUDA();
- else
- superRes = createSuperResolution_BTVL1();
+ superRes = createSuperResolution_BTVL1();
- Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow, useCuda);
+ Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow, useCuda);
- if (of.empty())
- exit(-1);
- superRes->set("opticalFlow", of);
- }
+ if (of.empty())
+ return EXIT_FAILURE;
+ superRes->set("opticalFlow", of);
superRes->set("scale", scale);
superRes->set("iterations", iterations);
cout << "Iterations : " << iterations << endl;
cout << "Temporal radius : " << temporalAreaRadius << 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;
-#endif
}
superRes->setInput(frameSource);
cout << '[' << setw(3) << i << "] : ";
Mat result;
-#if defined(HAVE_OPENCV_OCL)
- cv::ocl::oclMat result_;
-
- if(useOcl)
- {
- MEASURE_TIME(
- {
- superRes->nextFrame(result_);
- ocl::finish();
- });
- }
- else
-#endif
- {
- MEASURE_TIME(superRes->nextFrame(result));
- }
+ MEASURE_TIME(superRes->nextFrame(result));
-#ifdef HAVE_OPENCV_OCL
- if(useOcl)
- {
- if(!result_.empty())
- {
- result_.download(result);
- }
- }
-#endif
if (result.empty())
break;