Ask Your Question

yes123's profile - activity

2020-11-30 03:23:09 -0500 received badge  Notable Question (source)
2020-11-30 01:04:20 -0500 marked best answer Object recognition by edge (or corners) matching ?


I would like to develop, for academic purpouse, an object recognition system that uses (among other things) edges or corners matching.

Basically I extract corner information on my model image then i try to find this object inside a query image using corner information.

Do you have any hint?

2020-11-15 01:31:00 -0500 marked best answer Removing selected rows from a Mat ?

For some reasons I need to filter out rows of a Mat. (I need to filter out some descriptors of ORB)

Which way do you suggest me? I haven't find any method to remove a single row from a Mat. So I was thinking I could iteratively inserting the good rows in a new Mat.

C++ pseudocode:

Mat desc;
matcher->match( myPreviousDesc, desc, matches );

for(auto i=0;i<matches.size();i++) {
   if (some conditions) {
      Remove the ith row of desc:
      erase( desc.row( matches[i].queryIdx ) );

? How would you erase a single row from a Mat after checking for some conditions (or adding only the selected row in a new Mat) ?

2020-10-28 17:39:29 -0500 received badge  Favorite Question (source)
2020-10-23 14:42:47 -0500 received badge  Good Question (source)
2020-09-26 07:19:16 -0500 received badge  Nice Question (source)
2020-05-05 15:43:10 -0500 received badge  Popular Question (source)
2019-11-24 23:22:50 -0500 received badge  Famous Question (source)
2019-11-06 07:27:15 -0500 received badge  Famous Question (source)
2019-08-06 03:56:41 -0500 received badge  Notable Question (source)
2019-07-25 03:37:34 -0500 received badge  Famous Question (source)
2019-04-21 22:37:51 -0500 received badge  Popular Question (source)
2018-12-18 04:30:15 -0500 received badge  Notable Question (source)
2018-12-02 17:07:32 -0500 received badge  Notable Question (source)
2018-10-28 19:20:17 -0500 received badge  Popular Question (source)
2018-10-13 10:16:20 -0500 marked best answer Wait for a mouse click?

I have a video. I would like to show the next frame only if the user clicks on a pixel on the current frame.

(The user must select a point in each frame)

Without using waitKey(0) I could I make opencv waiting for the mouse click before showing the next frame?

2018-09-22 17:12:09 -0500 received badge  Good Answer (source)
2018-08-30 10:55:52 -0500 marked best answer check ransac outlier before perspectiveTransform ?

Hello guys,

I would like to draw outliers found by ransac with the classic method:

H = findHomography( obj, scene, CV_RANSAC );

I saw in a snippet one can do something like:

Mat points1t; perspectiveTransform(Mat(points1), points1t, H12);
for( size_t i1 = 0; i1 < points1.size(); i1++ ) {
    if( norm(points2[i1] -<Point2f>((int)i1,0)) <= maxInlierDist ) // inlier
        matchesMask[i1] = 1;

But I don't understand why we need to call perspectiveTransform to find out which are the outlier if the outlier themself are calculted with the precedent istruction (findHomography) ?

2018-08-30 10:55:52 -0500 received badge  Nice Answer (source)
2018-07-13 09:01:20 -0500 received badge  Nice Question (source)
2018-07-12 14:40:37 -0500 received badge  Notable Question (source)
2018-05-01 15:54:36 -0500 received badge  Notable Question (source)
2018-03-05 04:19:37 -0500 received badge  Famous Question (source)
2018-01-23 16:55:05 -0500 marked best answer How to know if two Mat point to the same data?

I have two

Mat a,b;

Eventually in the code it could happen

a = b;

Is there any way to check whenever a and b points to the same data pointer (within code)?

(Without drawing stuff on one image and showing the other)

2017-11-29 17:55:56 -0500 marked best answer Check if homography is good

Basically I a am using a function

bool niceHomography(const CvMat * H)
  const double det = cvmGet(H, 0, 0) * cvmGet(H, 1, 1) - cvmGet(H, 1, 0) * cvmGet(H, 0, 1);
  if (det < 0)
    return false;

  const double N1 = sqrt(cvmGet(H, 0, 0) * cvmGet(H, 0, 0) + cvmGet(H, 1, 0) * cvmGet(H, 1, 0));
  if (N1 > 4 || N1 < 0.1)
    return false;

  const double N2 = sqrt(cvmGet(H, 0, 1) * cvmGet(H, 0, 1) + cvmGet(H, 1, 1) * cvmGet(H, 1, 1));
  if (N2 > 4 || N2 < 0.1)
    return false;

  const double N3 = sqrt(cvmGet(H, 2, 0) * cvmGet(H, 2, 0) + cvmGet(H, 2, 1) * cvmGet(H, 2, 1));
  if (N3 > 0.002)
    return false;

  return true;

to check whatever the homography is good or not (I have taken it from BRIEF_demo). Can anyone explain why we check the determinant like that, is there any theory behind it?

To understand what I am talking about, that function avoids homography like this:


2017-09-07 07:37:15 -0500 received badge  Popular Question (source)
2017-08-30 07:39:41 -0500 received badge  Popular Question (source)
2017-08-07 08:53:36 -0500 received badge  Famous Question (source)
2017-07-31 07:09:40 -0500 marked best answer Make a collage with other images

I have a vector<Mat> with images with different size.

Then I have a bigger image (let's say 640x480) I want to make a grid collage like this:

image description

With variable numbers of cols. How would you do that?

2017-07-19 08:09:12 -0500 marked best answer matchShapes() example

Hello Guys,

I would like to use matchShapes() function for finding an object inside a query image.

Let's say I have a model image of a book, i want to extract its shape and then try to find this book (its shape) inside another image.

I have googled a lot but couldn't find any real example on how to use matchShapes to achive this. The documentation lacks. Can someoen make a little example in C++ ?

Thanks a lot! (Note I know I can use SIFT/ORB etc, but i want to use matchShapes())

2017-06-08 04:10:41 -0500 received badge  Famous Question (source)
2017-06-01 22:46:30 -0500 received badge  Famous Question (source)
2017-05-31 02:50:28 -0500 received badge  Notable Question (source)
2017-04-25 15:41:57 -0500 received badge  Popular Question (source)
2017-03-21 09:37:29 -0500 received badge  Famous Question (source)
2017-01-13 13:47:07 -0500 received badge  Famous Question (source)
2016-11-23 04:09:01 -0500 marked best answer calcOpticalFlowPyrLK doesn't respect window size? [bug ?]

I am trying to use optical flow with opencv 2.4.5: calcOpticalFlowPyrLK()

I am using similar parameters to the demo of the opencv:

    Size winSize(6,6);     // Small window size
        prevFrame, currentFrame, points[0], points[1], 
        status, err, winSize,
        0, termcrit, 0, 0.001             // Only the input image

But as you can see I have set the maxLevels to 0 (so it will process only the current layer).

The problem is that this function sometimes returns a distance between points of over 100, if I do:

for(int i=0;i<points[1].size();i++) {
 if( !status[i] ) {                     

 cout << points[1][i] - points[0][i] << endl;


This sometime prints:


Meaning that y has a difference of over 120 pixels. Is that normal with a window size of only (6,6)? Note that this happens even if i give more layers in the pyramid.

Note that this happens especially when a point gets occluded or goes out of the scene

2016-10-28 00:27:57 -0500 received badge  Popular Question (source)
2016-10-15 07:47:31 -0500 received badge  Popular Question (source)
2016-09-19 04:23:44 -0500 received badge  Notable Question (source)
2016-08-18 01:53:39 -0500 received badge  Notable Question (source)
2016-08-12 05:59:09 -0500 received badge  Notable Question (source)
2016-06-21 01:56:37 -0500 received badge  Popular Question (source)
2016-06-02 20:48:33 -0500 marked best answer How to match 2 HOG for object detection?

Basically I am implementing a system of object detection. I have already implemenet SIFT and ORB for detection.

Now I would like to add HOG matching. I can extract HOG feature by doing:

Mat image(imread("object.jpg",1));
vector<float> features;
vector<Point> locations;
HOGDescriptor *hog = new HOGDescriptor();
hog->compute(image,featjres,Size(8,8), Size(32,32),locations);

Now I would like to use this information to find a match in a query image containg the object, I don't want to use SVM. Any sample code?

And if the SVM is the only way, how can I train it with my model image? (Sample code if you can thanks)

I wonder why it is not possibile to match it like we were matching SIFT descriptor and then doing a sort of ratio test =/
The SVM classifier needs training and it time consuming