Ask Your Question

yes123's profile - activity

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] - points1t.at<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:

Thanks

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
    calcOpticalFlowPyrLK(
        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] ) {                     
     continue;
  }

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

}

This sometime prints:

(53,120)

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

2016-05-26 06:48:57 -0500 received badge  Notable Question (source)
2016-05-13 02:46:40 -0500 received badge  Popular Question (source)
2016-03-22 11:15:43 -0500 received badge  Taxonomist
2016-03-20 11:49:45 -0500 marked best answer Recovering images from motion blur knowing speed ?

Hello guys,

Let's say I have an Image took while the camera was moving (or the object was moving). Example:

I know the direction and the length of the movement (for this example direction is 0° and length is ~15 pixel)

Which way do you suggest me to correct this image?

Thanks

2016-02-25 21:47:22 -0500 received badge  Popular Question (source)
2016-02-22 06:08:17 -0500 marked best answer Calc eucliadian distance between two single point ?

I have

Point2f a(10,10);
Point2f b(100,100);

I would like to calc the distance (Euclidean) between these two points. Instead to write the manual function:

float euclideanDist(Point& p, Point& q) {
    Point diff = p - q;
    return cv::sqrt(diff.x*diff.x + diff.y*diff.y);
}

Is there any OpenCV function? (That's pretty similary to what does descriptormatcher.match() with L2_NORM)

2016-02-17 18:57:57 -0500 marked best answer Scale a RECT from its center ?

I have a

Rect ROI(tl,br);

Having for example scale = 0.5 How can I calc a new ROI that it's area is 0.5 of the original area while the center is the same?

I have wrote a function:

void scaleROI( Point2f& tl,Point2f& br, const Point2f& queryCenter, float scale  ) {


    //> TopLeft
    float shiftX = abs(queryCenter.x -tl.x);
    float shiftY = abs(queryCenter.y -tl.y);

    shiftX = shiftX * scale;
    shiftY = shiftY * scale;

    tl.x = queryCenter.x - shiftX;
    tl.y = shiftY + queryCenter.y;

    //> BottomRight

    shiftX = abs(br.x - queryCenter.x);
    shiftY = abs(br.y - queryCenter.y);

    shiftX = shiftX * scale;
    shiftY = shiftY * scale;

    br.x = queryCenter.x + shiftX;
    br.y = queryCenter.y - shiftY;



}

This calc a new topLeft and bottomRight point by scaling the shift between these points and the center.

I would like to know if there is a built in, or a better way to do it.

Sadly, ROI * scale isn't allowed