21.4 AVI Selection
About1 Introduction2 Image Recognition3 TransApplet4 API5 Interface6 Input7 Image Display8 Preprocessing9 Processing10 Normalization11 Parameter Class12 Image Signatures13 Unsupervised Filters14 BioFilters15 NeuralFilters16 Dynamic Library17 NeuralNet Filter18 Parameters19 Input Options20 Database Input21 Video Input22  Live Video Input23  Counting & Tracking24  Counting 25  Batch Job26 ImageFinder for DOS27 ImageHunt 28 Support Packages

21.1  Class Name 
21.2  Class Overview 
21.3  Link to Class 
21.4 AVI Selection 
21.5 Video to Images 
21.6 Testing 
[Home][21 Video Input][21.4 AVI Selection]

 

21.4   AVI Video Selection

The basic Video Match operation is:

        (1) Specify a Video File;

        (2) Convert Video to Images;

        (3) Treat the Converted Images as Directory Input covered earlier.

The only video format supported in this version is *.avi. If you need a different video format supported, customization will solve this problem.

After starting the chapter projects software, selecting an *.avi file in Figure 19.1, the ImageFinder will convert the avi video file to a set of images. After that, video recognition is converted into image recognition.

Example. Converting AVI Video:

  •    Start the software;
  •    Select the option, “*.avi File”;
  •    Click the “Source” button, and select file, “.\input_avi\clock.avi”;
  •    Click the “Play/Stop” button in Figure 21.1 to convert the button to a “Play” button;
  •    Click the “Play” button to play, which also converts the button to a “Stop” button;
  •    Click the “Stop” to stop the video;
  •    Click the “Change” button in Figure 21.1 to get Figure 21.2;
  •    Click the “*.avi to Images” button to convert the avi file to images.

 

Figure 21.1  Converting AVI Video File to Images, Step 1.

 

Figure 21.2   Converting AVI Video File to Images, Step 2.

The “Source” button selects an *.avi file, which in turn, calls the following functions:

        int videoFilePointer = 0;

            private bool searachSource6 ()

            {

                try

                {

                    if ( f.openFileDialog1.ShowDialog () != DialogResult.OK )

                        return true;

         

                    bool b = f.openFileDialog1.FileName.EndsWith (".avi")

                        || f.openFileDialog1.FileName.EndsWith (".AVI")

                        || f.openFileDialog1.FileName.EndsWith (".Avi");

                    if (!b)

                    {

                        f.richTextBox1.Text = "Not *.avi file\n";

                        return false;

                    }

                    script.aviVideo70.setVideoFile  ( f.openFileDialog1.FileName   );

                    if ( ! script.aviVideo70.getVideoFileStatus() )

                    {

                        f.richTextBox1.Text = "Video Selection Fail!\n"

        + script.aviVideo70.getMessage ();

                        return false;

                    }

                    f.textBox2.Text = script.aviVideo70.getVideoFile () ;

         

                    script.aviVideo70.setVideoToImagesDir

         (this.videoLiveParameters .imageOutputFolder);

                    f.richTextBox1.AppendText ( "Video To Image Directory: \n"

        + script.aviVideo70.getVideoToImagesDir () +"\n");

                    videoFilePointer = 0;

                    f.pictureBox2.Image =

        script.aviVideo70.getBitmap (videoFilePointer);

                }

                catch (Exception ee )

                {

                    f.richTextBox1.AppendText ( ee.ToString () +"\n");

                    return false;

                }

                return true;

            }

This code will:

  •    Select an *.avi video file;
  •    Set the selected file to object, “script.aviVideo70”; and
  •    Set the Video-To-Image Directory.

We will now explain this code. The first statement,

        if ( openFileDialog1.ShowDialog () != DialogResult.OK )

                return;

opens a file dialog box and selects an *.avi file. The next statement,

        script.aviVideo70.setVideoFile  ( f.openFileDialog1.FileName   );

assigns the selected *.avi file to the script.aviVideo70 object. The next two statements,

        script.aviVideo70.setVideoToImagesDir

         (this.videoLiveParameters .imageOutputFolder);

            f.richTextBox1.AppendText ( "Video To Image Directory: \n"

        + script.aviVideo70.getVideoToImagesD

creates the “Video To Image” directory, and prints a message to the text Box. The last statement,

        f.pictureBox2.Image = script.aviVideo70.getBitmap (videoFilePointer);

prints the first image in the video.

 

[Home][About][1 Introduction][2 Image Recognition][3 TransApplet][4 API][5 Interface][6 Input][7 Image Display][8 Preprocessing][9 Processing][10 Normalization][11 Parameter Class][12 Image Signatures][13 Unsupervised Filters][14 BioFilters][15 NeuralFilters][16 Dynamic Library][17 NeuralNet Filter][18 Parameters][19 Input Options][20 Database Input][21 Video Input][22 Live Video Input][23 Counting & Tracking][24 Counting ][25 Batch Job][26 ImageFinder for DOS][27 ImageHunt ][28 Support Packages]

Copyright (c) 2006 - 2007 Attrasoft. All rights reserved.

gina@attrasoft.com