0

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

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();
    }
4

0 回答 0