c ++控制台窗口不会输入,但图像窗口会

时间:2013-07-30 21:31:46

标签: c++ console

我正在使用c ++ opencv和控制台窗口编写程序。我希望能够有一个帮助菜单,用户可以在其中输入所需的阈值。我遇到的问题是输入仅在选择图像窗口时有效,而在选择控制台窗口时则不起作用。输入不在main中,在newDepthSample上有void(如下所示。我想在选择控制台窗口时获取输入,它们在选择图像窗口时工作正常。代码的简短示例如下:

void changeItems()
{
    int input = 0;
    cout << "Welcome: Here is where to set up the proper image quality\n";
    cout << "Press 'h' for the help menu and 'x' to leave the loop\n";
    char keyInputs = 'a';

    while(keyInputs != 'x')
    {
        cin >> keyInputs;

        if( keyInputs == 'h' )
        {

            cout << "help menu\n";

        }

    }
    cout << "Leaving the loop";

    changeValues = 0;
}
void onNewDepthSample(DepthNode node, DepthNode::NewSampleReceivedData data)
{
    //printf("Z#%u: %d\n",g_dFrames,data.vertices.size());
    int p[3];
    int circleTemp[6000] ={0};
    int circleTempVal = 0;
    int resultsTotalAfterRemove = 0;
    int resultsTotalAfterRemoveVideo = 0;
    float robotx = 0;
    float roboty = 0;
    char * cCoordinates = new char[100];
    char * cDepth = new char[100];

    p[0] = CV_IMWRITE_JPEG_QUALITY;
    p[1] = 100;
    p[2] = 0;
    int32_t w, h;
    FrameFormat_toResolution(data.captureConfiguration.frameFormat,&w,&h);
    if(changeValues != 0)
    {
        changeItems();
    }

0 个答案:

没有答案