是否有一些众所周知的算法可以将用户的绘图变成平滑的形状?

发布于 2024-11-25 12:06:46 字数 430 浏览 3 评论 0原文

我的要求: 用户应该能够手绘一些东西。然后,当他取下笔(或手指)后,算法会对其进行平滑并将其转换为一些基本形状。

在此处输入图像描述

首先,我想将绘图转换为尽可能与原始图像相似的矩形。 (当然,如果用户故意绘制其他内容,这将不起作用。)现在我正在计算平均 x 和 y 位置,并且正在区分水平线和垂直线。但它还不是一个矩形,而是某种正交线。

我想知道是否有一些众所周知的算法,因为我在一些触摸屏应用程序中见过几次。你有什么阅读技巧吗?

更新:也许模式识别算法可以帮助我。有些手机会要求用户绘制图案来解锁按键。

PS:我认为这个问题与特定的编程语言无关,但如果您有兴趣,我将使用 RaphaelGWT 构建一个 Web 应用程序。

My requirements:
A user should be able to draw something by hand. Then after he takes off his pen (or finger) an algorithm smooths and transforms it into some basic shapes.

enter image description here

To get started I want to transform a drawing into a rectangle which resembles the original as much as possible. (Naturally this won't work if the user intentionally draws something else.) Right now I'm calculating an average x and y position, and I'm distinguishing between horizontal and vertical lines. But it's not yet a rectangle but some kind of orthogonal lines.

I wondered if there is some well-known algorithm for that, because I saw it a few times at some touchscreen applications. Do you have some reading tip?

Update: Maybe a pattern recognition algorithm would help me. There are some phones which request the user to draw a pattern to unlock it's keys.

P.S.: I think this question is not related to a particular programming language, but if you're interested, I will build a web application with RaphaelGWT.

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

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

发布评论

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

评论(2

娇柔作态 2024-12-02 12:06:46

Douglas-Peucker 算法用于地理(以简化 GPS例如跟踪)我想它也可以用在这里。

The Douglas-Peucker algorithm is used in geography (to simplify a GPS track for instance) I guess it could be used here as well.

戒ㄋ 2024-12-02 12:06:46

根据您的描述,我猜您正在寻找矢量化算法。以下是一些可能对您有帮助的提示:

上面有很多资源矢量化算法,我相信您一定能够找到适合您需求的东西。但我不知道这些算法的实现有多复杂,

Based on your description I guess you're looking for a vectorization algorithm. Here are some pointers that might help you:

There are a lot of resources on vectorization algorithms, I'm sure you'll be able to find something that fits your needs. I don't know how complex these algorithms are to implement them, though,

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