can HOG feature detection be used to keypoint matching? - c++

I see HOG is often used with SVM for target detection, can it be used in matching keypoints in two images?
and btw, where could I find OpenCV sample of using HOGDescriptor?

HOG can be used without SVM for feature matching.
just choose some points ( edge, for example ) and calculate the feature of HOG inside ROI with those points centered.
HOGDescriptor seems only for GPU programming.
I created Descriptor for HOG as a Mat in openCV and it also works for OpenCV matching functions.

If you are working with images you can use SIFT/SURF with SVM. There is nothing that stops you from using HOG for keypoint matching, but bear in mind that the effectiveness depends on discrimination power and robustness of the descriptor.
Edit: My bad in understanding when I originally mentioned HOG being for video only. Somehow I was thinking about histogram of optical flow vectors which is very effective for video activity description.
Edit 2 [Oct '12]: I now suggest people to try ORB or BRISK for those looking for license friendly descriptors that are fast and quite effective for keypoint matching.

Related

SIFT implemetion the returns a single vector for the entire image

I'm trying to use SIFT (from opencv) to get a histogram that describes an image. The problem is, that SIFT identifies a lot of points of interest in the image and gives me a 128 elements vector. While It seems to me as this is what SIFT supposed to do, my lab's PI told me there is an implementation that gives a single 128 elements vector for the all image. Do you know of such an implementation ?
If not, is there any other way of getting a good descriptor for an image ?
(for the purpose of machine learning classification)
In SIFT descriptors feature extraction, each keypoints/interest points gives a 128D SIFT features and as there are multiple keypoints in an image, you will get some 128D x No. of keypoints SIFT vectors for each image. As per my experience, if you try to use SIFT features extraction in OpenCV, you will have to build the library from scratch as SIFT is patented algorithm, the OpenCV community have removed the plug-in library for SIFT and SURF.
You can also try other feature extraction techniques like VLAD, Fisher vector, RGB color histogram, HoG (Histogram of Oriented Gradient) features.

Stitching images can't detect common feature points

I wish to stitch two or more images using OpenCV and C++. The images have regions of overlap but they are not being detected. I tried using homography detector. Can someone please suggest as to what other methods I should use. Also, I wish to use the ORB algorithm, and not SIFT or SURF.
The images can be found at-
https://drive.google.com/open?id=133Nbo46bgwt7Q4IT2RDuPVR67TX9xG6F
This a very common problem. Because images like this, they actually do not have much in common. The overlap region is not rich in feature. What you can do is dig into opencv stitcher code and there they use confidence factor for feature matching, you can play with that confidence factor to get matches in this case. But this will only work if your feature detector is able to detect some features in overlapping resion.
You can also look at this post:
Related Question
It might be helpful for you.
"OpenCV stitching code"
This is full pipleline of OPencv Stitching code. You can see that there are lot of parameters you can change to make your code give some good stitching result. Also I would suggest using a small image (640 X480) for the feature detection step. Using small images is better than using very large images

How to extract LBP features from a hand contour using opencv c++

I am currently working on a hand recognition system. I have been able to detect the hand and draw a contour for it. Now, I have to extract features from the hand region. What is the best feature extraction method that i can use?
I was thinking to use Local Binary Pattern, but since i am new to computer vision i don't know how to use it.
Perhaps you must look at histogram of gradients (HOG), which can be considered as a more general version of LBP. You can have multiple images of hands; by extracting HOG features from each image and using an SVM or neural network classifier, you can learn a statistical model of hand poses. This will help in recognizing an unseen hand. Look also at the current literature on deep learning.
A C++ implementation of HOG is available from vlfeat library [1], which can be called from OpenCV. HOG can be computer from OpenCV also [2].
[1] http://www.vlfeat.org/overview/hog.html
[2] http://goo.gl/8jTetR

Sift Extraction - opencv

I'm trying to get started working with sift feature extraction using (C++) OpenCv. I need to extract features using SIFT, match them between the original image (e.g. a book) and a scene, and after that calculate the camera pose.
So far I have found this algorithm using SURF. Does anyone know a base code from which I can get started, or maybe a way to convert the algorithm in the link from SURF to SIFT?
Thanks in advance.
EDIT:
Ok, I worked out a solution for the sift problem. Now I'm trying to figure the camera pose. I'm trying to use: solvePnP, can anyone help me with an example?
Check out the feature2d tutorial section of the new OpenCV docs website.
There tutorials with code showing:
Feature detection with e.g. SURF
Feature Description
Feature Matching
If you have managed to find matches between the image and the scene, then I suggest you apply cv::findHomography(). It will calculate the homography matrix using 4 matches as input.
You can convert to camera pose from the homography matrix directly.
For using SIFT instead of SURF, I changed SurfFeatureDetector to SiftFeatureDetector and SurfDescriptorExtractor to SiftDescriptorExtractor. For some images, I found that the combination SURF detector <--> SIFT descriptor yields relatively accurate results, but you should experiment with other combinations (FAST detector - FREAK descriptor or ORB detector - BRISK descriptor), depending on your requirements.
Please follow this tutorial for solving the homography part of your question:
Feature Matching and Homography
Also, maybe this will help: Pose Estimation

How to train/use the HOGDescriptor class in OpenCV

I have been looking into training/using OpenCV to attempt to detect human figures. I want to try training a HOG for my specific purposes and not use the provided getDefaultPeopleDetector function. I have been unable to find any usable documentation on the HOGDescriptor class.
How do I train my own classifier for my own purposes?
HOG descriptor is very easy to implement. You can write your own code to do it. Look at http://smsoftdev-solutions.blogspot.com/2009/08/integral-histogram-for-fast-calculation.html.
It is fast implementation of HOG. Once you get HOG features of all the training images.You can train an SVM in OpenCV. Training with Gaussian Kernel has produced good results.