Opencv(3.10) android- How to draw an object's trajectory
<p>I have a project in college where I have to draw the trajectory of an object based on the color of it. Is being built based on colorBlobDetection. This is part of the code I have so far:</p>

<pre><code> public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    mRgba = inputFrame.rgba();


    if (mIsColorSelected) {
        mDetector.process(mRgba);
        List&lt;MatOfPoint&gt; contours = mDetector.getContours();
        Log.e(TAG, "Contours count: " + contours.size());
        Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR);

        List&lt;Moments&gt; mu = new ArrayList&lt;Moments&gt;(contours.size());

        for (int i = 0; i &lt; contours.size(); i++) {
            mu.add(i, Imgproc.moments(contours.get(i), false));
            Moments p = mu.get(i);
            int xContour = (int) (p.get_m10() / p.get_m00());
            int yContour = (int) (p.get_m01() / p.get_m00());
            Point ponto = new Point(xContour, yContour);
            //Imgproc.line(mRgba, ponto, ponto, CONTOUR_COLOR, 5, Imgproc.LINE_AA, 0);
        }
</code></pre>

<p>At the moment I'm picking up the center of each contour.</p>

<p>Through the positions of the contours I want to draw their trajectories when they move</p>

<p>Ps. This 'Imgproc.line' was just to test if the center of each contour is correct.</p>

<p>Please help.</p>