Ask Your Question

zhfkt's profile - activity

2013-05-02 23:49:53 -0600 received badge  Scholar (source)
2013-05-02 10:14:27 -0600 received badge  Supporter (source)
2013-05-01 09:31:09 -0600 asked a question MSER operator() is different from FeatureDetector::detect() function?

Hi,

I am using cv::MSER to get the keypoints of images in opencv. Now I have found 2 ways to do this operation of extracting keypoints from the image.

The one is operator() function in MSER class.

void operator()( const Mat& image, vector<vector<Point> >& msers, const Mat&mask ) const;

The other is virtual function in FeatureDetector::detect()

void FeatureDetector::detect( const Mat& image, vector<KeyPoint>& keypoints,const Mat& mask=Mat() ) const;

What the strange thing is the second parameters in two function are totally different.One is vector<vector<point> > type in MSER class,and the other is vector<keypoint> in FeatureDetector::detect(). In fact, I also find this in source code:

/*! Maximal Stable Extremal Regions class.*/
/*The class implements MSERalgorithm introduced by J. Matas. */
/*Unlike SIFT, SURF and many other detectorsin OpenCV, this is salient region detector, */
/*not the salient point detector.It returns the regions, each of those is encoded as a contour.*/

It seems that MSERalgorithm returns the area other than the point of a image.And I think the type vector<vector<point> > can represent the area of the image,not the type vector<keypoint>,which just stands.for the vector array of a image.

So my question is: Is virtual function detect() in FeatureDetector Class compatible with operator() in MSER Class?

2013-04-24 02:44:02 -0600 asked a question Strange Octave value in SIFT algorithm?

Hi,

I am using sift algorithm in opencv code to get descriptors and keypoints from images.My code is

    Ptr<IplImage> image;
    vector<KeyPoint> keypoints;
    OutputArray des;

    Feature2D *descriptor_type = new SIFT()
    Mat image_mat(image);
    (*descriptor_type)(image_mat,noArray(),keypoints,des,false);

Here I can get the keypoints of the image in vector < KeyPoint > .After that,I want to get the Octave of each KeyPoint for more details .But when I cout each keypoint octave value for one image,it seems so strange that I want to confirm whether they are right.

for(int i=0;i<keypoints.size();i++)
{
     cout<< (keypoints[i].octave) <<endl;
}

9765375
9765375
2621951
8323583
13763071
6488575
12845567
721407
3604991
12321279
9568767
7406079
8585727
4653567
7799295
7799295
5112319
10486271
9961983
6226431
1245951

and if I change SIFT algorithm to SURF algorithm,it will be OK and seem right.

0
0
0
0
0
0
1
0
0
0
0
1
1
1
0
1
1
1
0
0
1
0

So I want to ask whether the calculation of Octave in SIFT algorithm is right in opencv?

2013-03-07 01:08:15 -0600 asked a question Is local sensitive hashing algorithm only compatible with binary descriptors?

Hi,

I am trying to use local sensitive hashing algorithm in flann in opencv 2.4.4. Here is my code.

Ptr<IplImage> cluster_image = cvLoadImage("C:\\Users\\Administrator\\Pictures\\1.jpg");

vector<KeyPoint> cluster_keypoint;
Mat des;

description_detect(cluster_image,cluster_keypoint,des,SIFT_DESCRIPTION);//My function to extract the sift feature from image.//Descriptions are stored at variable des.

flann::Index my_index(des, flann::LshIndexParams(10, 10, 2));

When running this code to build the index of flann by lsh algo. The code assert that

"Opencv Error,unsupported format or combination of formats type=5"

I check code in miniflann.cpp. It seems that local sensitive hashing algorithm in flann are only compatible with CV_8U Mat type,other than CV_32F which is generated by sift.

However, other binary descriptors detected from ORB, Brief, BRISK, FREAK can produce CV_8U Mat type.

So my question is: Is local sensitive hashing algorithm only compatible with binary descriptors in opencv?

2012-08-17 06:14:32 -0600 received badge  Student (source)
2012-08-16 12:36:41 -0600 asked a question How to save and load FlannBasedMatcher

Hi,

Training an OpenCV DescriptorMatcher can be a time consuming operation if the training image set is large.Reference to this post

http://stackoverflow.com/questions/9248012/saving-and-loading-flannbasedmatcher?rq=1

There exists read and write method to load and save FlannBasedMatcher.

   virtual void read( const FileNode& );

   virtual void write( FileStorage& ) const;

I try this method and find that the trained DescriptorMatcher data is strange.My code is

    FlannBasedMatcher matcher;
    FileStorage matcher_fs(matcher_string.c_str(), FileStorage::WRITE); 

    vector<Mat> ref_his_vector;
    ref_his_vector.push_back(ref_his);
    matcher.add(ref_his_vector);
    matcher.train();

    matcher.write(matcher_fs);
    matcher_fs.release();

Mat ref_his is defined above

And the result on the disk is

image description

In fact,trainning data in the FlannBasedMatcher exists 154 descriptors

image description

I'm not sure whether there is anything wrong with my code.My opencv version is 2.4.2.