CudaFy.net and OpenCV - emgucv

I would like to use some of the OpenCV routines (2D convolve, Region Labeling, and Centroiding) in a CudaFy.net project.
Is this a stupid idea?
Would it be better just to implement the algorithms in C# from opensource examples?
Some of inputs to the OpenCV have will already be in global GPU memory, can you pass pointers to OpenCV GPU routines and say the matrix is already in the GPU?
Are there any simple examples of doing this
I did see one person who used EMGU and openCV but did run into some issues. Is there an example around of someone doing this successfully? [ https://cudafy.codeplex.com/discussions/356649 ]

Related

Re-write openCV functions using Cuda only

I have my code written in c++ and I used openCV functions for Image processing tasks.
I want to run my code in GPU (using cuda) to read a camera/stream inputs and do the image processing tasks in each frame in parallel.
I've read somewhere that I can't include the openCV functions in a .cu code, since the NVCC can't compile openCv functions (please correct me if this is not true)
I found the openCV gpu module in the openCV documentation, but I don't want to run the whole function in parallel, I want the whole algorithm to be processed in parallel ( in other way, include openCv in cuda not vise versa), so I've thought about writing all of my openCV functions in cuda, But I'm newbie to cuda.
My questions:
1- Are there cuda functions that can be used instead of openCv following functions :
split, inRange
fillHoles
Morphology (erosion, dilation, closing)
Countours (findContours, moments, boundingRect, approxPolyDP)
Drawing function (drawContours, rectangle, circle)
kmeans (or any other function for clustering)
I found some of them in Github, but still didn't test any, any documentation will be highly appreciated.
2- Does cuda reads only .pgm image format, and should I convert the .jpg frames before copying them to the device? Is it impossible to read the camera input directly to GPU global memory?
3- Do you suggest keeping my code in openCV and use another libraries for parallel processing like openCL? or use CPU (instead of GPU) for parallel processing using OpenMP? what might be the best option I should go with?
Before you begin down this route, i would recommend that you go through the first few lessons in this tutorial:
https://www.udacity.com/course/cs344
Then you will have a better idea about if a GPU is suitable for what your application requires.
In any case, openCV 1.0 is mostly in C, and cuda kernels are in C, so maybe you could try wrapping some of those into cuda kernels
Cheers

Open CV feature detection in GPU

I'm using OpenCV 2.4.6 in a prototype of object detection and I was wondering in how to improve the feature detection/extraction performance. Someone knows if is it possible to run feature detection/extraction/matching, like SIFT/SIFT/BF, or even the findHomography, on GPU?
Tks
OpenCV GPU module contains implementations for FAST, ORB and SURF feature detectors/extractors and for BruteForceMatcher.
You can read more in documentation:
http://docs.opencv.org/2.4.6/modules/gpu/doc/feature_detection_and_description.html
http://docs.opencv.org/2.4.6/modules/nonfree/doc/feature_detection.html#gpu-surf-gpu

Object recognition with Kinect

I'm trying to recognize rectangular boxes using Kinect, I know I can use OpenCV or PCL to do this but my C++ is a bit rusty, I'm new to Computer Vision in 3D and I want to do it as quick as possible, it's only a demo for a bigger project.
Is there anyway to do it using C# or at least Python, I don't care if I have to learn 3D.
If not, which library should I use, OpenCV or PCL?
I recommend OpenCV.
If you want to work in C# or python with OpenCV then you have wrappers for both of them:
http://www.emgu.com/wiki/index.php/Main_Page
http://www.neuroforge.co.uk/index.php/getting-started-with-python-a-opencv

Image Processing on CUDA or OpenCV?

I need to develop an image processing program for my project in which I have to count the number of cars on the road. I am using GPU programming. Should I go for OpenCV program with GPU processing feature or should I develop my entire program on CUDA without any OpenCV library?
The algorithms which I am using for counting the number of cars is background subtraction, segmentation and edge detection.
You can use GPU functions in OpenCV.
First visit the introduction about this : http://docs.opencv.org/modules/gpu/doc/introduction.html
Secondly, I think above mentioned processes are already implemented in OpenCV optimized for GPU. So It will be much easier to develop with OpenCV.
Canny Edge Detection : http://docs.opencv.org/modules/gpu/doc/image_processing.html#gpu-canny
PerElement Operations (including subtraction): http://docs.opencv.org/modules/gpu/doc/per_element_operations.html#per-element-operations
For other functions, visit OpenCV docs.
OpenCV, no doubt, has the biggest collection of Image processing functionality and recently they've started porting functions to CUDA as well. There's a new GPU module in latest OpenCV with few functions ported to CUDA.
Being said that, OpenCV is not the best option to build a CUDA based application as there are many dedicated CUDA libraries like CUVI that beat OpenCV in Performance. If you're looking for an optimized solution, you should also give them a try.

Computer Vision with Mathematica

Does anybody here do computer vision work on Mathematica? I would like to know what external libraries are available for doing that. The built in image processing functions are not enough. I am looking for things like SURF, stereo, camera calibration, multi-view geometry etc.
How difficult would it be to wrap OpenCV for use in Mathematica?
Apart from the extensive set of image processing tools that are now (version 8) natively present in Mathematica, and which include a number of CV algorithms like finding morphologic objects, image segmentation and feature detection (see figure below), there's the new LibraryLink functionality, which makes working with DLLs very easy. You wouldn't have to change OpenCV much to be able to call it from Mathematica. Just some wrappers for the functions to be called and you're basically done.
I don't think such a thing exists, but I'm getting started.
It has the advantage that you can perform some analytic methods... for example rather than hacking in openCV or even Matlab endlessly, you can compute analytically a quantity, and see that the method leading to this matrix is numerically unstable as a function of input variables. Thus you do not need to hack, as it would be pointless.
As for wrapping opencv, that doesn't seem to make sense. The correct procedure would be to fix bad implementations in opencv based on your analysis in Mathematica and on paper.
Agreeing with Peter, I don't believe that forcing Mathematica to use OpenCV is a great thing.
All of the computer vision people that I've talked to, read about, and seen examples are using Matlab and the Imaging toolkit. Its either that, or go with a OpenCV compatible language + OpenCV.
Mathematica has a rich set of tools for image processing, but I'm uncertain about the computer vision capabilities.

Resources