Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Getting error for mouse setback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message.

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("left video stream", ROI);

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }
} waitKey(0); return 0; }

image description

Getting error for mouse setback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message.

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("left video stream", imshow("image", ROI);

} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }
} waitKey(0); return 0;
}

image description

Getting error for mouse setback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message.

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("image", ROI);

} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

image description

Getting error for mouse setback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message.

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("image", ROI);

} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

image description

Getting error for mouse setback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message.message. It will great, if anyone help here. Thanks

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("image", ROI);

} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

image description

Getting error for mouse setback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message. It will great, if anyone help here. Thanks

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("image", ROI);

} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

image description

Getting error for set mouse setbackcallback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message. It will great, if anyone help here. Thanks

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

    }

    imshow("image", ROI);

} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

image description

Getting error for set mouse callback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message. It will great, if anyone help here. Thanks

include "opencv2/opencv.hpp"

using namespace std; using namespace cv;

vector<point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; }

 }
         } 
imshow("image", ROI);

ROI);
} waitKey(0); return 0; }

static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

image description

click to hide/show revision 9
None

updated 2017-10-26 09:18:16 -0600

berak gravatar image

Getting error for set mouse callback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message. It will great, if anyone help here. Thanks

include "opencv2/opencv.hpp"

#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;

vector<point>pt; cv; vector<Point>pt; Mat RectifiedImage; int main() { // read the video frame Mat RectifiedImage= imread("image.png"); imshow("Rectified Image", RectifiedImage); setMouseCallback("Rectified Image", onMouse, &pt); Mat ROI; while (true) { if (pt.size() <= 2) { int x = pt[0].x; int y = pt[0].y; int x1 = pt[1].x; int y1 = pt[1].y; ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y)); return false; } }
imshow("image", ROI);
} waitKey(0); return 0; }

} static void onMouse(int event, int i, int j, int flags, void* param) { Mat &RectifiedImage = ((Mat)param); *((Mat*)param); Point p; if (event == EVENT_LBUTTONDOWN) { p = { i,j }; pt.push_back(p); cout << i << j << endl; }

}

image description

Getting error for set mouse callback

Hi, I am trying to use mouse callback function to crop out the rectangular area by clicking twice on the image. Below is code and error message. It will great, if anyone help here. Thanks

#include "opencv2/opencv.hpp"
 using namespace std;
 using namespace cv;

 vector<Point>pt;
 Mat RectifiedImage;
 int main()
 {
 // read the video frame
frame.......
        Mat RectifiedImage= imread("image.png");
    frame;
    imshow("Rectified Image", RectifiedImage);
     setMouseCallback("Rectified Image", onMouse, &pt);
     Mat ROI;
     while (true)
     {
         if (pt.size() <= 2)
         {
             int x = pt[0].x;
             int y = pt[0].y;
             int x1 = pt[1].x;
             int y1 = pt[1].y;
             ROI = RectifiedImage(Rect(x, y, x1 - x, y1 - y));
             return false;
         }
        }                 imshow("image", ROI);   
 }
 waitKey(0);
 return 0;
 }

 static void onMouse(int event, int i, int j, int flags, void* param)
 {
     Mat &RectifiedImage = *((Mat*)param);
     Point p;
     if (event == EVENT_LBUTTONDOWN)
     {
         p = { i,j };
         pt.push_back(p);
         cout << i << j << endl;
                    }
             }

image description