OpenCV GPU support and TBB - opencv

I am going to train my Haar classifier for flowers(which I am highly skeptical about). I have been following the CodingRobin Tut for everything.
http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html
Now, it has been emphasized that I use GPU support, multithreading etc. otherwise the training is gonna take days. I am going to use pre-built libraries and therefore the pre-built opencv_traincascade utility.
I want to ask beforehand, Will I be able to leverage GPU support if I use the pre-built libs, given that I install CUDA?
Where does TBB fit in the whole picture?
Do you recommend me building the whole library from scratch with TBB and CUDA support checked, or that would be a waste?
Note: I am using OpenCV 2.4.11. And I am a complete beginner to OpenCV.

Related

Which is faster for OpenCV: PThreads, OpenMP or TBB?

I'm using OpenCV on my Raspberry Pi 3 which has 4 cores. Right now it is compiled with PThreads. Would OpenMP or TBB perform better? Or does it depend?
I'm mostly doing things like color conversions, median blurs, cascade trackers and median flow trackers.
I'm asking because compiling each takes forever and risks breaking everything.
Is it possible to compile and use a different build of OpenCV without affecting whats currently installed (I'm using Python bindings if it matters)?

Are there any detectors which implemented on GPU and are scale/rotate-invariant?

As known in OpenCV 2.4.9.0 are these feature-detectors: SIFT, SURF, BRISK, FREAK, STAR, FAST, ORB.
http://docs.opencv.org/modules/features2d/doc/feature_detection_and_description.html
http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html
All of these have implementation on CPU, but only FAST and ORB on GPU. http://docs.opencv.org/genindex.html
And as known, some are scale/rotate-invariant, but some aren't: Are there any fast alternatives to SURF and SIFT for scale-invariant feature extraction?
These are scale-invariant and rotate-invariant:
SIFT
SURF
BRISK
FREAK
STAR
But these are not scale-invariant and not rotate-invariant:
FAST
ORB
Are there any detectors which implemented on GPU and are scale/rotate-invariant?
Or will be added in OpenCV 3.0 on GPU or OpenCL?
Actually, SURF is the only scale/rotate-invariant feature detector with GPU support in OpenCV.
In OpenCV 3.0 FAST and ORBhave got OCL support and moreover, these two (FAST and ORB) have already got CUDA support.
The OCL/CUDA support of SURF has been already mentioned in the comments of your question, but it is only a contribution to OpenCV and this is how OpenCV's developers about opencv_contrib:
New modules quite often do not have stable API, and they are not
well-tested. Thus, they shouldn't be released as a part of official
OpenCV distribution, since the library maintains binary compatibility,
and tries to provide decent performance and stability.
Based on my previous experiences OpenCV’s implementation of SURF features were much weaker than OpenSURF. It would be reasonable to try it, or find some other open source implementations.
p.s.:
to my knowledge still there is no GPU accelerated version of KAZE/AKAZE.
I recently implemented AKAZE using CUDA with a couple of colleagues, if you are familiar with the original library you should have no problem using it since we respected the API. You can find the current version here:
https://github.com/nbergst/akaze

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

OpenCV 2.1 to OpenCV2.4 performance increase?

I was wondering if there are any performance increases when changing from OpenCV2.1 to OpenCV2.4?
Also, I've read a little about GPU development with OpenCV. Can someone recommend any beginner guides/primers? Is it as simple as redifining the matrix as cv::gpu::GpuMat?
There is a set of performance tests in the full source build - but generally each release of openCV tries to improve performance where possible
Yes using the GPU is essentially as straight forward as use cv::gpu::Mat although not all code is ported to CUDA and of course not all code will benefit, see http://docs.opencv.org/modules/gpu/doc/gpu.html

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.

Resources