OSX中的OpenCV轨迹栏性能 [英] OpenCV trackbar performance in OSX

查看:92
本文介绍了OSX中的OpenCV轨迹栏性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注意到,当窗口中出现跟踪条,并且摄像机或电影帧中的图像发生变化时,openCV的性能会大大降低.有什么办法可以解决这个问题?

I've just noticed that performance of openCV is drastically slowed down when a trackbar is present in a window with changing image from camera or a movie frame. What could be done resolve this issue?

推荐答案

解决方案是将轨迹栏移动到单独的窗口.对我来说,在OSX上,性能提高了4.7倍(从3 FPS到14).我不知道它是否总是像这样或在我的计算机上像这样,但是我之前从没有见过这样的线索,所以我决定分享.

The solution to that is to move trackbars to a separate window. For me on OSX the performance increased 4.7 times (from 3 FPS up to 14). I don't know if it works like this always or it's just like that on my computer but I haven't seen such a clue anywhere before so I decided to share.

string title = "My window";
int p = 2;

// Create a different window for controls
namedWindow(title + " - controls");
// I show an image once just to resize the window
imshow(title + " - controls", Mat::zeros(1, 500, CV_8UC1));
createTrackbar("Parameter", title + " - controls", &p, 3);

// Create a different window for actual image
namedWindow(title);
while (!done) {
    // Do some calculations
    flip(image, image, p);
    imshow(title, image);
}

这篇关于OSX中的OpenCV轨迹栏性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆