0

I am new in image processing and c++ programming. this is what i have done until now to be able to keep the coordinate of some certain points in a sequence of frame:

I could find the center of a circle in the frame1.

cv::HoughCircles( tmp2, circles, CV_HOUGH_GRADIENT, 1, 300, 300, 100);

       for( size_t i = 0; i < circles.size(); i++ ){

            Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
            cout << "center" << center.x << ", " << center.y << endl;
            Vector.push_back(std::make_pair(center.x,center.y));               //coordinates of center points

            int radius = cvRound(circles[i][2]);
            // circle center
            circle( tmp2, center, 3,  1 , -1, 8, 0 );           
             // circle outline
            circle( tmp2, center, radius,  1  , 3, 8, 0 );      

        }
            }
  1. what is this center point contains? does it contain pixel value in that point?
  2. if I have for example, 3 circle in frame1...is that a good way to copy(make_pair) them in a vector?
  3. how to track these center points in the frame2 to find their new coordinates?

thanks in advance..

user2758510
  • 159
  • 5
  • 20

1 Answers1

1
  1. Yes, center contains coordinates, it is structure with fields x and y.
  2. It depends on what do you need after this. How do you want to process them further?
  3. Multiple object tracking depends on which kind of images do you have. You cannot "track" just centers of the circles without any prior information. Is it synthetic circles, or just some real objects or something else? Check the first answer here, it is relevant.
old-ufo
  • 2,799
  • 2
  • 28
  • 40
  • 2
    I assume question 3 refers to the assignment problem. A bipartite graph with euclidean distances could be a valid answer. Edit: I found [this](http://stackoverflow.com/questions/10152710/best-matching-in-a-bipartite-graph-e-g-associating-labels-with-points-on-a-plot) too. – LovaBill Nov 20 '13 at 14:28
  • maybe I am making it complicated! Assume that I have the center point of a circle in current frame. I want to know what would be the coordinate of this certain point in the next frame. – user2758510 Nov 20 '13 at 14:31
  • @William: wow, you mean is it possible to calculate euclidean distances between two certain points in two frames? – user2758510 Nov 20 '13 at 14:33
  • @old: what do you mean with"without any prior information"? they are real objects. I am using one ball as an object. – user2758510 Nov 20 '13 at 14:34
  • 2
    Yes. But you'll have to create a class for each frame with a vector of points for all circles. Study C++ classes, std::vector<>, and you'll find a solution. – LovaBill Nov 20 '13 at 14:41
  • @William: I am getting confused!do I need to really Track a certain pixel when I want to get its coordinate in the next frames? – user2758510 Nov 20 '13 at 14:54
  • 1
    I mean, at least any information about how do your circles differs. For example, I have 3 ones in 1st image and 3 ones in second. Based on what I can say which is which? If they do not differ a lot in appearance, but moves smooth, @William gives a good point about bipartite graph. – old-ufo Nov 20 '13 at 15:00
  • I am new in this area, please let me know if I do not need any tracking algorithm to achieve what I want. – user2758510 Nov 20 '13 at 15:31
  • Do you want a ready answer from us without your investigation? Check things that are already suggested. – old-ufo Nov 20 '13 at 15:34
  • to be able to find the coordinate of a center point in a circle in a sequence of frames should I track them or no, just by finding corresponding pixel in the next frames it will be done? the object is a simple ball which moves slowly. – user2758510 Nov 20 '13 at 15:34
  • 1
    I don`t know what do you mean by "track". "To track" is to have coordinates of the object in the every frame. It might or might not need special "tracking" algorithm. For example, if you have a colored ball just use this example http://www.aishack.in/2010/07/tracking-colored-objects-in-opencv/. Or you can just do Hough transform in every image and then say "OK, Ball 1 is the biggest circle, Ball 2 is the smallest". It also give you coordinates of the balls for every frame. – old-ufo Nov 20 '13 at 15:42
  • @old-ufo: Thanks. I am getting tired of thinking and trying without any resulting that is the reason that why I am asking these questions. Hough does not work I think, since I want to find the coordinate of a certain pixel(in current frame) in a sequence of frames. if pixel1 in frame 1 has (3,8) coordinate, what would be its coordinate in next frames. – user2758510 Nov 20 '13 at 15:52
  • Sometimes it is better to learn some theory before trying. And Hough transform works in sense "give coordinates of the center of the circle". If you know which circle is which, you are done. – old-ufo Nov 20 '13 at 16:00