OpenCV 鼠标调用?
我正在使用 cvSetMouseCallback 来跟踪鼠标点击。但是,我需要向传递给 cvSetMouseCallback 的函数传递多个参数。然而,cvSetMouseCallback 只接受一个参数来将数据传递给它调用的函数。如果有多个参数,我该如何做到这一点?
例如:
cvSetMouseCallback ("Window", function, argumentPassedintofunction);
void function (int event, int x, int y, int flags, void* param, CvRect *drawnRect, IplImage *skinSegment, IplImage *colourSpaceImg, CvHistogram *skin, IplImage *planes [])
{
}
正如您所看到的,我需要向 function () 传递多个参数,但 cvSetMouseCallback 只允许传递一个参数。
我不想访问操作系统进行鼠标调用(所以不是句柄和任何那,我严格地想坚持使用opencv)
另外,使参数成为全局变量也不是一个选择。
I am using cvSetMouseCallback to track mouse clicks. However I need to pass in more than one argument to the function that is passed in to cvSetMouseCallback. However cvSetMouseCallback only accepts one parameter to pass in data to the function it calls. How I would I do this with more than one argument?
For example:
cvSetMouseCallback ("Window", function, argumentPassedintofunction);
void function (int event, int x, int y, int flags, void* param, CvRect *drawnRect, IplImage *skinSegment, IplImage *colourSpaceImg, CvHistogram *skin, IplImage *planes [])
{
}
So as you see, I need to pass in more than one parameter to function () but cvSetMouseCallback only allows one argument to be passed in.
I DO NOT WANT TO ACCESS THE OS FOR MOUSE CALLS (so not handles and any of that, I strictly want to stick to opencv)
Also making the arguments global variables isn't an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使函数接受包含所有参数的结构。
You can make function take in a struct which contains all the parameters.