增强现实图像处理

发布于 2024-08-18 22:27:54 字数 116 浏览 3 评论 0原文

我需要一些有关增强现实的帮助。 我已经开发了一个小应用程序。现在我想使用形状检测算法或特别是圆形检测算法。我希望在我的相机打开后它应该只检测圆形,如果它得到圆形,它应该被替换为一些相应的图像。 我希望你明白我想做什么。

I need some help on Augmented Reality.
I have develop a small application.NOw I want to use shape detection algorithm or specially circle detection algorithm.I want that after my camera get open It should only detect circles and if it gets circles it should get replaced with some corresponding image.
I hope you understood what I want to do.

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

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

发布评论

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

评论(1

冷…雨湿花 2024-08-25 22:27:54

要添加(圆形)的形状检测算法,您可以考虑使用 OpenCV 中的霍夫变换进行圆形检测。取自 OpenCV 教程网站,以下是一些片段:

    // Loads an image
    cv::Mat src = cv::imread( filename, cv::IMREAD_COLOR );
    cv::Mat gray;
    cv::cvtColor(src, gray, cv::COLOR_BGR2GRAY);
    cv::medianBlur(gray, gray, 5);
    cv::vector<Vec3f> circles;
    cv::HoughCircles(gray, circles, cv::HOUGH_GRADIENT, 1,
                 gray.rows/16,  // change this value to detect circles with different distances to each other
                 100, 30, 1, 30 // change the last two parameters
            // (min_radius & max_radius) to detect larger circles
    );
    for( size_t i = 0; i < circles.size(); i++ )
    {
        cv::Vec3i c = circles[i];
        cv::Point center = cv::Point(c[0], c[1]);
        // circle center
        cv::circle( src, center, 1, cv::Scalar(0,100,100), 3, cv::LINE_AA);
        // circle outline
        int radius = c[2];
        cv::circle( src, center, radius, cv::Scalar(255,0,255), 3, cv::LINE_AA);
    }

OpenCV 可以完成您提到的任务,并且与 AR 应用程序兼容。

To add shape detection algorithm for (circle), you can consider using circle detection with Hough Transform from OpenCV. Taken from OpenCV tutorial website, here are some snippets:

    // Loads an image
    cv::Mat src = cv::imread( filename, cv::IMREAD_COLOR );
    cv::Mat gray;
    cv::cvtColor(src, gray, cv::COLOR_BGR2GRAY);
    cv::medianBlur(gray, gray, 5);
    cv::vector<Vec3f> circles;
    cv::HoughCircles(gray, circles, cv::HOUGH_GRADIENT, 1,
                 gray.rows/16,  // change this value to detect circles with different distances to each other
                 100, 30, 1, 30 // change the last two parameters
            // (min_radius & max_radius) to detect larger circles
    );
    for( size_t i = 0; i < circles.size(); i++ )
    {
        cv::Vec3i c = circles[i];
        cv::Point center = cv::Point(c[0], c[1]);
        // circle center
        cv::circle( src, center, 1, cv::Scalar(0,100,100), 3, cv::LINE_AA);
        // circle outline
        int radius = c[2];
        cv::circle( src, center, radius, cv::Scalar(255,0,255), 3, cv::LINE_AA);
    }

OpenCV can do the task as you mentioned, and is compatible for AR application.

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