在 iPhone 上绘图

发布于 2024-09-11 23:28:12 字数 108 浏览 7 评论 0原文

我正在尝试为儿童开发一款 iPhone 应用程序,该应用程序能够通过触摸在屏幕上绘制字符,我想知道如何将绘制的字符与字母表的良好字符相匹配。我将如何比较两种形状(绘图和现有) 有什么想法吗? 一些代码?

I am trying to develop an iPhone application for children which will be able to draw characters on screen with touch and I want to know how to match the character drawn with good character of the alphabet. How will i compare the two shapes (drawing and existing)
Any idea??
some code?

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

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

发布评论

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

评论(3

入画浅相思 2024-09-18 23:28:12

使用 GLGestureRecognizer 您可以创建一个目录,它将根据“字母表”计算输入点数组之间的度量“你预先定义。

GLGestureRecognizer 是一个 Objective-C
实施 1 美元单笔划
识别器,一个简单的手势
识别算法(参见制作人员
以下)。它可以在这里找到
iPhone应用程序的形式
项目。它的实施超过了
几个晚上的过程
2009 年 4 月,亚当·普雷布尔 (Adam Preble)。

iPhone 演示项目
提供(Gestures.xcodeproj);一个
UIView子类接收触摸事件
并将它们发送到
GLGestureRecognizer 类同时
用白色绘制触摸的路径。
手势完成后,
重新采样的手势显示为绿色,
它的中心在红点处,以及
最佳匹配的名称、得分
(越低越好)和手势
方向。样本量为 16
示例中使用了点,其中
似乎足以满足非常基本的需求
形状。

Using GLGestureRecognizer you can create a catalogue and it will compute a metric between an input point array against an "alphabet" you predefine.

GLGestureRecognizer is an Objective-C
implementation of the $1 Unistroke
Recognizer, a simple gesture
recognition algorithm (see Credits
below). It is made available here in
the form of an iPhone application
project. It was implemented over the
course of a couple evenings in late
April 2009 by Adam Preble.

A demo iPhone project
(Gestures.xcodeproj) is provided; a
UIView subclass receives touch events
and sends them to the
GLGestureRecognizer class while
drawing the touched path in white.
Once the gesture is completed, the
resampled gesture is shown in green,
its center at the red dot, along with
the name of the best match, score
(lower is better), and gesture
orientation. A sample size of 16
points is used in the example, which
seems to be adequate for very basic
shapes.

意犹 2024-09-18 23:28:12

哇,这听起来是一项艰巨的任务。我想到的一种可能性是使用支持向量机。

1.) 生成绘图的图像,并通过将矢量附加到用户绘制的路径来“矢量化”它。

2.) 您需要支持向量来进行比较。我要做的是实施一个“培训应用程序”。让一些孩子画画(例如 10 次 A,10 次 B,等等……),将向量放入数据库中并将它们用作支持向量。

3.) 您需要一个评级算法,通过将用户绘图与支持向量进行比较来对用户绘图进行评级(这可能是其中最有趣的部分)。我可以考虑测量支持向量起点和终点到绘制向量的距离。距离最近的 svm 就是你取的字母。然后,您可能会引入一个距离,即“边界”,并将此边界之上的所有用户绘图视为无法识别。

第二种方法可能是使用字母生成图像(例如白色背景和黑色字母(非抗锯齿))。您再次生成用户绘图的图像,并将其大小调整为要比较的图像,尝试准确地“重叠”它。然后计算两个图像中匹配的黑色像素,并取出最匹配的字母。

但是,由于我实现了类似的东西,我可以看出 svm 方法更令人满意,因为如果结果不够好,您可以添加支持向量。精髓肯定是您的评级算法。

无论如何,听起来像是几周的工作。

编辑:由于这是一个有趣的领域,我做了一些研究并发现了一篇关于手写识别的论文。看看这个:http://risujin.org/cellwriter/。它基本上描述了我提到的支持向量机方法,并提供了一些可能对您有帮助的算法。

Wow, this sounds like a tough task. One possibility that comes to my mind would be to use a support vector machine.

1.) Generate an image of the drawing and "vectorize" it by attaching vectors to the path the user has drawn.

2.) You need support vectors to compare. What i would do is, implement a "training application". Let some kids draw (eg. 10 times an A, 10 times a B, aso...), put the vectors in a database and use them as support vectors.

3.) You need a rating algorithm which rates the user drawing by comparing it to the support vectors (this might be the most interesting part of it). I could think of measuring the distances of the support vectors start and end- points to the drawn vectors. The svm with the lowest distance is the letter you take. Then you might introduce a distance which is the "border", and take all user drawings above this border as unrecognized.

A second approach might be that you generate images with the Letters (eg. white background and black letter (non- anti aliased)). You generate again an image of the user drawing and resize it to the image to compare with, trying to "overlap" it exactly. Then you count the black pixels that matches in the two images and take the letter with the most matchings.

But, since i implemented something similar, i can tell that the svm approach is more satisfying since you can add support vectors if the result is not good enough. The quintessence is for sure your rating algorithm.

Anyhow sounds like a couple of weeks of work.

EDIT: Since this an interesting field i did some research and found a thesis about handwriting recognition. Have a look on this: http://risujin.org/cellwriter/. It basically describes the svm approach i mentioned and gives some algorithms that might help you.

不知所踪 2024-09-18 23:28:12

您始终可以使用手势识别 ...但这对于像这样的自定义场景来说非常困难。

否则,您可能会在 Quartz 至少会为您完成部分工作。我有兴趣看看你如何解决这个问题......这听起来像是一条相当困难/有趣的道路。

You could always use Gesture Recognition... but that's pretty difficult for a custom scenario like this.

Otherwise you may find something in Quartz that will do at least part of this for you. I'm interested in seeing how you solve this.. it sounds like a rather difficult/interesting road ahead.

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