OpenFrameworks画笔工具实现

发布于 2024-12-19 20:04:47 字数 266 浏览 1 评论 0原文

我正在研究开放框架。

我制作了一个应用程序,可以从实时提要中提取用户的脸部并将其投影到所选颜色的矩形上。现在我希望用户能够在脸部背景中绘制一些东西。为此,我需要实现一个画笔工具。

面临的问题:

  1. 如果我将 ofSetBackgroundAuto() 设置为 false,则面部不会从下一帧刷新。
  2. 如果ofSetBackgroundAuto设置为true,那么画笔就不会绘制,因为背景会一次又一次刷新。

请帮忙!!

I am working on Open Frameworks.

I have made an application that extracts the face of the user from the live feed and projects it on a rectangle of chosen colour. Now I want the user to be able to draw something in the background of the face. To do that I need to implement a brush tool.

Problems faced:

  1. If I set the ofSetBackgroundAuto() to false, the face does not refresh from the next frame.
  2. If ofSetBackgroundAuto is set to true, then the brush doesn't draw, because the background is again and again refreshed.

Please help !!

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

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

发布评论

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

评论(1

逆光下的微笑 2024-12-26 20:04:47

您可以使用 Fbo 的帧缓冲区对象 https://github .com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/gl/ofFbo.h

ofFbo fbo;
setup(){
    fbo.allocate(ofGetWidth(), ofGetHeight());
}

draw(){
    fbo.begin();
    //draw your brush
    fbo.end();

    fbo.draw();

    //draw face
}

You can use a frame buffer object ofFbo https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/gl/ofFbo.h

ofFbo fbo;
setup(){
    fbo.allocate(ofGetWidth(), ofGetHeight());
}

draw(){
    fbo.begin();
    //draw your brush
    fbo.end();

    fbo.draw();

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