c++ - OpenCV MouseEvent Closing Program -


i'm trying use opencv mouse events reason closing program.

the code i'm using.

#include "stdafx.h" #include "opencv2/highgui/highgui.hpp" #include <iostream>  using namespace std; using namespace cv;  void callbackfunc(int event, int x, int y, int flags, void* userdata) {  if  ( event == event_lbuttondown )  {      cout<<"deseja salvar o ponto  (" << x << ", " << y << ") ? (1) sim (0) nao" << endl;      int option;      cin>>option;      if(option == 1)       cout << "o ponto (" << x << ", " << y << ") foi salvo com sucesso!" << endl;    }  }  int main(int argc, char** argv) { mat img = imread("pic.png");  if ( img.empty() )   {        cout << "error loading image" << endl;       return -1;   }   namedwindow("my window", 1);  setmousecallback("my window", callbackfunc, null);  imshow("my window", img);  waitkey(0);    return 0;  } 

the problem is: works fine time (it can 10 points) , close program. want undefined number of points .does know what's going on?

please help!!!!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -