السبت، 7 يونيو 2014

web engine by sound

this project about say the name of the site u need to visit it and the browser go to the destination
the code by C#

at first we need to add


using System.Speech.Recognition;
using System.Speech.Synthesis;

to the code  to enable it









using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.Threading;
namespace webenginbysound
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        SpeechSynthesizer sSyn = new SpeechSynthesizer();
        PromptBuilder pBuilder = new PromptBuilder();
        SpeechRecognitionEngine sRecognition = new SpeechRecognitionEngine();
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            /************************************************
             * text to speech
            pBuilder.ClearContent();
            pBuilder.AppendText(toolStripTextBox1.Text);
            sSyn.Speak(pBuilder);
            **************************************************/
            Choices sList = new Choices();
            sList.Add(new string[] { "google", "yahoo", "facebook", "twitter", "Exit" });
            Grammar gRamer = new Grammar(new GrammarBuilder(sList));
            try
            {
                sRecognition.RequestRecognizerUpdate();
                sRecognition.LoadGrammar(gRamer);
                sRecognition.SpeechRecognized +=sRecognition_SpeechRecognized;
                sRecognition.SetInputToDefaultAudioDevice();
                sRecognition.RecognizeAsync(RecognizeMode.Multiple);
            }
            catch
            {
                return;
            }
        }

        private void sRecognition_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {

            if (e.Result.Text == "Exit")
                Application.Exit();
            else
                toolStripTextBox1.Text = e.Result.Text.ToString()+".com";

// that 's the result and i but .com to make acces to the search easy way


        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(toolStripTextBox1.Text);
        }
    }
}


If we need to add more than word we can do  it by add

 sList.Add(new string[] { "google", "yahoo", "facebook", "twitter", "Exit" });

to this line the words

this is the code for go in browser

webBrowser1.Navigate(toolStripTextBox1.Text);

if we need it run after we speak directly

we can put it in the
        private void sRecognition_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)

if i need the code to read the web site name i can use this code 
            pBuilder.ClearContent();
            pBuilder.AppendText(toolStripTextBox1.Text);
            sSyn.Speak(pBuilder);
this will be the function to read the site

 string addrese="";
        private void sRecognition_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {

         
            if (e.Result.Text == "Exit")
                Application.Exit();
            else
                toolStripTextBox1.Text = e.Result.Text.ToString()+".com";
            if (Convert.ToString(toolStripTextBox1.Text) != addrese)
            {
                pBuilder.ClearContent();
                pBuilder.AppendText(toolStripTextBox1.Text);
                sSyn.Speak(pBuilder);
                webBrowser1.Navigate(toolStripTextBox1.Text);
            }

                addrese = Convert.ToString(toolStripTextBox1.Text);
        }



the project
http://multiupload.biz/8ty3vtqc30as/webenginbysound_MultiUpload.biz.rar.html
download project

السبت، 1 مارس 2014

USING OPENCV 2.4.3 WITH VISUAL STUDIO 2012 ON WINDOWS 7 ,8 (64-BIT)

STEP-1

Add the path to OpenCV runtime dll’s (Dynamic Linked Libraries) to your Environment Path variable:
[For 64-bit Machines]   C:\OpenCV-2.4.2\opencv\build\x64\vc10\bin;C:\OpenCV-2.4.2\opencv\build\; 

STEP-2

Create a new Visual Studio Project. Open Visual Studio -> New Project -> Visual C++ -> Win32 Console Application. Click OK. Then click Next -> Finish. 

STEP-3

[This step is for people with 64-bit machines. People with 32-bit machines can skip it.] Now change the build configuration by going to Build menu -> Configuration Manager.
Change the Platform. Click on Win32, Select New. Use the settings as shown in the figure.
Step 3
Step 3
Click OK. Close the Configuration Manager. Change the configuration in the main window to Release, if it isnt that already.

STEP-4

Now we add the OpenCV libraries to our OpenCV project properties. Go to View -> Other Windows -> Property Manager. Then open the Release | x64 (32-bit users should open Release | Win32) Property page by double clicking on it:
Step-4
Go to Linker -> General -> Additional Library Directories. Add this path over there:
[For 64-bit Machines]   C:\OpenCV-2.4.2\opencv\build\x64\vc10\lib;   
[For 32-bit Machines]   C:\OpenCV-2.4.2\opencv\build\x86\vc10\lib;
Next, go to Linker -> Input -> Additional Dependencies. 
Step-4i
Add the following dependencies to it:
"C:\opencv243\build\x64\vc10\lib\opencv_core243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_imgproc243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_highgui243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_ml243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_video243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_features2d243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_calib3d243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_objdetect243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_contrib243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_legacy243.lib";
"C:\opencv243\build\x64\vc10\lib\opencv_flann243.lib243";

try 
#include "iostream"
#include "cv.h"
#include "highgui.h"

using namespace std;
char key;
int main()
{
    cvNamedWindow("Camera_Output", 1);    //Create window
    CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);  //Capture using any camera connected to your system
    while(1){ //Create infinte loop for live streaming

        IplImage* frame = cvQueryFrame(capture); //Create image frames from capture
        cvShowImage("Camera_Output", frame);   //Show image frames on created window
        key = cvWaitKey(10);     //Capture Keyboard stroke
        if (char(key) == 27){
            break;      //If you hit ESC key loop will break.
        }
    }
    cvReleaseCapture(&capture); //Release capture.
    cvDestroyWindow("Camera_Output"); //Destroy Window
    return 0;
}

remove " to <

by cooperation https://www.facebook.com/Islam.Seleem