【发布时间】:2018-01-16 18:29:40
【问题描述】:
我想处理箭头键。但是当我打印出 waitKey() 函数的输入值时,它是 0。 我不知道为什么。 我尝试从 "int" 更改为 "char" ,但它不起作用。 我该如何解决这个问题。
int pos = 100;
imshow("image", image);
onChange(pos, (void *)&image);
createTrackbar("threshold", "image", &pos, 255, onChange, (void*)&image);
while (1) {
int Key = waitKey();
cout << Key << endl;
if (Key == 27) break;
if (Key == 2490368) {
pos--;
onChange(pos, (void *)&image);
}
if(Key == 2621440){
pos++;
onChange(pos, (void *)&image);
}
if (pos < 0 || pos > 255) pos = 0;
}
【问题讨论】: