簡體   English   中英

使用C ++ / python調整視頻捕獲輸入端口

[英]Adjust video capture input port using C++ / python

我有一個視頻捕獲設備(VCD),可從具有各種輸出端口(VGA,HDMI,DVI)的電視中獲取幀。 我使用C ++ / OpenCV閱讀這些框架,對其進行處理,然后在C ++ / Qt QLabel上顯示輸出。

當我更改輸入端口(DVI到HDMI或HDMI到VGA,...)時,出現了我的問題,那時我需要手動打開VCD的交叉開關對話框窗口並切換輸入端口。

顯示帶有ffmpeg命令行的命令窗口+視頻捕獲設備的交叉窗口

此外,對於每個輸入端口,我需要調整一些與顏色范圍,縮放比例和導線長度有關的參數。

我需要使用C ++或python代碼來自動化選擇帶有相應正確參數的正確輸入端口的過程。

我正在尋找一種方法來讀取視頻捕獲設備的交叉開關對話框的所有輸入引腳,並設置/取消所需的引腳。

提前致謝。

這是C ++ / WinAPI中的示例,說明如何在設置對話框中設置/取消VIDEO INPUT引腳。 這段代碼假定復選框是主對話框的子元素。 在某些情況下,它們嵌套在選項卡控件“自定義設置”中,因此在這種情況下,您首先需要找到該選項卡。

#include <windows.h>
#include <string>
#include <vector>
#include <map>
#include <iostream>


int main(int, char **)
{
    // Find the dialog
    HWND hwnd = FindWindowA(NULL, "%Your settings dialog caption%");

    if (hwnd == NULL)
    {
        std::cerr << "cannot find settings dialog" << std::endl;
        return 1;
    }

    std::map<std::string, HWND> options;

    // Get first dialog element
    HWND h = GetWindow(hwnd, GW_CHILD);

    char caption[250];

    std::vector<std::string> inputs{
        "1/HDMI",
        "2/DVI-D",
        "3/COMPONENT",
        "DVI",
        "4/VGA",
        "SOG",
        "5/SDI",
        "6/COMPOSITE",
        "7/S-VIDEO",
        "8/AUTO"
    };

    while (h != NULL)
    {
        // Get element text
        if (GetWindowTextA(h, caption, 250))
        {
            std::string scaption(caption);
            // Check the text, if it's in the list of the option, put it into map.
            if (std::find(inputs.begin(), inputs.end(), scaption) != inputs.end())
            {
                options[caption] = h;
            }
        }
        h = GetWindow(h, GW_HWNDNEXT);
    }

    // Check the 4/VGA option.
    SendMessageA(options["4/VGA"], BM_CLICK, 0, 0); 

    return 0;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM