我发现了一个有趣的网站,可以生成给定输入文本的“旋转字谜”,名为Sokumenzu / Side View Generator,它会生成以下动画结果:
我非常想了解它背后的算法。我尝试查看是否有任何公开的JavaScript可以帮助我理解,但它是一团混乱的混淆,而且我的语言掌握程度不够牢固,无法确定真正的工作是否在服务器端完成。
我大致了解了如何构建类似系统的轮廓,但它会有自己的缺点(如果真正的方法是硬编码,则可能有小优势):
预计算
显然,这不是使用的相同算法,因为它是基于逐个字符处理的。我想你可以采用类似的方法按单词进行处理,将整个卷的面部作为文本识别器的输入,但我相信他们可能已经做了更简单、更聪明和更高效的事情。
这个可怕的想法的一个优点是,通过重新训练识别器,您可以支持其他字符集。
有人知道这实际上是如何工作的吗?
我大致了解了如何构建类似系统的轮廓,但它会有自己的缺点(如果真正的方法是硬编码,则可能有小优势):
预计算
Define an nxnxn cube composed of equally sized sub-cubes
Each sub-cube may either contain a sphere or not
Create a virtual camera orthogonal to one of the cube's faces a fixed distance away
For each of the possible states of the cube:
Cast rays from the camera and build up an nxn matrix of which cells appear occupied from the camera's point of view.
Input this matrix into a neural network / other recognizer which has been pre-trained on the latin alphabet.
If the recognizer matches a character:
Add the state which triggered recognition to a hashtable indexed on the character it recognized.
Handle collisions (there should be many) by keeping the highest confidence recognition
For every key in the hashtable
Rotate the corresponding state in fixed increments recognizing characters as before
If a character other than the current key is recognized:
Add that character and the amount of rotation performed to a tuple in a list.
Store each of these lists in the hashtable indexed on the current key.
查询
Generate all of the permutations achieved by substituting each of the characters linked in the list associated with input character at that position.
Find the first dictionary word in the list of permutations
Visualize using the rotation information stored for each character
显然,这不是使用的相同算法,因为它是基于逐个字符处理的。我想你可以采用类似的方法按单词进行处理,将整个卷的面部作为文本识别器的输入,但我相信他们可能已经做了更简单、更聪明和更高效的事情。
这个可怕的想法的一个优点是,通过重新训练识别器,您可以支持其他字符集。
有人知道这实际上是如何工作的吗?