小编Ami*_*ily的帖子

opencv使用waitKey()函数处理箭头键

我想处理箭头键.但是当我打印出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;
}
Run Code Online (Sandbox Code Playgroud)

keyboard opencv

8
推荐指数
1
解决办法
7926
查看次数

标签 统计

keyboard ×1

opencv ×1