【opencv】为什么去掉那句 if (cvWaitKey(15) == 27)break;后运行时鼠标一直打转控制不了?
#include<highgui.h>#include<cv.h>intg_switch_value=0;voidswitch_callback(intposition)...
#include<highgui.h>
#include<cv.h>
int g_switch_value=0;
void switch_callback(int position)
{
cvSetTrackbarPos("switch", "window", position);
}
int main()
{
cvNamedWindow("window",1);
cvCreateTrackbar("switch", "window", &g_switch_value, 1, switch_callback);
while (1)
{
if (cvWaitKey(15) == 27)break;
if (g_switch_value == 1)break;
}
cvDestroyWindow("window");
} 展开
#include<cv.h>
int g_switch_value=0;
void switch_callback(int position)
{
cvSetTrackbarPos("switch", "window", position);
}
int main()
{
cvNamedWindow("window",1);
cvCreateTrackbar("switch", "window", &g_switch_value, 1, switch_callback);
while (1)
{
if (cvWaitKey(15) == 27)break;
if (g_switch_value == 1)break;
}
cvDestroyWindow("window");
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询