我试着在几个网站上搜索我的问题,但仍然没有答案。我的问题是看起来像这个http://opencv-users.1802565.n2.nabble.com/Runtime-error-for-createTrackbar-in-control-panel-td7550203.html
我尝试使用Qt集成在OpenCV窗口中创建控制面板,如OpenCV文档示例functions.html中所示。
通过这个函数,它应该在图像窗口(带有'imshow()')和控制面板(在其他窗口中,称为控制面板)之间分离。
但是,当运行到代码'createTrackbar(num1,NULL,&val1,255,Null)时,它不工作;‘错误消息’'Null指针‘显示。但是,如果我将参数更改为窗口名称,则为work!
我的代码是这样的:
#include <...opencv.hpp>
#include <...highgui.hpp>
char* num1 = "testTrack";
int val1 = 100;
const string mainwin = "show";
int main()
{
while (true)
{
frame = capture();
createTrackbar(num1, NULL, &val1 , 255, NULL);
process_frame = image_processing(frame);
imshow(mainwin, process_frame);
// [Exit the system]
if (condition)
break;
}
}你有什么想法吗?
发布于 2014-11-24 03:20:22
我不知道这个答案在这么长时间后是否有用,但是您需要使用空字符串而不是空指针。
试着:
createTrackbar(num1, "", &val1 , 255, NULL);https://stackoverflow.com/questions/19442523
复制相似问题