I'm trying to align two images taken from a handheld camera.
At first, I was trying to use the OpenCV warpPerspective method based on SIFT/SURF feature points. The problem is the feature-extract & matching process may be extremely slow when the image quality is high (3000x4000). I tried to scale-down the image before find feature-points, the result is not as good as before.(The Mat generated from findHomography shouldn't be affected by scaling down the image, right?) And sometimes, due to lack of good feature point matches, the result is quite strange.
After searching on this topic, it seems that solving the problem in Fourier domain will speed up the registration process. And I've found this question which leads me to the code here.
The only problem is the code is written in python with numpy (not even using OpenCV), which makes it quite hard to re-written to C++ code using OpenCV (In OpenCV, I can only find dft and there's no fftshift nor fft stuff, I'm not quite familiar with NumPy, and I'm not brave enough to simply ignore the missing methods). So I'm wondering why there is not such a Fourier-domain image registration implementation using C++?
Can you guys give me some suggestion on how to implement one, or give me a link to the already implemented C++ version? Or help me to turn the python code into C++ code?
Big thanks!
I'm fairly certain that the FFT method can only recover a similarity transform, that is, only a (2d) rotation, translation and scale. Your results might not be that great using a handheld camera.
This is not quite a direct answer to your question, but, as a suggestion for a speed improvement, have you tried using a faster feature detector and descriptor? In OpenCV SIFT/SURF are some of the slowest methods they have for feature extraction/matching. You could try testing some of their other methods first, they all work quite well and are faster than SIFT/SURF. Especially if you use their FLANN-based matcher.
I've had to do this in the past with similar sized imagery, and using the binary descriptors OpenCV has increases the speed significantly.
If you need only shift you can use OpenCV's phasecorrelate
Related
Problem:
I'm trying to build a image processing program which detects scratches on a module.
As seen in the image below, a few scratches can be found.
One of the problems is that I have only two samples with scratches.
Question:
What would be the best way to find the scratches under the limited number of sample condition?
(if detection is too hard, accepted / not accepted classification is also fine)
What I tried:
I tried to detect the scratches by using GMM(gaussian mixture model)
-> It didn't work because of too many features. GMM is only effective on object such as textures.
I will try to implement Deep Learning, but I'm not sure if it will work or not.
Image Sample
I'm using OpenCV library (C++) to extract detectors from 2 images coming from a video stream taker from an aerial camera in order to, afterwards, find the matching points in successive images. i'm wondering which is the best algorithm to find robust detectors of a urban environment??
Ps. Actually I'm using SURF but when the images changes a little (because the camera is translating very slowly) the matchings between these descriptors become very few!
If you want to try different aproaches give a try to RoboRealm , they have a trial version, you just put the algoritms and seems the results, for testing purposes even if you will use OpenCV its ok.
I am using OpenCV 2.4 (C++) for line finding on grayscale images. This involves some basic image processing steps like blurring, threshold, Canny edge detector, gradient filter or Hough transformation. I have to apply the line finding algorithm on thousands of images.
Is there a way to speed up the calculation considering the large number of images?
Does one of the following provide help? Intel TBB, IPP or OpenCV GPU?
I heard that OpenCV GPU can speed up calculations but data transfer is slowly. So using GPU might not be the right choice here?
Thank You!
EDIT:
Is there any sense in using parallel_for from TBB to speed up image processing? If I use a for loop like this:
for(int i=0; i<image_location.size();++i)
{
Mat img=imread(image_location[i]);
blur(img...);
threshold(img...);
...
}
Can I improve performance by using parallel_for instead? Can anyone provide examples how to use parallel_for including some opencv operations?
The scope of your question is virtually unbounded.
First of all, have you measured the performance of your application to detect the actual bottleneck(s) ? My guess would be the Hough transform, but who knows what else your code is doing. Now, if the Hough transform is the slow piece, and supposing OpenCV has a fast implementation of it, then this is the reason I tell you the question is problematic. Changing for a somewhat better implementation doesn't help much when you decide to increase your already large number of images, the problem is in the approach itself.
Do you really need to use Hough ? Maybe you could achieve something similar/better using morphological operators ? Are the images from some common domain ? Can you include examples of them ? Etc, etc.
I'm looking for an algorithm, that would do image comparisons at real time, basically on images acquired from a webcam (like 30 frames/second). My current implementation is pretty slow, tired to improve it by dropping a few frames and reducing the resolution -- but with no success.
So, I'm exploring options like using better algorithms like Key-point Matching etc. And on a different note, I'm also looking for a GPU based image comparison sample implementations (either DirectX or OpenGL APIs).
Have you tried Perceptual Image Diff?
I didn't read the entire thread but it may help you somehow
Image comparison - fast algorithm
I have a simple question, which I want to know, what kind of libraries are available and can give good results for implementing SIFT, HOG(Histogram Oriented Gradient) and SURF in c++ or opencv?
Hence: 1- Give me the link for the code if you can, which I will be so appreciated.
2- If you know one of them or any kind of information to lead me to what I want, I will be so appreciated as well.
Thanks
check these:
surf
- great article
http://people.csail.mit.edu/kapu/papers/mar_mir08.pdf
sift
- great source, I tried it on the iPhone
http://blogs.oregonstate.edu/hess/
- fast - fast corner detection library
http://svr-www.eng.cam.ac.uk/~er258/work/fast.html
Example of surf code in openCV
https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/cpp/matching_to_many_images.cpp
Not sure if this is still relevant, but you also get two implementations of computing HOG descriptors in opencv i.e. both GPU and CPU versions of the HOG code.
for the CPU version you can check this blog post
however in the CPU version you would need to write your own logic for sliding windows.
and the GPU version is fairly straightforward you can read the documentation here
Might help you to know that SIFT and SURF implementations are already integrated into OpenCV.
http://opencv.willowgarage.com/documentation/cpp/features2d__feature_detection_and_descriptor_extraction.html
Be careful about OpenCV implementations, because latest versions of OpenCV have classified SIFT and SURF implementations as nonfree http://docs.opencv.org/modules/nonfree/doc/nonfree.html.
Now you can use them, but probably they are subject to licensing and cannot be used for commercial solutions.
This one uses descriptors based on HoG, Sobel and Lab channels for detection Class-Specific Hough Forests for Object Detection (opencv/c source code).
Rather then performing detection at every possible location this approach calculates a vote for each descriptor, then when putted together they produce a voting cloud where maximum will correspond to most probable location of the target. When combined with cvGoodFeaturesToTrack can produce very good results, even with a small training database.