如何使用语音识别绘制形状? [英] how to draw shapes using speech recognition?

查看:359
本文介绍了如何使用语音识别绘制形状?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我正在研究WINDOWS FORMS,C#

抱歉打扰你,但我必须显示我正在进行语音识别的项目我实际上想要绘制一个形状(内置C#就像圆圈),当用户要求制作它时,任何人都可以告诉我连接两个逻辑的语法,

1;承认演讲

2;画圆圈



我所制作的编码模块是,



用于语音识别




hello everyone...
i am working on "WINDOWS FORMS, C#"
sorry to bother you, but i have to display my project in which i am working on "speech recognition" i actually want to draw a shape (in built in C# like circle), when a user asks to make it, can anyone tell me the syntax to connect the two logics,
1; recognize speech
2; draw circle

the coding modules i have made are,

FOR SPEECH RECOGNITION


using System.Speech.AudioFormat;
    using System.Speech;


    namespace speechexampl
{
        public partial class Form1 : Form
        {

            SpeechRecognizer rec = new SpeechRecognizer();


            public Form1()
            {

                InitializeComponent();

                rec.SpeechRecognized += rec_SpeechRecognized;

            }


            void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
            {

                lblLetter.Text = e.Result.Text;

            }


            void Form1_Load(object sender, EventArgs e)
            {

                var c = new Choices();
                for (var i = 0; i <= 100; i++)

                 c.Add(i.ToString());







var gb = new GrammarBuilder(c);

              var g = new Grammar(gb);

              rec.LoadGrammar(g);

              rec.Enabled = true;

          }





绘图对象





FOR DRAWING OBJECTS

Pen myPen2 = new Pen(System.Drawing.Color.Red, 3);
            Rectangle myRectangle2 = new Rectangle(95, 130, 100, 100);
            graphicsObj.DrawEllipse(myPen2, myRectangle2);

推荐答案

你没有使用语法。 />


这并不难。您必须为用户定义一种语言(命令列表),以便您的应用程序可以构建描述图像应如何绘制的对象图。



定义形状很容易,比如添加圆圈,填充圆圈等等。



定义如何选择已经绘制的对象,而不是简单。你打算怎么做?定义用户如何指定对象的大小,位置和方向也是如此。



这个项目并不专注于如何画对象。这很简单。困难的部分是如何以及如何让用户指定需要绘制的内容以及用户将使用哪些命令以及它们如何工作。所有这个项目都是建立和维护一个对象集合,告诉你的渲染代码如何绘制它们。
There is no "syntax" as you put it.

This isn't that hard. You have to define a language (list of commands) for the user to speak so you application can build a graph of objects that describe how the image should be painted.

Defining the shape is easy, like "Add Circle", "Fill Circle", or whatever.

Defining how to select an object that is already being drawn, not so easy. How are you going to do that? The same is also true for defining how the user is going to specify the size, location and orientation of the object.

This project is no so much focused on how to draw objects. That's easy. The hard part is how and are you going to have the user specify what needs to be drawn and what commands the user is going to use and how they work. All this project is about is building and maintaining a collection of objects that tell your rendering code how to draw them.


感谢以上所有,我已经解决了问题..它只是一个你们不愿意讲的代码行。
thanks for all above, i have solved the problem.. it was just a line of code that you people were reluctant to tell.


这篇关于如何使用语音识别绘制形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆