OpenCV 进度条

发布于 2024-11-04 13:23:37 字数 38 浏览 3 评论 0原文

可以在 OpenCV 应用程序中实现进度条吗?也许在图像之上?

Can a progressBar be implemented in an OpenCV application? Maybe on top of an image?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千笙结 2024-11-11 13:23:37

我不知道有任何内置的 ProgressBar 类,但您可能可以模拟一个类,或者通过在彼此之上绘制两个矩形来编写自己的类。一个代表全面,另一个代表进步。

所以类似的东西...

I am unaware of any built in progressBar class but you can probably emulate one or write your own by drawing two rectangles on top of each other. One representing the full range and the other representing the progress.

So something like that ...

对你而言 2024-11-11 13:23:37

如果你只想使用 OpenCV,我使用的是将 0 到 1 之间的数字乘以在窗口中打开的图像。 IE:
如果你使用新的C++ Opencv:

Mat A=...some image that show for example the text "DONE" or your dog or cat :P
double alpha=0;
int N=100;//steps
for(int i=1;1<N;i++)
{
// some process...
alpha=i/N;
A=A*alpha;// and alpha is a scalar
// if you are using the old C Opencv use cvConvertScale
//then show A
imshow("Progress Image...",A)
waitKey(666);
}

我认为效果非常好,比简单的进度条更好。你只需要opencv库,如果图像很小对CPU来说很轻。

但是如果你想看到一个“Bar”,最简单的方法是使用 line 函数:

C++: void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)

pt1 是图像一个角落的点,pt2 是 x 或 Y 轴变化的点,例如在其他代码中:

axis=(int)(image.size().width*(i/N));

If you want to use only OpenCV, what I use is to multiply a number between 0 and 1 to an image open in a window. i.e:
if you are using the new C++ Opencv:

Mat A=...some image that show for example the text "DONE" or your dog or cat :P
double alpha=0;
int N=100;//steps
for(int i=1;1<N;i++)
{
// some process...
alpha=i/N;
A=A*alpha;// and alpha is a scalar
// if you are using the old C Opencv use cvConvertScale
//then show A
imshow("Progress Image...",A)
waitKey(666);
}

The effect is very nice in my opinion, better than a simple progress Bar. you only need the opencv library, if the image is small is very light to the CPU.

But if you want to see a "Bar" the easiest way is to use the line function:

C++: void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)

pt1 is a point in one corner of your image, pt2 is the point in where their x or Y axis is changing for example in the other code:

axis=(int)(image.size().width*(i/N));
究竟谁懂我的在乎 2024-11-11 13:23:37

如果您确实需要一个用户友好的 GUI,为什么不使用 Qt。它可以轻松地与 opencv 集成,并且有很多工具可以定制和创建 GUI。看一下Qt官方提供的集成opencv的链接。 http://qt-project.org/wiki/OpenCV_with_Qt

If you really need a user friendly GUI, why don't you use Qt. It can be easily integrated with opencv and there are lot for tools to customize and create GUI. Take a look at the official link provided by Qt to integrate opencv. http://qt-project.org/wiki/OpenCV_with_Qt

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文