title: drawing line by tracking finger in opencv
body: <p>I am new to opencv, I want to detect if one finger is up it will draw a line on screen, I read some tutorials, I am tracking the finger Point successfully and it is being updated continuously.I do something like below. when I move the finger it does draw a short red line but it is transient and be disappeared right after. I need the drawing line to stay there but I have no idea how to do it and I can not find solution,I am really Hoping to hear from you, thank you very much. </p>
  
  <pre><code>int lastx = -1;
  int lasty = -1;
  
  void trackingfinger(....)
  {
  .........
  if(drawing == true)
     draw(BGR_frame,Point finger)
  }
  
  
  void draw(BGR_frame, Point finger)
  {
      int x = finger.x;
      int y = finger.y;
  
      if (lastx &gt; 0 &amp;&amp; lasty &gt; 0 &amp;&amp; x &gt; 0 &amp;&amp; y &gt; 0)
      {
      line(BGR_frame, Point(x, y), Point(lastx, lasty), Scalar(0, 0, 255), 2);
      }
  
      lastx = x;
      lasty = y;
  }
  
  int main (void)
  {
   while(true)
  {
  ..... the function is called here.
  }
  }
  </code></pre>