How to use Windows Encorder

First you have to download encoder software http://www.microsoft.com/en-us/download/details.aspx?id=17792
(it's run time free we are using only run time library  )
the install it

Add  references to the project(Encoder all library has update into your VS dll table)

Using web camera or IP camera capture the rock image and save it in DB and Filtering data that are taken from the excel sheets.I used Windows encoder and those library and  Muthu created API to do those algorithm. Not only that but I did viewing part of that filtering data using graphs and user can came to conclusion using those graphs.
Important : I learn those things using CodeProject web site(http://www.codeproject.com/kb/cs/)
Camera code segment-----------

        private void btnAppCap_Click(object sender, EventArgs e)
        {
         
            vidDevice.ClearSelected();
            foreach (EncoderDevice edv in EncoderDevices.FindDevices(EncoderDeviceType.Video))
            {
                vidDevice.Items.Add(edv.Name);
                labVid.Text = edv.Name;

            }


            audDevice.ClearSelected();
            foreach (EncoderDevice eda in EncoderDevices.FindDevices(EncoderDeviceType.Audio))
            {
                audDevice.Items.Add(eda.Name);
                labAud.Text = eda.Name;
            }

         

            chooseAudioVideoDevice(out video, out audio);

            _job = new LiveJob();

            if (video != null && audio != null)
            {
                _deviceSource = _job.AddDeviceSource(video, audio);

                // to be the one you choosed (640, 380)
                _deviceSource.PickBestVideoFormat(new Size(100, 150), 0);

                // Get the properties of the device video
                SourceProperties sp = _deviceSource.SourcePropertiesSnapshot();

                // Setup the output video resolution file as the preview
                _job.OutputFormat.VideoProfile.Size = new Size(100, 150);

             
                // Sets preview window to winform panel hosted by xaml window
                _deviceSource.PreviewWindow = new PreviewWindow(new System.Runtime.InteropServices.HandleRef(
                    vidPanel, vidPanel.Handle));
            }          

        }

        private void chooseAudioVideoDevice(out EncoderDevice video, out EncoderDevice audio)
        {
            video = null;
            audio = null;
            // Get the selected video device 
            foreach (EncoderDevice edv in EncoderDevices.FindDevices(EncoderDeviceType.Video))
            {
                video = edv;
                labVid.Text = vidDevice.Text;
                break;
            }
            // Get the selected audio device            
            foreach (EncoderDevice eda in EncoderDevices.FindDevices(EncoderDeviceType.Audio))
            {
                audio = eda;
                labAud.Text = audDevice.Text;
                break;
            }
        }
 // Create a Bitmap of the same dimension of panelVideoPreview (Width x Height)
            using (Bitmap bitmap = new Bitmap(203, 235))
            {
                for (int i = 1; i <= 4; i++)
                {
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        // Get the paramters to call g.CopyFromScreen and get the image
                        Rectangle rectanglePanelVideoPreview = vidPanel.Bounds;
                        Point sourcePoints = vidPanel.PointToScreen(new Point(vidPanel.ClientRectangle.X, vidPanel.ClientRectangle.Y));
                        g.CopyFromScreen(sourcePoints, Point.Empty, rectanglePanelVideoPreview.Size);
                    }
                    string strGrabFileName = String.Format("E:" + i + ".jpg", DateTime.Now);
  //                 statusStrip1.Text = strGrabFileName;
                    bitmap.Save(strGrabFileName, System.Drawing.Imaging.ImageFormat.Jpeg);
                    string img1 = "E:" + i + ".jpg";
         }
}
Thank you
 
Specially I use lots of references specially codeproject(http://www.codeproject.com/ )

Comments

Popular posts from this blog

Encrypt and Decrypt text using alphabet shifting method

Gridview to Datatable and Viewstate

You think Creating Circuler Graph is a difficult task ...........!!!