السبت، 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 

الخميس، 26 ديسمبر 2013

video editing by matlab

convert video from rgb to hsv 

by this way u can edit the video and make it again video 
split it to image and do what u want 


this the input

http://www.youtube.com/watch?v=WiUsRbTegEg&feature=youtu.be

the output
http://www.youtube.com/watch?v=2HCnCrudz0A&feature=youtu.be


the matlab code

mkdir('workingDir');
mkdir('workingDir','images');
shuttleVideo = VideoReader('723493_558567347510592_214063615_n.mp4');
for ii = 1:shuttleVideo.NumberOfFrames
img = read(shuttleVideo,ii);
img=rgb2hsv(img);  % u can edit all here :)
imwrite(img,fullfile('workingDir','images',sprintf('img%d.jpg',ii)));
end
imageNames = dir(fullfile('workingDir','images','*.jpg'));
imageNames = {imageNames.name}';
imageStrings = regexp([imageNames{:}],'(\d*)','match');
imageNumbers = str2double(imageStrings);
[~,sortedIndices] = sort(imageNumbers);
sortedImageNames = imageNames(sortedIndices);
outputVideo = VideoWriter(fullfile('workingDir','shuttle_out.avi'));
outputVideo.FrameRate = shuttleVideo.FrameRate;
open(outputVideo);
for ii = 1:length(sortedImageNames)
    img = imread(fullfile('workingDir','images',sortedImageNames{ii}));
    writeVideo(outputVideo,img);
end
close(outputVideo);

الاثنين، 9 ديسمبر 2013

connect serial between microcontrol pic 16f877a and atmega32

we now make the connection  between microcontrol  pic 16f877a and atmega32 via uart 

the code for pic micro c pro 

// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
char uart_rd,i=0;

void main() {

  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
   UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize
   while (1) {                     // Endless loop
    if (UART1_Data_Ready()) {     // If data is received,
      uart_rd = UART1_Read();     // read the received data,
      Lcd_Chr_Cp(uart_rd);       // and send data via UART
      i++;
      if(i>=31)                 //clear lcd when it complet to the end by 'a'
       Lcd_Cmd(_LCD_CLEAR);
    }
  }

}



the code for atmega32 over avr studio 5

/*
 * test.c
 *
 * Created: 12/9/2013 3:49:05 AM
 *  Author: ahmed
 */
#include
#include

#define F_CPU 8000000ul
#define USART_BAUD 9600ul
#define USART_UBBR_VALUE ((F_CPU/(USART_BAUD<<4 4="" br="" nbsp="" was="">//UBBR for Asynchronous Double Speed Mode (U2X = 1)
// UBRR = (fOSC / 8*BAUD) -1


static int uart_putchar(char c, FILE *stream);
uint8_t uart_getchar(void);
 void USART_Init(void)

 {
 UBRRH = (uint8_t)(USART_UBBR_VALUE>>8);
 UBRRL = (uint8_t)USART_UBBR_VALUE;
 UCSRC = (0< UCSRB = (1< }

 
  void USART_SendByte(uint8_t u8Data)
 
  {
  while((UCSRA&(1<  UDR = u8Data;
  }
 
  uint8_t USART_ReceiveByte(void)
 
  {
 
   // Wait until a byte has been received
 
  while((UCSRA&(1< 
   // Return received data
 
  return UDR;
 
  }


int main(void)
{
TCCR1B |= 1< // Initialize USART
USART_Init();
  while(1)
{
if( TCNT1 > 122072/2)  // one second 1000* 8,000,000/65,535
// max value 65535!!!!
{
  TCNT1 = 0;
//Send string
  USART_SendByte('a');
  //u8Data = USART_ReceiveByte(); }
}
}

 static int uart_putchar(char c, FILE *stream)
 {
     if (c == '\n') uart_putchar('\r', stream);
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<   UDR = c;
    return 0;
 }

 uint8_t uart_getchar(void)
 {
      /* Wait for data to be received */
      while ( !(UCSRA & (1<     return(UDR);
 }



الجمعة، 9 نوفمبر 2012

coding to convert from binary to decimal c++ code and the reverse

convert binary to decimal in c++ code  and the reverse

code

السبت، 27 أكتوبر 2012


قالولي بتحب مصر فقلت مش عارف
المعنى كعبة وانا بوَفْد الحروف طايف
وألف مغزل قصايد في الإدين لافف
قالولي بتحب مصر فقلت مش عارف
أنا لما اشوف مصر ع الصفحة بكون خايف

ما يجيش في بالي هرم ما يجيش في بالي نيل
ما يجيش في بالي غيطان خضرا وشمس أصيل
ولا جزوع فلاحين لو يعدلوها تميل
حكم الليالي ياخدهم في الحصاد محاصيل
ويلبّسوهم فراعنة ساعة التمثيل
وساعة الجد فيه سخرة وإسماعيل
ما يجيش في بالي عرابي ونظرته في الخيل
وسعد باشا وفريد وبقيّة التماثيل
ولا ام كلثوم في خِمسانها ولا المنديل
الصبح في التاكسي صوتها مبوظُّه التسجيل
ما يجيش في بالي العبور وسفارة اسرائيل
ولا الحضارة اللي واجعة دماغنا جيل ورا جيل
قالولي بتحب مصر أخدني صمت طويل
وجت في بالي ابتسامة وانتهت بعويل

قالولي بتحب مصر فقلت مش عارف
لكني عارف بإني إبن رضوى عاشور
أمي اللي حَمْلَها ما ينحسب بشهور
الحب في قلبها والحرب خيط مضفور
تصبر على الشمس تبرد والنجوم تدفى
ولو تسابق زمنها تسبقه ويحفى
تكتب في كار الأمومة م الكتب ألفين
طفلة تحمّي الغزالة وتطعم العصفور
وتذنِّب الدهر لو يغلط بنظرة عين
وبنظرة أو طبطبة ترضى عليه فيدور

وأمي حافظة شوارع مصر بالسنتي
تقول لمصر يا حاجّة ترّد يا بنتي
تقولها احكي لي فتقول ابدأي إنتي

وأمي حافظة السِيَر أصل السِيَر كارها
تكتب بحبر الليالي تقوم تنوَّرْها
وتقول يا حاجة إذا ما فرحتي وحزنتي
وفين ما كنتي أسجل ما أرى للناس
تفضل رسايل غرام للي يقدّرها

أمي وأبويا التقوا والحر للحرة
شاعر من الضفة برغوثي وإسمه مريد
قالولها ده أجنبي، ما يجوزش بالمرة
قالت لهم ياالعبيد اللي ملوكها عبيد
من إمتى كانت رام الله من بلاد برة
يا ناس يا أهل البلد شارياه وشاريني
من يعترض ع المحبة لما ربّي يريد

كان الجواب ان واحد سافر اسرائيل
وانا أبويا قالوله يللا ع الترحيل

دلوقت جه دوري لاجل بلادي تنفيني
وتشيِّب أمي في عشرينها وعشريني
يا أهل مصر قولولي بس كام مرة
ها تعاقِبوها على حُبَّ الفلسطيني

قالولي بتحب مصر فقلت مش عارف

بحب أقعد علىالقهوة بدون أشغال
شيشة وزبادي ومناقشة في مآل الحال
وبصبصة ع البنات اللي قوامهم عال
لكن وشوشهم عماير هدها الزلزال
بحب لمعي وحلابِسَّة ومُحِّب جمال
أروح لهم عربية خابطة في تروللي
كإنها ورقِة مِسودّة مرميّة
جوّاها متشخبطة ومتكرمشة هيّه
أو شلّة الصوف، أو عقدة حسابيّه
سبعين مهندس ولا يقدر على حلي
فيجيبوا كل مفكّاتهم وصواميلهم
ويجرّبوا كل ألاعيبهم وتحاييلهم
ساعات كمان يغلطوا ويجربوا فيّه
بس الأكيد أنهم بيحاولوا في مشاكلي
وإنها دايماً أهون من مشاكلهم

أحب اقعد على القهوة مع القاعدين
وابص في وشوش بشر مش مخلوقين من طين
واحد كإنه تحتمس، يشرب القرفة
والتاني غلبان يلف اللقمة في الجرانين
والتالتة من بلكونتها تنادي الواد
والواد بيلعب وغالبهم ثلاثة اتنين
أتوبيس كإنه كوساية محشي بني آدمين
أقول بحكم القاموس، إن الهواء جماد
واشم ريحة شياط بس اللي شايفه رماد
عكازة الشيخ منين نابت عليها زناد
يسند على الناس ويعرج من شمال ليمين
والراديو جايب خبر م القدس أو بغداد

قالولي بتحب مصر فقلت مش عارف

قطر الندى قاعدة بتبيع فجل بالحزمة
أميرة عازز عليها تشحت اللقمة
عريانة ما سترها الا الضل والضلمة
والشعر الابيض يزيد حرمة على حرمة
والقلب قايد مداين زي فرشة نور
والفرشة واكلاها عتة والمداين بور
اللي يشوفها يقول صادقة حكاوي الجن
واللي يشوفها يقول كل الحقايق زور

عزيزة القوم عزيزة تشتغل في بيوت
عشر سنين عمرها لكن حلال ع الموت
صبية تمشي تقع ويقولو حكم السن
وسِتّها شعرها أصفر وكلّه بُكَل
كإنها مربية فيه اربعين كتكوت
ووشها زي وش الحاكم العربي
كإن خالقها راسمها على نبوت
تحكم وقطر الندى تسمع لها وتئن
أصل البعيدة وليّة أمرها، عجبي
على الهوا بحجة الكسوة يقيموا له سور

أحكي يا قطر الندى والا ما لوش لازمة
حكاية ابن الأصول تفضل معاه لازمة
فيه ناس بتلدغ وناس ليها البكا لازمة
ياللي سطلت الخليفة بجوز عينين وشعور
كنت سما للأغاني والأغاني طيور
مين اللي باعك، عدوك، بعض أولادك
مين اللي كانوا عبيدك صاروا أسيادك
مين اللي سمى السلاسل في إديك دِبَل
مين اللي خط الكتاب مين كانوا أشهادك
وازّاي متى سألوكي "هل قبلتِ به"
سكتِّ ومشيتِ يا مولاتي في الزفة
لبنان وغزة وعراق فينا العدو تشفى
حطوا جثثنا يا حاجة تحت سجادك
ووقفت تستنى خيط الدم يبقى بحور

قالولي بتحب مصر فقلت مش عارف
لا جيتها سايح ولاني أعمي مش شايف
بلد علمها انمزع والرفّا في المساجين
ومهر مربوط في كارو وباله في البساتين
وابو زيد سلامة على كرسي وكيس جلوكوز
لجنة مشايخ تناقش فتوة الأراجوز
سؤال نعيش أو نموت، فيه لا يجوز ويجوز

لو السقوف خايخة نسندها بحجارة وطوب
لكن ده لوح القزاز كله ضرب تشريخ
لو الولد حرف في الآية، ها يبقى يتوب
بس المصيبة إذا الآية اخترعها الشيخ

يا مصر كومة حروف إبر المعاني فين
إبر بتجرح إيدينا قبل ما بتبان
نسرك في بال السما بيقول حدودها منين
نسرك بياكله الصدا في بدلة السجان

يا قلعة السجن يا قلعة صلاح الدين
أنا بقولك وأهلي ع الكلام شاهدين
لو كنت حرة ما كناش نبقى محتلين

والناس شكاير صريخ رابطين عليها سكوت
آهات سَكوتَة كإن الأرض مستشفى
مطرودة منها الدكاترة ف سجن أو منفى
والناس بتسأل هنصبر والا نتوفى
فيه ناس تقول زي بعضه دول نوعين م الصبر
وناس تقول زي بعضه دول نوعين م الموت
يا مصر بعض التسامح يبقى عار وبأجر
إفتكري "لا تحسبّن" مكتوبة فوق كام قبر
والتار يبات يصحى تاني لو يشيب الدهر
والتار حصان غير لصاحبه ما يلين ضهر
والتار تار العرب وعشان كده تار مصر

قالولي بتحب مصر فقلت مش عارف
لا جيتها سايح ولاني أعمى مش شايف
ولاني هايف اردّ بخفّة وبسرعة
وكل من رد يا كذاب يا هايف

أصل المحبة بسيطة ومصر تركيبة
ومصر حلوة ومُرَّة وشِرْحة وكئيبة
دا نا اختصر منصب الشمس وأقول شمعة
ولا اختصر مصر وانده مصر يا حبيبة

يا أهل مصر اسمعوني واسمعو الباقيين
إن كنت انا رحّلوني كلنا راحلين
يا أهل مصر يا أصحابي يا نور العين
يا شنطة المدرسة يا دفتر العناوين
يا ضغطة البنت بلكراسة ع النهدين
ترقص قصاد المراية، واحنا مش شايفين
يا صحن سلطان حسن يا صحن كحك وتين
يا ألف مدنا وجرس، لألف ملّة ودين
يا أهل مصر اسمعوني، والكلام أمانات
قلتولي بتحب مصر فقلت مش عارف
روحوا اسألوا مصر هيّه عندها الإجابات


-->



الناس يفهمون الدين على أنه مجموعة الأوامر و النواهي و لوائح العقاب و حدود الحرام و الحلال.. و كلها من شئون الدنيا.. أما الدين فشيء آخر أعمق و أشمل و أبعد.

الدين في حقيقته هو الحب القديم الذي جئنا به إلى الدنيا و الحنين الدائم الذي يملأ شغاف قلوبنا إلى الوطن الأصل الذي جئنا منه، و العطش الروحي إلى النبع الذي صدرنا عنه و الذي يملأ كل جارحة من جوارحنا شوقا و حنينا.. و هو حنين تطمسه غواشي الدنيا و شواغلها و شهواتها.
 
-->
و لا نفيق على هذا الحنين إلا لحظة يحيطنا القبح و الظلم و العبث و الفوضى و الاضطراب في هذا العالم فنشعر أننا غرباء عنه و أننا لسنا منه و إنما مجرد زوار و عابري طريق و لحظتها نهفو إلى ذلك الوطن الأصل الذي جئنا منه و نرفع رؤوسنا في شوق و تلقائية إلى السماء و تهمس كل جارحة فينا.. يا الله.. أين أنت.