在Windows上的OpenCV 1.1中扩展GUI功能的最简单方法? [英] Simplest way to extend GUI functionality in OpenCV 1.1 on Windows?
问题描述
我在C中有一个大型实时计算机视觉项目,其GUI使用的是OpenCV 1.1.内置的HighGUI库. 其他人指出,OpenCV GUI库非常有限.
I have a large real time computer vision project in C with a gui that uses OpenCV 1.1's built-in HighGUI library. As others have pointed out, the OpenCV GUI library is very limited.
我想制作一个滑动条(trackbar)GUI元素,例如cvCreateTrackbar
,其值可以为负也可以为正. OpenCV当前仅将轨迹栏限制为正整数值.我不需要其他任何花哨的东西了,只是一个滑动条可以变成负数.
I'd like to make a slider bar (trackbar) GUI element like cvCreateTrackbar
that can have values that go either negative or positive. OpenCV currently limits trackbars to positive integer values only. I don't need anything else fancy, just a sliderbar that can go negative.
获得正负滑动条的最简单方法是什么?
What is the easiest way to get a slider bar that goes positive and negative?
我在Windows XP上使用mingw
和OpenCV 1.1.理想情况下,任何解决方案都应要求最低的依赖关系或库,并且应与Windows和mingw
配合使用.
I am on Windows XP using mingw
and OpenCV 1.1. Ideally any solution should require minimum dependencies or libraries, and should play nice with Windows and mingw
.
推荐答案
您可以在进度条类周围编写包装程序,以将您的值标准化到进度条的范围.例如,如果您的范围是-5到5(含5和5),请将该值加5,然后再将其发送到进度小部件. "+5"将范围从0调整为10.
You could write a wrapper around the progress bar class that normalizes your values to the range of the progress bar. For example, if your range is -5 to 5, inclusive, add 5 to the value before sending to the progress widget. The "+5" adjusts the range from 0 to 10.
您可能要考虑使用其他小部件,因为进度测量的最定义不会否定. (您的应用程序实际上是在取得负进度吗?)而且,大多数进度小部件都允许正增量,而不是绝对值.当应用程序运行时,它会向小部件添加增量.
You may want to consider using a different widget as most definitions of progress measurements don't go negative. (Is your application actually making negative progress?) Also, most progress widgets allow for a positive increment, different than an absolute value. As the application runs, it adds an increment to the widget.
那只是我的看法,我可能是错的." -丹尼斯·米勒.
"That's just my opinion, I could be wrong." -- Dennis Miller.
这篇关于在Windows上的OpenCV 1.1中扩展GUI功能的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!