title: How to distinguish between click and double-click in opencv
body: <p>In OpenCV, it seems a double-click action also triggers a single-click event. Here is a sample code. The single_click() is always called before double_click(). </p>
  
  <p>Is it possible to trigger double_click() without triggering single_click() first? </p>
  
  <p>Thanks!</p>
  
  <pre><code>void double_click() {
    std::cout &lt;&lt; "Double click.\n";
  }
  
  void thisMouseCallBack(int event, int x, int y, int flags, void *param) {
    if (event == cv::EVENT_LBUTTONDOWN) {
      single_click();
    }
    if (event == cv::EVENT_LBUTTONDBLCLK) {
      double_click(); 
    }
  }
  
  int main() {
     cv::Mat testImg(100, 500, CV_8UC3); 
     cv::namedWindow("thisWindow");
     cv::setMouseCallback("thisWindow", thisMouseCallBack, NULL); 
     cv::imshow("thisWindow", testImg); 
     cv::waitKey(-1);
     return 0;
  }
  </code></pre>