I am having a video capture device (VCD) that acquires frames from a TV which have various output ports (VGA, HDMI, DVI). I read these frames using C++/OpenCV, process them and then show the output on a C++/Qt QLabel.
我有一个视频捕获设备(VCD)从电视获取帧,具有各种输出端口(VGA,HDMI,DVI)。我使用C ++ / OpenCV读取这些帧,处理它们然后在C ++ / Qt QLabel上显示输出。
My problems show up when I change the input port (DVI to HDMI or HDMI to VGA,...), at then I need to manually open the crossbar dialog window for the VCD and switch the input port.
当我改变输入端口(DVI到HDMI或HDMI到VGA,......)时出现问题,然后我需要手动打开VCD的交叉开关对话窗口并切换输入端口。
Shows command window with ffmpeg command line + crossbar window for the video capture device
显示命令窗口,其中包含视频捕获设备的ffmpeg命令行+ crossbar窗口
Moreover, for each input port, I need to adjust some parameters relating to color range, scaling size and wire's length.
此外,对于每个输入端口,我需要调整一些与颜色范围,缩放尺寸和导线长度相关的参数。
I need to automate this process of selecting the right input port with the corresponding right parameters using a C++ or python code.
我需要使用C ++或python代码自动执行使用相应的正确参数选择正确输入端口的过程。
I was searching for a way to read all the input pins of the crossbar dialog box for the video capture device and this set/unset the required pins.
我正在寻找一种方法来读取视频捕获设备的交叉开关对话框的所有输入引脚,并设置/取消设置所需的引脚。
Thanks in advance.
提前致谢。
1 个解决方案
#1
0
Here is the example in C++/WinAPI how you can set/unset the VIDEO INPUT
pins on settings dialog. This code assumes, that checkboxes are children elements of the main dialog; there can be case, when they are nested inside the tab control "Custom settings", so in this case you need find the that tab at first.
以下是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;
}
#1
0
Here is the example in C++/WinAPI how you can set/unset the VIDEO INPUT
pins on settings dialog. This code assumes, that checkboxes are children elements of the main dialog; there can be case, when they are nested inside the tab control "Custom settings", so in this case you need find the that tab at first.
以下是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;
}