SlideShare uma empresa Scribd logo
1 de 92
MAJOR PROJECT REPORT ON
       REAL -TIME MULTIMEDIA SIGNAL
            PROCESSING USING MATLAB




                                 Submitted by:
               Angshuman Ghosh - (Reg.no. - 200212080)
               Aritri Debnath  - (Reg.no. – 200212113)

                           In partial fulfillment of
       VIII Semester, B.Tech (Electronics and communication Engineering)


                            Under the Guidance of:
        Prof. Rabindranath Bera (Electronics and Communication Dept.,
                                     SMIT)
      Dr. Jitendranath Bera and Dr. Madhuchhanda Mitra (Dept. of Applied
                         Physics, University of Calcutta)

            ELECTRONICS AND COMMUNICATION ENGINEERING
                      DEPARTMENT, JUNE 2006.




      SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY
                 MAJITAR, RANGPO, EAST SIKKIM-737132

____________________________________________________________________       1
Department of Electronics and Communication, SMIT.
SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY
  (A constituent college of Sikkim Manipal University of Health Medical and
                            Technological Sciences)




                          CERTIFICATE

       This is to certify that ANGSHUMAN GHOSH bearing the registration no:-
200212080 has successfully completed the major project titled ‘REAL-TIME
MULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department of
Applied Physics, University of Calcutta, in partial fulfillment of the requirement for the
award of Bachelor Of Technology in Electronics and Communication Engineering of
SIKKIM       MANIPAL        UNIVERSITY         OF     HEALTH         MEDICAL        AND
TECHNOLOGICAL SCIENCES in the year 2005-06.




___________________________
Dr. R. N. Bera (Internal Guide)
Head of Department,
Department of Electronics and Communication Engineering,
S.M.I.T, Majitar, Rangpo,
Sikkim- 737132




                  DEPARTMENTAL SEAL
     DEPARTMENT OF ELECTRONICS AND COMMUNICATION.

____________________________________________________________________                    2
Department of Electronics and Communication, SMIT.
SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY
  (A constituent college of Sikkim Manipal University of Health Medical and
                            Technological Sciences)




                          CERTIFICATE

       This is to certify that ARITRI DEBNATH bearing the registration no:-
200212113 has successfully completed the major project titled ‘REAL-TIME
MULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department of
Applied Physics, University of Calcutta, in partial fulfillment of the requirement for the
award of Bachelor Of Technology in Electronics and Communication Engineering of
SIKKIM       MANIPAL        UNIVERSITY         OF     HEALTH         MEDICAL        AND
TECHNOLOGICAL SCIENCES in the year 2005-06.




___________________________
Dr. R. N. Bera (Internal Guide)
Head of Department,
Department of Electronics and Communication Engineering,
S.M.I.T, Majitar, Rangpo,
Sikkim- 737132




                  DEPARTMENTAL SEAL
     DEPARTMENT OF ELECTRONICS AND COMMUNICATION.


____________________________________________________________________                    3
Department of Electronics and Communication, SMIT.
ACKNOWLEDGEMENT

At the outset we would like to convey our sincere thanks to all the faculties and support
staff of Applied Physics Department, University of Calcutta, for providing us the
opportunity to carry out our 8th semester major project of B.Tech degree in Electronics
and Communication in the institute.


       We would like to convey our profound gratitude to Prof. Rabindranath Bera
(HOD, Dept of Electronics and Communication, SMIT) for providing us with an
opportunity to carry out a major project on this emerging subject and encouraging and
motivating us at every stage with valuable inputs which made it possible for us to be
successful in our endeavor towards the completion of this major project in time.


We wish to record our deep sense of gratitude to Prof. Samarjit Sengupta for his valuable
inputs from time to time, indispensable support and proper guidance at every stage for
completing our project work on “Real – Time Multimedia Signal Processing Using
MATLAB”. Without his support and encouragement it was impossible to complete the
project.


Our sincere thanks and gratitude also goes to our Project Guides Dr. Jitendranath Bera
(Reader, Dept. Applied Physics) and Dr. Madhuchhanda Mitra (Reader, Dept. of Applied
Physics) for their support, encouragement and timely advice in our day-to-day activities.


Last but not the least our thanks also go to the Laboratory Assistant Mr. Nirmal Kumar
Debnath for assisting us in our day-to-day activities.




__________________________                           ___________________________
Angshuman Ghosh (Reg.no. 200212080)                  Aritri Debnath (Reg. no. 200212113)




____________________________________________________________________                        4
Department of Electronics and Communication, SMIT.
ABSTRACT

The aim of our major project is Real-Time Multimedia Signal Processing Using
MATLAB using a comparatively cheaper card in contrast to expensive cards like TI
DM642EVM. The project on completion will process the multi-media files like the video
and audio from the TV as well as from the digital camera and these can be viewed on the
computer. For this objective we have the following two Real-time approaches:


   •   Tuner mode: - that is processing the data’s from the TV.
   •   Composite mode: - that is processing the data’s from the digital camera.


These two approaches works in two different video modes: the tuner mode and the
composite mode. The online approach where the data are acquired from the TV works in
the tuner video mode.


While the offline approach where the data’s are acquired from a digital camera works in
the composite video mode. These two modes can be turned on and off by the program we
have developed in MATLAB.


For acquiring data’s from the TV & Camera we have chosen a TV tuner card, which is
the PIXEL VIEW TV Tuner card having the model no. TCL2002MB-33F. The reason for
choosing the TV Tuner card as the video card is that the TV Tuner card has a wide
bandwidth of 815MHz.       And the digital camera we have chosen is OLYMPUS
CAMEDIA C- 750.


We have used MATLAB 7.1 for the simulation purpose, as it is a high-speed computation
program, which performs various kinds of operations in much less time.




____________________________________________________________________                 5
Department of Electronics and Communication, SMIT.
TABLE OF CONTENTS
          TOPIC                                                                       PAGE NO.


   CHAPTER 1: LIST INSERTED………………………………………..9.
     1.1 List of Tables………………………………………………..10.
     1.2 List of Figures……………………………………………….11.


   CHAPTER 2: INTRODUCTION………………………………………13.
          2.1 Why we are interested in this project .........................................14.
          2.2 Mobile TV?……………………………………...……………..14.
                2.1.1.   What is a Mobile TV ……….…..……………………..14.
                2.1.2.   Mobile TV Theory……………..………………………14.
                2.1.3 Companies Engaged……………………………………15.
                2.1.4    Merits……………………….…………………………17.


   CHAPTER 3: MATLAB…………………….………………………….18.
          3.1 Why We Are Using MATLAB?...............................................19.
          3.2    What is MATLAB?………...........................................………19.
            3.2.1    MATLAB Uses……………………………………………21.
            3.2.2 MATLAB Syntax………………………………………….21.
            3.2.3 The MATLAB Systems……………………………………21.
            3.2.4 Functions……………………………………………...22
            3.2.5 .Desktop Overview……………………………………23.
            3.2.6 Start Button……………………………………………23.
            3.2.7 Command Window……………………………………24.
            3.2.8 Command History……………………………………..24.
            3.2.9 Demos…………………………………………………25.
    3.2         M-file…………………………………………………….….25.
    3.3.1 What is a M-file?…………………………………………...25.
    3.3.2 Why use M-file?……………………………………………25.

____________________________________________________________________                               6
Department of Electronics and Communication, SMIT.
3.3.3 How to Create, Save and Open a M-file?…………………..26.
        3.3.4 How to Run a M-file?………………………………………26.


CHAPTER 4: SIMULINK……………………………………………………27.
4.1     What is SIMULINK?……………………………………………………..28.
4.1.1 Tool For Simulation…………………………………………………….28.
4.1.2 Tool For Model Based Designs…………………………………………29.
4.1.3 Creating Empty Model………………………………………………….29.
4.1.4 Adding The Blocks……………………………………………………...31.
4.1.5 Configuring The Model…………………………………………………33.
4.1.6 Running The Model……………………………………………………..33.
4.2     How Does Simulink Works?……………………………………………...34.
4.2.1 Modeling Dynamic Systems…………………………………………….34.
4.2.2    Creating Models ………………………………………………………..34.
4.2.3 Time……………………………………………………………………..35.
4.2.4 State……………………………………………………………………...35.
4.2.5 Block Parameters……………………………………………………..…36.


CHAPTER 5: GRAPHICAL USER INTERFACE (GUI)……………….….37.
      5.1 GUI…………………………………………………………………….38.
      5.2 Starting GUIDE………………………………………………………..38.
      5.3 The Layout Editor……………………………………………………...39.
      5.4 GUIDE Templates……………………………………………………..40.
      5.5 Running A GUI………………………………………………………...41.
      5.6 GUI Fig-file and M-file………………………………………………..42.
      5.7 Programming The GUI M-files………………………………………..42.


CHAPTER 6: SELECTION OF TV TUNER CARD………………………44.
      6.1 Simulink Model Used For Data Acquisition…………………………..45.
      6.2 Justification…………………………………………………………….47.



____________________________________________________________________   7
Department of Electronics and Communication, SMIT.
CHAPTER 7: PROGRAMMES……………………………………………..49.
   7.1 Video Acquisition Program….………………………………………..50.
   7.2 Program for Building GUI ……………………………..……………..51.
   7.3 Audio Acquisition Block……………………………………………..64.
   7.4 Simulink Model for Audio Acquisition……………………………...65.


CHAPTER 8: TV TUNER CARD…………………………………………..66.
   8.1 Theoretical Study …………………………………………………….67.
   8.2 PIXEL VIEW TV Tuner Card………………………………………..68.
      8.2.1 PIXEL VIEW TV Tuner Card Specification …………………67.
      8.2.2 Connection Diagram…………………………………………..73.
   8.3 S-Video……………………………………………………………….74.
      8.3.1 Advantages…………………………………………………….76.
      8.3.2 Disadvantages…………………………………………………76.
   8.4 Composite Video……………………………………………………..77.


      9.   PROBLEMS…………………………………………………….78.
      10. RESULT………………………………………………………….82.
      10.1 Result Obtained…………………………………………………..83.
      10.2 GUI Created……………………………………………………..86.
      10.3 Result Obtained From TV………………………………………..87.
      10.4 Result Obtained From Camera…………………………………...88.


      11. CONCLUSION…………………………………………………..89.


      12. DISCUSSION…………………………………………………….91.




      13. BIBLIOGHRAPHY……………………………………………..92.




____________________________________________________________________   8
Department of Electronics and Communication, SMIT.
1.-LIST OF TABLES
                  AND FIGURES




____________________________________________________________________   9
Department of Electronics and Communication, SMIT.
1.1 - LIST OF TABLES


      TOPIC                                              PAGE NO.


   1.1.1 Table - 3 :-TV Tuner Card PIN Description……………………….70.
   1.1.2 Table - 4.6 :-12C - Bus Data Format……………………………….71.
   1.1.3 Table - 4.8 :-Address Selection…………………………………….71.
   1.1.4 Table - 4.9 :-Test Bits………………………………………………71.
   1.1.5 Table - 4.10 :-Ratio Bits……………………………………………71.
   1.1.6 Table - 4.11 :-Port Byte…………………………………………….72.
   1.1.7 Table - 5 :-General Characteristics………………………………….72.
   1.1.10 Table - 8.3.1 S-Video Pin Assignment ……………..………………75.




____________________________________________________________________   10
Department of Electronics and Communication, SMIT.
FIG1.2 - LIST OF FIGURES


                  TOPICS                                           PAGE NO.
           1.2.1 Fig - 2.2.2(a):- Mobile TV………………………………….…15.
           1.2.2 Fig - 3.2.5(a):- Desktop Overview…………………………….23.
           1.2.3 Fig - 3.2.6(a):- Start Button……………………………………23.
           1.2.4 Fig - 3.2.7(a):- Command Window……………………………24.
           1.2.5 Fig - 3.2.8(a):- Command History……………………………..24.
           1.2.6 Fig- 4.1.3(a):- Creating Empty Models………………………..30.
           1.2.7 Fig - 4.1.3(b):- Simulink Library Browser…………………….30.
           1.2.8 Fig - 4.1.3(c):- Simulink Model Window……………………..30.
           1.2.9 Fig - 4.1.4(a):- Simulink Library Browser …………………....31.
           1.2.10 Fig - 4.1.4(b):-Source Library Window……………………….32.
           1.2.11 Fig - 4.1.4(c):-Adding blocks In Model Window……………..32.
           1.2.12 Fig - 4.1.4(d):- Input and Output Ports………………………..32.
           1.2.13 Fig - 4.1.6 (a):- Configuring The Model………………………33.
           1.2.14 Fig - 4.1.7(a):-Running The Model……………………..……..33.
           1.2.15 Fig - 4.3.5(a):- States…………………………………………..36.
           1.2.16 Fig - 5.2(a):- GUI Starting Guide……………………………...38.
           1.2.17 Fig - 5.3(a):- Layout Editor…………………………………….39.
           1.2.18 Fig - 5.3(b):- Layout Editor…………………………………….39.
           1.2.19 Fig - 5.4(b):- Guide Templates………………………….…..….40.
           1.2.20 Fig - 5.4(b):- Guide Templates ……………………………..….41.
           1.2.21 Fig -5.5(a):- Running A GUI…………………………………...41.
           1.2.22 Fig - 5.7(b):- Programming The GUI M-files………………….43.
           1.2.23 Fig - 5.7(c):- Programming The GUI M-file…….………….….43.
           1.2.24 Fig - 6.1(a):- DM642EVM………………………………….….45.
           1.2.25 Fig - 6.1(b):- DM642EVM Board…………………………..….45.
           1.2.26 Fig - 7.3(a):- Audio Acquisition Block.……………………….64.
           1.2.27 Fig - 7.3(b):- Simulink Based Audio Acquisition Block……....65.
           1.2.28 Fig - 8.1(a):- TV Tuner Block Diagram……………………….67.

____________________________________________________________________           11
Department of Electronics and Communication, SMIT.
1.2.29 Fig - 8.1(b):-TV Tuner Card………….……………………..…67.
            1.2.30 Fig - 8.2.(a):- PIXEL VIEW TV Tuner Card…………….…....68.
            1.2.31 Fig - 8.2.2(a):-Connection Diagram……………………………73.
            1.2.32 Fig - 8.2.2(b):-Connection Diagram……………………………74.
            1.2.33 Fig - 8.3(a):- S-Video Cable Connector………………………...74.
            1.2.34 Fig - 8.3(b):-Y/C Diagram……………………………………...74.
            1.2.35 Fig - 8.3.1(a):- S-Video Cable Connector……………………....75.
            1.2.36 Fig -10.1(a):- Result Diagram……………………………..……83.
            1.2.37 Fig - 10.2(a):- GUI Created……………………………………..86.
            1.2.38 Fig - 10.3(a):- Result Obtained From TV……………………….87.
            1.2.39 Fig -10.4(a):-Result Obtained From Camera……………………88.




____________________________________________________________________    12
Department of Electronics and Communication, SMIT.
2. - INTRODUCTION




____________________________________________________________________   13
Department of Electronics and Communication, SMIT.
2.1 - WHY WE ARE INTERESTED IN THIS PROJECT ?
Latest multimedia development is interested in implementing the concept of mobile TV.
Even SIMENS, NOKIA, ERICSSION etc mobile handset companies and other electronic
chip pioneers have already developed an acquisition card which would fit into the size,
prize and weight of a Mobile Phone, but the software for driving that chip is still under
research . So, we have tried to develop an open source, functionally divided software ,
using the most popular, easily understandable , widely used and efficient engineering
software-tool - MATLAB.


      2.2    - MOBILE TV


2.2.1 - WHAT IS A MOBILE TV?
Mobile TV is a recent concept where mobile subscribers will be able to view TV
channels on their mobile sets. Mobile TV is a complete Phone Cast solution, which
allows the subscribers to view TV channels, live events, sportscasts, and video on their
mobile phones globally.


2.2.2 - MOBILE TV THEORY
Phone Cast is a mobile video services platform, which enables wireless operators, content
providers and media companies to allow their customers to experience Mobile TV and
Video on Demand through wireless devices globally. Phone Cast reduces the complexity
of managing and distributing video content, and by allowing the creation and distribution
of the contents for a mobile TV network quickly. Channel surfing is also possible on the
Mobile TV.


It has been seen that Jupiter Research’s latest study on wireless TV found that 41 percent
of US mobile phone users are interested in watching video on their handsets, and
according to Strategy Analytics, mobile video content is projected to become a $4.5
billion business by 2008




____________________________________________________________________                   14
Department of Electronics and Communication, SMIT.
Fig – 2.2.2(a) Mobile TV


2.2.3 - COMPANIES ENGAGED


Renowned companies worldwide are engaged in the development of Mobile TV. Some of
the companies are:
    •   Royal Philips Electronics.
    •   Siemens.
    •   NEXAGE, a wireless and multimedia software and services company.
    •   Nokia.
    •   T-mobile, Germany.
    •   Alcatel.
    •   Orange, France.
    •   Ericsson.
    •   Qualcomm, hand set manufacturers, United States.
    •   Huawei Technologies, China.
    •   LG Electronics.


Royal Philips Electronics has announced its next generation TV-on-mobile solution,
which is six times smaller than its previous version, the Digital Video Broadcast –
____________________________________________________________________            15
Department of Electronics and Communication, SMIT.
Handheld (DVB-H) front-end solution, BGT216, which is predicted to have 15 million
consumer users by 2009, up from only 1.2 million in 2005, according to e-Marketer.


DVB-H technologies enable consumers to receive live TV-like experiences directly onto
mobile handsets and other DVB-H-based devices. In addition, operators benefit from
increased revenue opportunities while preserving cellular network bandwidth for voice
and other data services. Philips’ DVB-H front-end solution, BGT216, measures 7x7 mm,
far smaller than the previous 15x26 mm version. The smaller size improves the
integration potential of the chip into mobile devices, which will enable handset and other
mobile hardware manufacturers to create simpler, sleeker designs, which satisfy the
current consumer trends towards small, ultra-portable devices. DVB-H enables most
efficient mass distribution of mobile TV and is optimized for mobile devices (e.g. power
consumption and resolution). In regards to the industry issue of power consumption the
chip BGT216 has been designed in such a way that it require low power, which will in
return maximize the battery life and provide better service to the consumers.

Research shows that end users want to switch between different mobile TV channels as
easily and fast as using their remote control at home. Siemens’ Media Delivery Solution
(MDS) offers just that. And on top of this users can download and store video files for
further usage. Siemens’ (MDS) enables mobile network operators to deliver rich media
content to their subscribers and roaming mobile devices. The solution is designed to
generate new revenues with services such as video on demand, live video streaming and
content download.


LG Electronics has selected Microtune's ultra low-power Microtune's Mobile MicroTuner
MT2260 chip, to enable high-performance mobile television on LG's LG-U900 DVB-H
mobile phone. It is a miniature DVB-H digital TV tuner, engineered to deliver robust
performance in a very low-power consumption. The Mobile MicroTuner MT2260
features higher integration than other leading DVB-H tuner solutions on the market by
not requiring bulky and costly external components, such as a low-noise amplifier and
transformer. The tuners are developed in such a way that they detect very small signals
and simultaneously manage fading conditions, 0dB echo and large adjacent channels,
____________________________________________________________________                   16
Department of Electronics and Communication, SMIT.
Italian mobile telecommunications service provider, Hutchison 3 Italia, expects to
broadcast the FIFA World Cup games to mobile handheld devices using the digital video
broadcast handheld (DVB-H) standard, in June.


2.2.4 – MERITS
   •   Subscribers can view live TV on their mobile handset.
   •   Mobile TV and video services provide music videos and concert coverage to
       younger audience.

   •   Targets the widest possible subscriber base and allows insertion of advertisements
       and promotions within live TV programming and VOD services.”

   •   Universal Theater is a premier online digital music business that produces music
       downloads, concerts, sporting events, special events, interviews, news clips,
       reality shows, ring tones, movies, and music videos and interactive programming
       which is distributed over the Internet and mobile platform.

   •   Maximize revenue by attracting more users.




____________________________________________________________________                  17
Department of Electronics and Communication, SMIT.
3. – MATLAB




____________________________________________________________________   18
Department of Electronics and Communication, SMIT.
3.1 - WHY WE ARE USING MATLAB?

MATLAB is a high-speed computation program. It is an interactive system whose basic
data element is an array that does not require dimensioning. This allows the user to solve
many technical computing problems, especially those with matrix and vector
formulations. It is a high-end programming language that gives result within a fraction of
seconds. For example if we want to compute the Fast Fourier Transformation (FFT) of a
function, all we have to do is type the function and then simply click on the FFT option
an within seconds we have the result. MATLAB does long and complex computations in
much less time and with perfect accuracy. It has got many facilities like computing FFT,
DFT, IDFT, etc. More it is that to write or develop a program in MATLAB is to keep it
on open source that is any body can further modify it for its betterment and can develop a
better program and can work further with the basics. It also has three major tools –


   1. Simple MATLAB .m file programming.
   2. Simulink block approach.
   3. “Guide” a tool to form useful and easy interactive GUI’s (Graphics User
        Interface).


These three tools can be used to see the same problem from different angles or to deal
with the desired output with different approaches.


3.2. - WHAT IS MATLAB?

MATLAB is a high-performance language Created by The MathWorks, for technical
computing. MATLAB allows:

    •   easy matrix manipulation,

    •   plotting of functions and data,

    •   implementation of algorithms,

    •   creation of user interfaces, and interfacing with programs in other languages


____________________________________________________________________                    19
Department of Electronics and Communication, SMIT.
•   It integrates computation, visualization, and programming in an easy-to-use
        environment where problems and solutions are expressed in familiar
        mathematical notation.


MATLAB is an interactive system whose basic data element is an array that does not
require dimensioning. This allows the user to solve many technical computing problems,
especially those with matrix and vector formulations, in a fraction of the time it would
take to write a program in a scalar non-interactive language such as C or Fortran.


The name MATLAB stands for matrix laboratory. MATLAB was originally written to
provide easy access to matrix software. Today, MATLAB engines incorporate the
LAPACK and BLAS libraries, embedding the state of the art in software for matrix
computation.


MATLAB features a family of add-on application-specific solutions called toolboxes.
Very important to most users of MATLAB, toolboxes allow the user to learn and apply
specialized technology. Toolboxes are comprehensive collections of MATLAB functions
(M-files) that extend the MATLAB environment to solve particular classes of problems.


Areas in which toolboxes are available include:
   •    Signal processing,
   •    Control systems,
   •    Neural networks,
   •    Fuzzy logic,
   •    Wavelets,
   •    Image Acquisition
   •    Data Acquisition
   •    Simulation, and many others.


MATLAB can plot values created with its own commands, MATLAB is also very useful
for plotting data from other sources, e.g., experimental measurements. The simplest way

____________________________________________________________________                 20
Department of Electronics and Communication, SMIT.
to import your data into MATLAB is with the load command.



3.2.1 – MATLAB USES

Typical uses of Matlab include:

•      Math and computation,
•      Algorithm development,
•      Data acquisition,
•      Modeling, simulation, and prototyping,
•      Data analysis, exploration, and visualization,
•      Scientific and engineering graphics,
•      Application development, including graphical user interface building.


3.2.2 – MATLAB SYNTAX

MATLAB's M-Code (or simply m) is primarily value oriented. Unlike languages such as
Java and C++, m is not statically typed, meaning that variables themselves do not have
types, only the runtime values stored in those variables have types, as in PHP or
JavaScript.



3.2.3 - THE MATLAB SYSTEM
The MATLAB system consists of five main parts:


Desktop Tools and Development Environment: -
This is the set of tools and facilities that help the user to use MATLAB functions and
files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop
and Command Window, a command history, an editor and debugger, and browsers for
viewing help, the workspace, files, and the search path.


The MATLAB Mathematical Function Library: -

____________________________________________________________________                 21
Department of Electronics and Communication, SMIT.
This is a vast collection of computational algorithms ranging from elementary functions,
like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like
matrix inverse, matrix eigen values, Bessel functions, and fast Fourier transforms.


The MATLAB Language: -

This is a high-level matrix/array language with control flow statements, functions, data
structures, input/output, and object-oriented programming features. It allows both
"programming in the small" that is to rapidly create quickly and dirty throw away
Program and "programming in the large" that is to create large and complex application
program.
Graphics: -
MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well
as annotating and printing these graphs. It includes high-level functions for two-
dimensional and three-dimensional data visualization, image processing, animation, and
presentation graphics. It also includes low-level functions that allow the users to fully
customize the appearance of graphics as well as to build complete graphical user
interfaces on the MATLAB applications.


The MATLAB External Interfaces/API: -
This is a library that allows the user to write C and Fortran programs that interact with
MATLAB. It includes facilities for calling routines from MATLAB (dynamic linking),
calling MATLAB as a computational engine, and for reading and writing MAT-files.


3.2.4 - FUNCTIONS
MATLAB provides a large number of standard elementary mathematical functions,
including abs, sqrt, exp, and sin. Taking the square root or logarithm of a negative
number is not an error, and the appropriate complex result is produced automatically.
MATLAB also provides many more advanced mathematical functions, including Bessel
and gamma functions. Most of these functions accept complex arguments. For viewing a
list of the elementary mathematical functions, help elfin is typed. For viewing a list of
more advanced mathematical and matrix functions, help specfun is typed.

____________________________________________________________________                  22
Department of Electronics and Communication, SMIT.
3.2.5 - DESKTOP OVERVIEW

Desktop tools are used to manage the work in MATLAB. The user can also use
MATLAB functions to perform the equivalent of most of the features found in the
desktop tools. The following illustration shows the default configuration of the MATLAB
desktop. The setup can modified as per the users requirements.




                          Fig – 3.2.5(a):- Desktop Overview


3.2.6 - START BUTTON

The MATLAB Start button              provides easy access to tools, demos, shortcuts, and
documentation. By clicking on the Start button the options can be viewed.




                             Fig – 3.2.6(a):- Start Button



____________________________________________________________________                  23
Department of Electronics and Communication, SMIT.
3.2.7 - COMMAND WINDOW
The Command Window is used to enter variables and to run functions and M-file scripts.




                          Fig – 3.2.7(a):-Command Window


By pressing the up arrow key a previously typed statement can be recalled. Then the
statement can be edited as needed and then can be run by pressing Enter.


3.2.8 - COMMAND HISTORY
The statements entered by the user in the Command Window are logged in the Command
History. From the Command History, the user can view previously run statements, as
well as copy and execute selected statements. The user can also create an M-file from
selected statements.




                          Fig – 3.2.8(a):- Command History
To save the input and output from a MATLAB session to a file, the diary function is
used.

____________________________________________________________________                24
Department of Electronics and Communication, SMIT.
3.2.9 - DEMOS AVAILABLE WITH MATLAB

MATLAB comes with a wide array of visual demonstrations to help the user to see the
extent of what they can do with the product. To start running any of the demos, demo
should be typed at the MATLAB command prompt. Demos cover the following major
areas:
    •     MATLAB.
    •     Toolboxes.
    •     Simulink.
    •     Blocksets.
    •     Real-Time Workshop.
    •     Stateflow.


         3.3 - M-FILE

3.3.1 – WHAT IS AN M-FILE?

An m-file, or script file, is a simple text file where the user can place Matlab commands.
When the file is run, Matlab reads the commands and executes them exactly as it would if
the user had typed each command sequentially at the Matlab prompt. All m-file names
must end with the extension '.m' (e.g. plot .m). If a new m-file is created with the same
name as an existing m-file, Matlab will choose the one, which appears first in the path
order. So for a new m-file a new name should be chosen. To see if a filename.m exists,
the user can type help filename at the Matlab prompt.

3.3.2 - WHY USE M-FILES?

For simple problems, entering the users requests at the Matlab prompt is fast and
efficient. However, as the number of commands increases or changing certain variables
or values does trial and error, typing the commands over and over at the Matlab prompt
becomes tedious. M-files will be helpful and almost necessary in these cases.




____________________________________________________________________                   25
Department of Electronics and Communication, SMIT.
3.3.3. - HOW TO CREATE, SAVE OR OPEN AN M-FILE?

To create an m-file, New from the File menu in chosen and m-file has to be selected.
This procedure brings up a text editor window in which the user can enter Matlab
commands. To save the m-file, Save is chosen from File menu. The file should be saved
with the '.m' extension. To open an existing m-file, Open is chosen from the File menu.


3.3.4 - HOW TO RUN THE M-FILE?

After the m-file is saved with the name filename.m in the Matlab folder or directory, the
user can execute the commands in the m-file by simply typing filename at the Matlab
prompt. If the user doesn’t want to run the whole m-file, he or she can just copy the part
of m-file that is desired to run and paste it at the Matlab prompt.




____________________________________________________________________                   26
Department of Electronics and Communication, SMIT.
4. - SIMULINK




____________________________________________________________________   27
Department of Electronics and Communication, SMIT.
Simulink is a block library tool for modeling, simulating and analyzing dynamic
systems. It is developed by The MathWorks and works with their flagship product,
MATLAB.

Simulink is widely used in control theory and digital signal processing for multidomain
simulation and design. Coupled with Real Time Workshop, another product from The
MathWorks, Simulink can do automatic code generation for real-time implementation of
systems. As the efficiency and flexibility of the code is improving, this is becoming more
widely adopted for production systems, in addition to being a popular tool for embedded
system design work because of its flexibility and capacity for quick iteration. A number
of third-party hardware and software products are available for use with Simulink
software.


4.1 - WHAT IS SIMULINK?


Simulink is a software package for modeling, simulating, and analyzing dynamic
systems. It supports linear and nonlinear systems, modeled in continuous time, sampled
time, or a hybrid of the two. Systems can also be multirate, i.e., have different parts that
are sampled or updated at different rates.


4.1.1 - TOOL FOR SIMULATION


Simulink encourages and allows the users to try things out. The users can easily build
models from scratch, or take an existing model and add to it. The user has instant access
to all the analysis tools in MATLAB, so they can take the results and analyze and
visualize them. A goal of Simulink is to give the user a sense of the fun of modeling and
simulation, through an environment that encourages the user to pose a question, model it,
and see what happens.
Simulink is also practical. With thousands of engineers around the world using it to
model and solve real problems, knowledge of this tool will serve the user well throughout
their professional career.


____________________________________________________________________                     28
Department of Electronics and Communication, SMIT.
4.1.2 - TOOL FOR MODEL-BASED DESIGN


For modeling, Simulink provides a graphical user interface (GUI) for building models as
block diagrams, using click-and-drag mouse operations. With this interface, the user can
draw the models just as they would with pencil and paper (or as most textbooks depict
them). This is far advanced from previous simulation packages that required the user to
formulate differential equations and difference equations in a language or program.
Simulink includes a comprehensive block library of sinks, sources, linear and nonlinear
components, and connectors. The user can also customize and create their own blocks.
Models are hierarchical, so the user can build models using both top-down and bottom-up
approaches. The system at a high level can be viewed, and then by double-clicking on the
blocks to go down through the levels to see increasing levels of model detail. This
approach provides insight into how a model is organized and how its parts interact.
After a model is defined, the user can simulate it, using a choice of integration methods,
either from the Simulink menus or by entering commands in the MATLAB Command
Window. The menus are particularly convenient for interactive work, while the
command-line approach is very useful for running a batch of simulations. Using scopes
and other display blocks, the user can see the simulation results while the simulation is
running. In addition, the user can change many parameters and see what happens due to
that change for "what if" exploration. The simulation results can be put in the MATLAB
workspace for post processing and visualization.


4.1.3 - CREATING AN EMPTY MODEL

To create the model, first Simulink is entered in the MATLAB Command Window. On
Microsoft Windows, the Simulink Library Browser appears.




____________________________________________________________________                   29
Department of Electronics and Communication, SMIT.
Fig – 4.1.3(a):- Creating An Empty Model


To create a new model on Windows, the New Model button on the Library Browser's
toolbar is clicked.




                      Fig – 4.1.3(b):- Simulink Library Browser


Simulink opens a new model window.




                      Fig – 4.1.3(c ):- Simulink Model Window


____________________________________________________________________        30
Department of Electronics and Communication, SMIT.
4.1.4 - ADDING BLOCKS
To create this model, the blocks are copied into the model from the following Simulink
block libraries:
    •   Sources library (the Sine Wave block)
    •   Sinks library (the Scope block)
    •   Continuous library (the Integrator block)
    •   Signal Routing library (the Mux block)


A Sine Wave block can be copied from the Sources library, using the Library Browser for
Windows only To copy the Sine Wave block from the Library Browser, first the Library
Browser tree expanded to display the blocks in the Sources library. This is done by
clicking the Sources node to display the Sources library blocks. Finally, the Sine Wave
block is selected by clicking the Sine Wave node. Here is how the Library Browser
should look after this is done.




                       Fig – 4.1.4(a):- Simulink Library Browser


Now a copy of the Sine Wave block is dragged from the browser and dropped in the
model window. To copy the Sine Wave block from the Sources library window, double-
clicking the Sources icon in the Simulink library window opens the Sources window.


____________________________________________________________________                 31
Department of Electronics and Communication, SMIT.
On Windows, right clicking on the Simulink node in the Library Browser and then
clicking the resulting Open Library button can open the Simulink library window.
Simulink displays the Sources library window.




                            .
                          Fig – 4.1.4(b):- Source Library Window
Now the Sine Wave block is dragged from the Sources window to the model window.




                    Fig – 4.1.4(c):- Adding Blocks In Model Window
The rest of the blocks are copied in a similar manner from their respective libraries into
the model window. The user can move a block from one place in the model window to
another by dragging the block. The user can move a block a short distance by selecting
the block, then pressing the arrow keys. It is noticed that one or both sides of the blocks
have angle brackets. The > symbol pointing out of a block is an output port; if the symbol
points to a block, it is an input port.




                          Fig – 4.1.4(d):- Input and Output Ports


____________________________________________________________________                    32
Department of Electronics and Communication, SMIT.
4.1.5 - CONFIGURING THE MODEL

Now Simulink is set up to run the simulation for 10 seconds. First, choosing
Configuration Parameters from the Simulation menu opens the Configuration Parameters
dialog box. On the dialog box that appears, the Stop time is set to 10.0, it is the default
value. Changing the Stop time as per the user’s choice can change this run time.




                        Fig – 4.1.5(a):- Configuring The Model


Clicking the OK button closes the Configuration Parameters dialog box. Simulink applies
the parameters and closes the dialog box.


4.1.6 - RUNNING THE MODEL

Now by double-clicking on the Scope block its display window is opened. Finally, the
Start is chosen from the Simulation menu for running the simulation and then the
simulation output can be viewed on the Scope.




                          Fig – 4.1.6(a):- Running The Model

____________________________________________________________________                    33
Department of Electronics and Communication, SMIT.
The simulation stops when it reaches the stop time specified in the Configuration
Parameters dialog box. The user can also stop the simulation if he or she choose Stop
from the Simulation menu or click the Stop button on the model window's toolbar as per
their choice. To save this model, Save has to be chosen from the File menu and enter a
filename and location. That file contains the description of the model.


4.2 - HOW SIMULINK WORKS?
Simulink is a software package that enables the user to model, simulate, and analyze
systems whose outputs change over time. Such systems are often referred to as dynamic
systems. Simulink can be used to explore the behavior of a wide range of real-world
dynamic systems, including the following:
   •   Electrical circuits,
   •   Shock absorbers,
   •   Braking systems,
   •   Many other electrical, mechanical, and thermodynamic systems.


Simulating a dynamic system is a two-step process with Simulink. First, a user creates a
block diagram, using the Simulink model editor, which graphically depicts time-
dependent mathematical relationships among the system's inputs, states, and outputs. The
user then commands Simulink to simulate the system represented by the model from a
specified start time to a specified stop time.


4.2.1 - MODELING DYNAMIC SYSTEMS
A Simulink block diagram model is a graphical representation of a mathematical model
of a dynamic system. A mathematical model of a dynamic system is described by a set of
equations. The mathematical equations described by a block diagram model are known as
algebraic, differential, and/or difference equations.


4.2.2 - CREATING MODELS
Simulink provides a graphical editor that allows the user to create and connect instances
of block types selected from libraries of block types via a library browser. Simulink

____________________________________________________________________                     34
Department of Electronics and Communication, SMIT.
provides libraries of blocks representing elementary systems that can be used as building
blocks. The blocks supplied with Simulink are called built-in blocks. Simulink users can
also create their own block types and use the Simulink editor to create instances of them
in a diagram. User-defined blocks are called custom blocks.



4.2.3 - TIME
Time is an inherent component of block diagrams in that the results of a block diagram
simulation change with time. Put another way, a block diagram represents the
instantaneous behavior of a dynamic system. Determining a system's behavior over time
thus entails repeatedly solving the model at intervals, called time steps, from the start of
the time span to the end of the time span. Simulink refers to the process of solving a
model at successive time steps as simulating the system that the model represents.


4.2.4 - STATES
Typically the current values of some system, and hence model, outputs are functions of
the previous values of temporal variables. Such variables are called states. Computing a
model's outputs from a block diagram hence entails saving the value of states at the
current time step for use in computing the outputs at a subsequent time step. Simulink
performs this task during simulation for models that define states.
Two types of states can occur in a Simulink model:


   •   Discrete states
   •   Continuous states.


A continuous state changes continuously. Examples of continuous states are the position
and speed of a car. A discrete state is an approximation of a continuous state where the
state is updated (recomputed) using finite (periodic or a-periodic) intervals. An example
of a discrete state would be the position of a car shown on a digital odometer where it is
updated every second as opposed to continuously. In the limit, as the discrete state time
interval approaches zero, a discrete state becomes equivalent to a continuous state. The
following is a graphical representation of a block that has states:

____________________________________________________________________                     35
Department of Electronics and Communication, SMIT.
Fig – 4.2.4(a):- States




4.2.5 - BLOCK PARAMETERS

Key properties of many standard blocks are parameterized. For example, the Constant
value of the Simulink Constant block is a parameter. Each parameterized block has a
block dialog that allows the users to set the values of the parameters.




____________________________________________________________________            36
Department of Electronics and Communication, SMIT.
5. – GRAPHICAL USER
         INTERFACE (GUI)




____________________________________________________________________   37
Department of Electronics and Communication, SMIT.
5.1 - GUI ( GRAPHICAL USER INTERFACE )
GUIDE is a MATLAB Graphical User Interface development environment, which
provides a set of tools for creating graphical user interfaces (GUIs). These tools greatly
simplify the process of designing and building GUIs. The user can use the GUIDE tools
to:


• Lay out the GUI
Using the GUIDE Layout Editor, the user can lay out a GUI easily by clicking and
dragging GUI components — such as panels, buttons, text fields, sliders, menus, and so
on — into the layout area.


• Program the GUI
GUIDE automatically generates an M-file that controls how the GUI operates. The M-file
initializes the GUI and contains a framework for all the GUI callbacks — the commands
that are executed when a user clicks a GUI component. Using the M-file editor, the user
can add code to the callbacks to perform the functions the user want them to. The
following sections provide an overview of creating GUIs with GUIDE.



5.2 - STARTING GUIDE
To start the GUIDE, guide is entered at the MATLAB prompt. This displays the GUIDE
Quick Start dialog, as shown in the following figure.




                             Fig – 5.2(a):- Starting Guide



____________________________________________________________________                   38
Department of Electronics and Communication, SMIT.
From the Quick Start dialog, the user can:

• Create a new GUI from one of the GUIDE templates — prebuilt GUIs that the user can
modify for their own purposes.


• Open an existing GUI.
Once the user have selected one of these options, by clicking OK, the GUI in the

Layout Editor opens.



5.3 - THE LAYOUT EDITOR

When a GUI is opened in GUIDE, it is displayed in the Layout Editor, which is the
control panel for all of the GUIDE tools. The following figure shows the Layout Editor
with a blank GUI template.




                              Fig – 5.3(a):- Layout Editor

The user can lay out the GUI by dragging the components, such as push buttons, pop-up
menus, or axes, from the component palette, at the left side of the Layout Editor, into the
layout area.


____________________________________________________________________                    39
Department of Electronics and Communication, SMIT.
For example, if the user drags a push button into the layout area, it appears as in the
following figure.




                              Fig – 5.3(b):- Layout Editor



5.4 - GUIDE TEMPLATES
The GUIDE Quick Start dialog provides templates for several basic types of GUIs. The
advantage of using templates is that often the user can modify a template more quickly
and easily than by starting from a blank GUI. When the user selects a template in the
Templates pane, a preview of it appears in the right-hand pane.




                            Fig – 5.4(a):- Guide Templates

____________________________________________________________________                40
Department of Electronics and Communication, SMIT.
Clicking OK opens the template in the Layout Editor, as shown in the following figure.




                            Fig – 5.4(b):- Guide Templates
To display the names of the GUI components in the component palette, select
Preferences from the File menu, check the box next to Show names in component
palette, and click OK. Note that the Layout Editor does not display the functioning GUI.


5.5 - RUNNING A GUI
To run a GUI, select Run from the Tools menu, or click the run button on the toolbar.
This displays the functioning GUI outside the Layout Editor. For example, when the user
runs the GUI with Axes and Menu template, it appears as shown in the following figure.




                            Fig – 5.5(a):- Running A GUI

____________________________________________________________________                  41
Department of Electronics and Communication, SMIT.
This GUI displays various MATLAB plots. Select a plot from the pop-up menu and click
Update. If the user is running the GUI for the first time, the user has to save it first. After
it is saved, the GUIDE runs the GUI and opens an M-file for the GUI in the default text
editor.


5.6 - GUI FIG-FILES AND M-FILES
GUIDE stores a GUI in two files, which are generated the first time the user save or run
the GUI:
    •     A FIG-file, with extension .fig, which contains a complete description of the GUI
          layout and the components of the GUI: push buttons, menus, axes, and so on.
    •
    •     An M-file, with extension .m, which contains the code that controls the GUI,
          including the callbacks for its components. These two files correspond to the tasks
          of laying out and programming the GUI. When the user lay out of the GUI in the
          Layout Editor, their work is stored in the FIG-file. When the user programs the
          GUI, their work is stored in the M-file.


5.7 - PROGRAMMING THE GUI M-FILE
After laying out the user’s GUI, the user can program the GUI M-file using the M-file
Editor. GUIDE automatically generates this file from the user’s layout the first time the
user saves or run the GUI. The GUI M-file:
          •   Initializes the GUI.
          •   Contains code to perform tasks before the GUI appears on the screen, such
              as creating data or graphics.
          •   Contains the callback functions that are executed each time a user clicks a
              GUI component.
Initially, each callback contains just a function definition line. The user then use the
M-file editor to add code that makes the component function the way he or she want it to.

To open the M-file, the M-file Editor icon           on the Layout Editor Toolbar is clicked.
The following figure shows the M-file for the GUI with Axes and Menu template.


____________________________________________________________________                        42
Department of Electronics and Communication, SMIT.
The user can view the callback for any of the GUI components by clicking the function

icon      on the toolbar. This displays a list of all the callbacks, as shown in the following
figure.




                      Fig – 5.7(b):- Programming The GUI M-files
Clicking a callback on the list displays the section of the M-file containing the callback,
where the user can edit it. This example shows the callback template for
pushbutton1_Callback.




                      Fig – 5.7(c):- Programming The GUI M-files

Whatever may be the approach towards designing a specific project that is we can use
MATLAB Simulink blockset or Guide to make GUI or just to simply create a .m file, the
basics remain the same that is on the background of a GUI figure or Simulink block a
basic .m file is functional only the user interfacing changes .Though all are working with
the help of m-files the format and the syntax changes according to the approach .



____________________________________________________________________                       43
Department of Electronics and Communication, SMIT.
6.- SELECTION OF TV
                TUNER CARD




____________________________________________________________________   44
Department of Electronics and Communication, SMIT.
6.1 - SIMULINK MODEL USED FOR DATA ACQUISITION

As we have worked more with data acquisition and image acquisition, so we have
focused more light on the topic. According to our aim of Real- Time Multimedia Signal
Processing using MATLAB, previously we were trying to study the multimedia card (TI
DM642EVM) already provided in the Simulink blockset. For that we were using
DM642EVM block, which is the TI C6000 target preference block.




                             Fig – 6.1(a):- DM642EVM

These are the DM642EVM Board Support blocks. These blocks must be present on the
DM642EVM block




                 Fig – 6.1 (b):- DM642EVM Board Support blocks




____________________________________________________________________              45
Department of Electronics and Communication, SMIT.
We were using it just to know the basics of a standard multimedia card like TI
DM642EVM (the price of the Texas Instrument TV Tuner card costs more than $ 1,
50000), after studying it we had planned to get a cheaper card and to modify it with
software according to the desired parameters.

Moreover the block provided in the simulink could be set to different parameters but we
had no acess to the main .m source code due to PROPITORY RIGHTS. And the
DM642EVM block was a block as a whole with no inputs or outputs on it. There was
even no sub-blocks, from which we could gather some information about the working of
the block. After a lot of effort we found out an option that is the “look under mask”
option, which provides an acess to the sub-blocks of the main block. But unfortunately
the look under mask for DM642EVM provided us with nothing

All these took a lot of time. After spending a lot of time that is almost two and half
months in this, we decided to change the Tuner card, and we selected the Pinacle TV
Tuner card for our project. But unfortunately we could not buy it due to its high price,
which was Rs 2800/-. We even could not get hold of the theory of the Pinacle tuner card,
which was also not available due to the company’s proprietary rights.

Finally we bought the Pixel View TV Tuner card, which was of little low price Rs 1400/-.
With lot of effort we got hold of the product specification of the Pixel View tuner card,
which was send to us by the company after a humble request to do so. After studying the
specifications we tried to build up a model for data acquisition and display in the
MATLAB itself. This model could access the videos, which were inbuilt in MATLAB.
We had add audio from microphone and inserted according to our choice. After running
this we could view the video, which we have selected from the inbuilt videos in
MATLAB along with the text we had inserted and at the same time could receive the
audio recorded and inserted by us. The apparent problem with this model was that there
was no proper video streaming and so there was lag between the video and the audio.

MATLAB “winvideo” video adapter by default selects the composite source in RGB
format. RGB format was not a problem, but the composite source selection became a big
problem. According to it when we are getting the source from camera it is in composite


____________________________________________________________________                  46
Department of Electronics and Communication, SMIT.
mode and the winvideo adapter in MATLAB also selects the composite mode and we get
an output that is the preview of a real-time video captured by the camera as a result.

But when we were trying to get the real-time output from the TV antenna, we could not
get an output because the antenna input source is in tuner mode, and winvideo adapter by
default selects the composite mode. So we have to change the source code (m-file) of the
image acquisition blockset of simulink. But unfortunately the source m-file of the block
was in .dll format so was inaccessible to us, so ultimately at the cost of time and effort we
had to switch over to simple m-file programming.

Thus Simulink could not be used for viewing the TV channels in MATLAB. So we
decided to develop program in MATLAB itself for that purpose. The tuner card is set to
the tuner video mode, while the winvideo adapter in MATLAB is set to the composite
video mode by default.

Since we are working on both on-line and off-line, so we have to take the data from the
TV as well as from the digital camera. For this purpose we have to access both the Tuner
card and the camera. And for accessing the tuner card the default video mode of the
MATLAB had to be changed. With lot of efforts we have developed a program with
which we could access the tuner card as well as the camera. This program is developed in
such a way that when it’s debugged and run, it can change the default video mode of
MATLAB that is the “composite video” into the “tuner” mode, as per the choice. By
doing so we could view the TV channels in MATLAB, and we even received the audio
signals of the TV channel.




____________________________________________________________________                      47
Department of Electronics and Communication, SMIT.
6.2 – JUSTIFICATION

We could not use TI due to the following major reasons:




   1.      it takes at least six months to order and get the card in hand.

   2.      It is too costly i.e., it is in $1, 8000, so we could not afford it.

   Reasons for using PIXEL VIEW card are:

   1. it is almost the same like TI card, the only difference is in quality of output.

   2. There is no TV-out for further broadcasting like TI. This can be used for future
        programming, but at this stage we do not need it.

   3. There are many extra features in TI, which we can use while using the card for
        viewing and broadcasting, but they are not so important as the requirement for our
        program.

   4. The PIXEL VIEW card is readily available.

   5. it is very cheap in comparison to TI card, it cost only Rs-1400/-.




____________________________________________________________________                     48
Department of Electronics and Communication, SMIT.
7.– PROGRAMMES




____________________________________________________________________   49
Department of Electronics and Communication, SMIT.
7.1 – VIDEO ACQUISITION PROGRAMME


vidobj = videoinput(“winvideo”)
sources = vidobj.source
whos sources
set(vidobj,’selectedsourcename’,’tuner’)
sources = vidobj.source
get(vidobj)
src = getselectedsource(vidobj)
get(src)
framesPerTriggerValue = get((vidobj),’FramesPerTrigger’)
brightnessValue = get(src,’Brightness’)
set(vidobj)
set(src)
set(src,’Contrast’,9000)
set(src,’Brightness’,5000)
set(src,’Saturation’,3000)
set(src,’Hue’,3000)
get(src)
start(vidobj)
preview(vidobj)
delete(vidobj)



Here we make a video object i.e. “vidobj” and then access the properties of the video
object i.e. colors, brightness, hue, etc and also the properties of the video source. Not
only we access them but also we can modify them. By default the source selects the
composite mode, out of the three possible modes, which are:
   1. S-Video mode.
   2. Tuber mode.


____________________________________________________________________                  50
Department of Electronics and Communication, SMIT.
3. Composite mode.
Now in the line “set(vidobj,’selectedsourcename’,’tuner’)” we select the tuner source so
the problem is solved i.e. if we keep this line we can access TV and if we omit this line
we can access camera. This program also had some problems, which are:
   1. Though it cost a lot of time and effort it seems too simple.
   2. It is not user friendly.
   3. A puzzle to a lay man.
So, ultimately we switched over to GUIDE tool of MATLAB to build a user friendly and
sophisticated looking GUI.


We faced a lot of problems in there to. Though the basic image acquisition concept
remains the same, the basic m-file writing format and syntax changes drastically from
command window m-file to Simulink model to a GUI. But finally with lots of efforts we
developed a program for building a GUI.


7.2 - PROGRAMME FOR BUILDING GUI

function varargout = cameracompositeandtvtuner(varargin)
%       cameracompositeandtvtuner - launch a GUI to control image
acquisition session:
%   The GUI helps in:
%        craeting the video object,
%        previewing and snap shotting,
%        controlling frame grabber parameters,
%    The video object constructor is: videoinput('winvideo', 1, format)
-


%      session begins with pressing the 'VideoInput' pushbutton to create
the   video object.
%
%     The application sends its messages to the MATLAB environment.
%     user should keep the MATLAB environment visible.

%
%   Quick start:
%        1. Press VideoInput (wait untill the label changes to: 'Delete
VideoInput').
%         2. Press Preview (user should see the video stream from the
camera or tv
%          the label changes to: 'Close Preview').
%         3. Press FramesAcquired (=0), FramesAvailable (=0), IsRunning
(No), IsLogging (No) -


____________________________________________________________________                  51
Department of Electronics and Communication, SMIT.
%              all answers appear in the Matlab environment.
%         4. Press START (the acquisition begins with default parameters:
FramesPerTrigger=10 etc...).
%        5. Press FramesAcquired (=10), FramesAvailable(=10).
%            6. Press GetData (to get the acquired data from the video
object).
%           7. Press Save ( a dialog box appears suggesting a file-name
composed from the Test name and
%              the time yyyymmdd_HHMMSS).
%          8. Press ImageDisplay (it should load another independent GUI
to view what user created in VideoControl).
%
% Image Acquisition:
%           Editing the fields: FrameGrabInterval (take a frame every X
frames),
%                  FramesPerTrigger, TriggerRepeat (the system expects
1+TriggerRepeat triggers after START),
%       TriggerFrameDelay (number of frames to skip after trigger).
%          Note: When video object is created it always has the defaults
values,
%       regardless of what is written in the edit fields.
%   Video Source:
%       From this pannel user can control Brightness, Contrast and
%       resolution .
%   Function:
%       START - make the video object running (ready for logging upon
%       trigger)
%       Trigger - useful at manual trigger only, begins logging.
%       STOP - stop the video object from running.
%       GetData - brings acquired data from video object to the MATLAB
%             environment. user can not save data unless he pressed it
before!
%       Save - save the acquired data to a file. user can change the
%       suggested file name as user like.
%          ImageDisplay - launch an independent GUI to display images of
the
%       unique structure preduced by CAMERACOMPOSITEANDTVTUNER.
%   Trigger:
%       Immediate - begin logging immediately after user press's START.
%       Manual - begin logging after user press's TRIGGER.
%
%   Logging:
%          LoggingMode - 'memory' (producing data structure that will be
saved by SAVE),
%       'disk&memory' (creating also an avi file) or 'disk'.
%
%   MENU:
%          On the menu bar user has 'Trigger' and 'Info' to display the
status
%          of the video object, video source and trigger info. If user's
window
%            is docked into the MATLAB window, the menus will join the
MATLAB
%       menu bar on top of the window.
%

gui_Singleton = 1;

____________________________________________________________________   52
Department of Electronics and Communication, SMIT.
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton', gui_Singleton, ...
    'gui_OpeningFcn', @cameracompositeandtvtuner_OpeningFcn, ...
    'gui_OutputFcn', @cameracompositeandtvtuner_OutputFcn, ...
    'gui_LayoutFcn', [] , ...
    'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
     gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before cameracompositeandtvtuner is made visible.
function    cameracompositeandtvtuner_OpeningFcn(hObject,      eventdata,
handles, varargin)
%avidobj = videoinput('winvideo')
%sources = avidobj.source
%whos sources
%set(avidobj,'selectedsourcename','tuner')
%sources = avidobj.source
% This function has no output args, see OutputFcn.
% hObject     handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles     structure with handles and user data (see GUIDATA)
% varargin     command line arguments to cameracompositeandtvtuner (see
VARARGIN)
% Choose default command line output for cameracompositeandtvtuner
handles.output = hObject;
% my global definitions:
handles.data = [];
handles.aviobj =[];
imaqreset
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes cameracompositeandtvtuner wait for user response (see

UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function   varargout    =   cameracompositeandtvtuner_OutputFcn(hObject,
eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --------------------------------------------------------------------

____________________________________________________________________   53
Department of Electronics and Communication, SMIT.
function miFramesPerTrigger_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
fpt = num2str(get(handles.vid, 'FramesPerTrigger'));
disp([' Frames per trigger: ', fpt]);
return

% --------------------------------------------------------------------
function miTriggerType_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
t = get(handles.vid, 'TriggerType');
disp([' Trigger type: ', t]);
return

% --------------------------------------------------------------------
function miTriggerCondition_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
tc = get(handles.vid, 'TriggerCondition');
disp([' Trigger condition: ', tc]);
return

% --------------------------------------------------------------------
function miTriggerSource_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
ts = get(handles.vid, 'TriggerSource');
disp([' Trigger source: ', ts]);
return

% --------------------------------------------------------------------
function menuTrigger_Callback(hObject, eventdata, handles)

% --- Executes on button press in pbVideoInput.
function pbVideoInput_Callback(hObject, eventdata, handles)
if get(hObject, 'userdata') == 0, % video is closed
     imaqreset;
     handles.vid = videoinput('winvideo');
    set((handles.vid),'selectedsourcename','tuner');
     handles.source = getselectedsource(handles.vid);
     set(hObject, 'string', 'Delete VideoInput');
     set(hObject, 'userdata', 1);
     guidata(hObject, handles);
    return
else
     delete(handles.vid);
     clear handles.vid;
     set(hObject, 'string', 'VideoInput');
     set(hObject, 'userdata', 0);
     set(handles.pbPreview, 'userdata', 0, 'string', 'Preview');
    %set(handles.pbCreateSource,       'userdata',      0,      'string',
'CreateSource');
    guidata(hObject, handles);
    return
end

% --- Executes on button press in pbPreview.
function pbPreview_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
if get(hObject, 'userdata') == 0, %preview is OFF

____________________________________________________________________     54
Department of Electronics and Communication, SMIT.
preview(handles.vid);
     set(hObject, 'string', 'ClosePreview');
     set(hObject, 'userdata', 1.0);
     guidata(hObject, handles);
    return
else
     closepreview(handles.vid);
     set(hObject, 'string', 'Preview');
    set(hObject, 'userdata', 0.0);
    guidata(hObject, handles);
    return
end

% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
handles.vid = [];
handles.source = [];
guidata(hObject, handles);
return

% --- Executes on slider movement.
function slBrightness_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
b = round(get(hObject, 'value'));
set(handles.source, 'Brightness', b);
set(handles.edBrightness, 'string', num2str(b));
return

% --- Executes during object creation, after setting all properties.
function slBrightness_CreateFcn(hObject, eventdata, handles)
usewhitebg = 1;
if usewhitebg
    set(hObject,'BackgroundColor',[.9 .9 .9]);


else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes upon editing.
function edBrightness_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
b = round(str2num(get(hObject, 'string')));
set(handles.slBrightness, 'value', b);
set(handles.src, 'Brightness', b);
return

% --- Executes during object creation, after setting all properties.
function edBrightness_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else




____________________________________________________________________   55
Department of Electronics and Communication, SMIT.
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --------------------------------------------------------------------
function miGetSelectedSource_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
get(handles.source)
return

% --------------------------------------------------------------------
function menuInfo_Callback(hObject, eventdata, handles)


function edContrast_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
c = round(str2num(get(hObject, 'string')));
set(handles.slContrast, 'value', c);
set(handles.src, 'Contrast', c);
return

% --- Executes during object creation, after setting all properties.
function edContrast_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on slider movement.
function slContrast_Callback(hObject, eventdata, handles)

% hObject    handle to slContrast (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
%          get(hObject,'Min') and get(hObject,'Max') to determine range
of slider
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
c = round(get(hObject, 'value'));
set(handles.source, 'Contrast', c);
set(handles.edContrast, 'string', num2str(c));
return

% --- Executes during object creation, after setting all properties.
function slContrast_CreateFcn(hObject, eventdata, handles)
usewhitebg = 1;
if usewhitebg
     set(hObject,'BackgroundColor',[.9 .9 .9]);
else



____________________________________________________________________   56
Department of Electronics and Communication, SMIT.
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on selection change in ppTriggerConfig.
function ppTriggerConfig_Callback(hObject, eventdata, handles)
% hObject    handle to ppTriggerConfig (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns ppTriggerConfig
contents as cell array
%            contents{get(hObject,'Value')} returns selected item from
ppTriggerConfig
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
selection = get(hObject, 'value');
config = triggerinfo(handles.vid);
triggerconfig(handles.vid, config(selection));

% --- Executes during object creation, after setting all properties.
function ppTriggerConfig_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on button press in pbFramesAcquired.
function pbFramesAcquired_Callback(hObject, eventdata, handles)

if get(handles.pbVideoInput, 'userdata') == 0, return, end;
frames = get(handles.vid, 'FramesAcquired');
s = sprintf('%s%gn', 'Frames acquired: ', frames);
disp(s);

% --------------------------------------------------------------------
function miGetVideoInput_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
get(handles.vid)
return


function edFrameGrabInterval_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
set(handles.vid, 'FrameGrabInterval', str2num(get(hObject, 'string')));
guidata(hObject, handles);
return

% --- Executes during object creation, after setting all properties.
function edFrameGrabInterval_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else



____________________________________________________________________   57
Department of Electronics and Communication, SMIT.
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

function edFramesPerTrigger_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
set(handles.vid, 'FramesPerTrigger', str2num(get(hObject, 'string')));
guidata(hObject, handles);
return

% --- Executes during object creation, after setting all properties.
function edFramesPerTrigger_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end


function edTriggerRepeat_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
set(handles.vid, 'TriggerRepeat', str2num(get(hObject, 'string')));
guidata(hObject, handles);
return

% --- Executes during object creation, after setting all properties.
function edTriggerRepeat_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on button press in pbDefaultsAcquisition.
function pbDefaultsAcquisition_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
set(handles.edFrameGrabInterval, 'string', '1');
set(handles.vid, 'FrameGrabInterval', 1);
set(handles.edFramesPerTrigger, 'string', '10');
set(handles.vid, 'FramesPerTrigger', 10);
set(handles.edTriggerRepeat, 'string', '0');
set(handles.vid, 'TriggerRepeat', 0);
set(handles.edTriggerFrameDelay, 'string', '0');
set(handles.vid, 'TriggerFrameDelay', 0);
guidata(hObject, handles);
return

function edTriggerFrameDelay_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
set(handles.vid, 'TriggerFrameDelay', str2num(get(hObject, 'string')));
guidata(hObject, handles);
return

____________________________________________________________________   58
Department of Electronics and Communication, SMIT.
% --- Executes during object creation, after setting all properties.
function edTriggerFrameDelay_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on button press in pbSnapshot.
function pbGetSnapshot_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end; % video
object absent
if get(hObject, 'userdata') == 0,
     set(hObject, 'userdata', 1.0);
     s = getsnapshot(handles.vid);
     figure(1);
     imshow(s);
     set(hObject, 'userdata', 0.0);
     guidata(hObject, handles);
    return
else
    return
end
return

% --- Executes on button press in pbFramesAvailable.
function pbFramesAvailable_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
frames = get(handles.vid, 'FramesAvailable');
s = sprintf('%s%gn', 'Frames available: ', frames);
disp(s);
return

% --- Executes on button press in pbStart.
function pbStart_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
if isrunning(handles.vid), return, end;
start(handles.vid);

return

% --- Executes on button press in pbTrigger.
function pbTrigger_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
if ~strcmp(get(handles.vid, 'TriggerType'), 'manual'), return, end;
if ~isrunning(handles.vid), return, end;
if islogging(handles.vid), return, end;
trigger(handles.vid);
return

% --- Executes on button press in pbStop.
function pbStop_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
if ~isrunning(handles.vid), return, end;

____________________________________________________________________   59
Department of Electronics and Communication, SMIT.
stop(handles.vid);
return

%   % --- Executes on button press in pbImaqMontage.
%   function pbImaqMontage_Callback(hObject, eventdata, handles)
%   if get(handles.pbVideoInput, 'userdata') == 0, return, end;
%   % figure(2);% TO DO:: use the correct data structure to display...
%   % imaqmontage(handles.data);
%   return

% --- Executes on button press in pbFlushData.
function pbFlushData_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
flushdata(handles.vid);
return


% --- Executes on button press in pbImageDisplay.
function pbImageDisplay_Callback(hObject, eventdata, handles)
ImageDisplay
return


% --- Executes on button press in pbGetData.
function pbGetData_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
if get(handles.vid, 'FramesAvailable') == 0, return, end;
if get(handles.vid, 'TriggersExecuted') < 1, return, end;
handles.data = [];
T = get(handles.vid, 'TriggersExecuted');
for t=1:T,
    [handles.data{t}.frames,                       handles.data{t}.time,
handles.data{t}.metadata] = getdata(handles.vid);
end
guidata(hObject, handles);
return

% --- Executes on button press in pbSave.
function pbSave_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
if isempty(handles.data), return, end;
tx = get(handles.edTransducerID, 'string');
d=handles.data;
c = fix(clock);
filename=sprintf('%s_%4d-%02d-%02d_%02d%02d%02d%s',   tx,   c(1),    c(2),
c(3), c(4), c(5), c(6), '.mat');
prompt={'Enter file name:'};
name='Save current data to a file';
numlines=1;
defaultanswer= {filename};
filename2='';
filename2=inputdlg(prompt,name,numlines,defaultanswer);
if isempty(filename2), return, end;
save(filename2{1}, 'd');
return



____________________________________________________________________     60
Department of Electronics and Communication, SMIT.
% --- Executes on editing.
function edROIx_Callback(hObject, eventdata, handles)
% if get(handles.pbVideoInput, 'userdata') == 0, return, end;
% a = get(handles.vid, 'ROI');
% new = str2num(get(hObject, 'string'));
% set(handles.vid, 'ROI', [new a(2) a(3) a(4)]);
return;

% --- Executes during object creation, after setting all properties.
function edROIx_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on editing.

function edROIy_Callback(hObject, eventdata, handles)

% if get(handles.pbVideoInput, 'userdata') == 0, return, end;
% a = get(handles.vid, 'ROI');
% new = str2num(get(hObject, 'string'));
% set(handles.vid, 'ROI', [a(1) new a(3) a(4)]);
return;

% --- Executes during object creation, after setting all properties.
function edROIy_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on editing.
function edROIwidth_Callback(hObject, eventdata, handles)
% if get(handles.pbVideoInput, 'userdata') == 0, return, end;
% a = get(handles.vid, 'ROI');
% new = str2num(get(hObject, 'string'));
% set(handles.vid, 'ROI', [a(1) a(2) new a(4)]);
return;

% --- Executes during object creation, after setting all properties.
function edROIwidth_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end



____________________________________________________________________   61
Department of Electronics and Communication, SMIT.
% --- Executes on editing.
function edROIheight_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function edROIheight_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on button press in pbROIdefaults.
function pbROIdefaults_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
a = get(handles.vid, 'videoresolution');

x = 0; y = 0;
set(handles.vid, 'ROI', [x y a(1) a(2)]);
set(handles.edROIx, 'string', num2str(x));
set(handles.edROIy, 'string', num2str(y));
set(handles.edROIwidth, 'string', num2str(a(1)));
set(handles.edROIheight, 'string', num2str(a(2)));
guidata(hObject, handles);
return

% --- Executes on button press in pbROIupdate.
function pbROIupdate_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
a = zeros(1,4);
a(1) = str2num(get(handles.edROIx, 'string'));
a(2) = str2num(get(handles.edROIy, 'string'));
a(3) = str2num(get(handles.edROIwidth, 'string'));
a(4) = str2num(get(handles.edROIheight, 'string'));
set(handles.vid, 'ROI', a);
guidata(hObject, handles);
return

% --- Executes on editing.
function edTransducerID_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function edTransducerID_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end

% --- Executes on button press in pbIsRunning.
function pbIsRunning_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
s = isrunning(handles.vid);

____________________________________________________________________   62
Department of Electronics and Communication, SMIT.
switch s
    case 0
         disp(' Video object is NOT running');
    case 1
         disp(' Video object is running');
end
return

% --- Executes on button press in pbIsLogging.
function pbIsLogging_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
s = islogging(handles.vid);
switch s
    case 0

        disp(' Video object is NOT logging');
    case 1
        disp(' Video object is logging');
end
return

% --- Executes on selection change in ppLoggingMode.
function ppLoggingMode_Callback(hObject, eventdata, handles)
if get(handles.pbVideoInput, 'userdata') == 0, return, end;
index = get(hObject, 'value');
str = get(hObject, 'string');
sLoggingMode = str{index};
set(handles.vid, 'LoggingMode', sLoggingMode);
guidata(hObject, handles);
return

% --- Executes on creation.
function ppLoggingMode_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end
% --- Executes on editing.
function edFps_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function edFps_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'))
;
end
% --- Executes on button press in pushbutton25.
function pushbutton25_Callback(hObject, eventdata, handles)
close(gcf)
% hObject    handle to pushbutton25 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

____________________________________________________________________   63
Department of Electronics and Communication, SMIT.
With the help of this program we have created a GUI for the video files from both the TV
and the camera. GUIDE tool used for creating GUI is set to composite mode by default.
By this program we change the composite mode to tuner mode.
Department of Electronics and Communication, SMIT


7.3 - AUDIO ACQUISITION BLOCK


                                                                      Digitized
 MIC                 Sound card           ADC                          Audio

                                                                                 Work space
                Software control
                                                                      Audio
                                                                      Wave
                               MATLAB                                               AUDIO

                                                                      MUX
                                                          VIDEO


                                                                             T
                                                                             S         A/V


                                                                     DEVICE
                          Fig – 7.3(a) Audio Acquisition Block


The audio input from a microphone is feed into the sound card, which is an analog to
digital converter. The output is a digitized audio. This digitized audio is then saved in
MATLAB workspace, where it is converted into audio wave. The sound card does not
access both the video and audio simultaneously. It accesses them separately with a
faction of time interval in between, which we cannot notice. So the video and audio are
merged together in a multiplexer, which together forms a transport stream, which in the
audio video output (A/V). This A/V then goes to the display device.

____________________________________________________________________                        64
Department of Electronics and Communication, SMIT.
7.4 - SIMULILNK MODEL FOR AUDIO ACQUISITION




                Fig – 7.4(a):- Simulink Based Audio Acquisition Block


For audio acquisition we have designed the above model. The model consists of a audio
input block which takes audio inputs, a audio output block for producing audio output
and a “to web file” block which records and saves the audio data as a web file i.e. audio
file. The audio data taken from the audio input device goes to the audio output device
form where we can be heard and then to a “web file” block where it is recorded and saved
as a web file. The model can be modified by changing the parameters the blocks. The
parameters which can be changed are:
Audio input block parameters are:- Sample rate(Hz), Sample width(bits), Samples per
frame, Queue(seconds), Audio device, Data type.
Audio output block parameters are:- Queue duration(seconds), Initial output delay
(seconds) and Audio device.
To web file block parameters are:- File name, Sample width(bits) and Minimum number
of samples for each write to file.


____________________________________________________________________                  65
Department of Electronics and Communication, SMIT.
8. - TV TUNER CARD




____________________________________________________________________   66
Department of Electronics and Communication, SMIT.
8.1 - THEORITICAL STUDY

The TV tuner card works on the basis of the following block diagram. The input data’s
are converted from analog to digital by the AD/C block, then they are multiplexed. This
data is then processed by the DSP and again converted back to analog by the DA/C block
and feed into the TV. And the digital data from the DSP block is also feed into the
computer monitor.


                     ANALOG TO
 DATA                 DIGITAL
 INPUT 1             CONVERTER
                      (ADC ) - 1                                   DIGITAL
                                           MULTIPLEXER              SIGNAL
                                                                  PROCESSOR                 MONITOR
                                             ( MUX )                 ( DSP )
 DATA
 INPUT 2             ANALOG TO
                      DIGITAL
                     CONVERTER
                      (ADC ) - 2
                                                                               DIGITAL TO
                                                                                ANALOG
                                                                               CONVERTER
                                                                                 (DA/C)



                                                                                 TV
                       Fig – 8.1(a):- TV Tuner Block Diagram

A TV tuner card is a computer component that allows television signals to be received
by a computer. Most TV tuners also function as video capture cards, allowing them to
record television programs onto a hard disk.




                             Fig – 8.1(b):- TV Tuner Card

While typically a PCI-bus expansion card, they can also be a USB device. The card
contains a receiver, tuner, demodulator, and a analog-to-digital converter for analog

____________________________________________________________________                  67
Department of Electronics and Communication, SMIT.
TV and DSP. Like TV sets, each version is designed for the radio frequencies and video
formats used in each country. Many newer TV tuners have Flash memory big enough to
hold the firmware for decoding several different video formats, making it possible to use
the tuner in many countries without having to flash the firmware. In addition to the
frequency tuner, many include a composite video input. Many TV tuners can function as
FM radios: this is because the FM radio spectrum lies between television channels 6 and
7, and the DSP can be easily programmed to decode FM. Some provide DVB reception
for digital radio, television or data signals (either with or without hardware MPEG
decoding capability); these may be used to receive satellite broadcasts but normally
provide no analogue input capability. Most internal tuners do all the low level
demodulation needed to convert a radio signal into an on-screen image using a hardware
DSP chip or ASIC; some also have hardware MPEG decoders and use DMA to bypass
the CPU entirely. Some cheaper tuners don't do much of the onboard signal processing
and rely on the system's CPU for that task. External tuners may convert the signal into
either a video stream suitable for display on the screen, or to an intermediate format such
as MPEG; in either case, the CPU is needed to direct the image onto the screen.

8.2 – PXELVIEW TV TUNER CARD:

We are using the Pixel View TV Tuner card with the chip Bt-787 , having the model no.
TCL2002MB-33F.




                       Fig-8.2(a):-PIXEL VIEW TV Tuner card
____________________________________________________________________                    68
Department of Electronics and Communication, SMIT.
8.2.1 – PIXEL VIEW CARD SPECIFICATIONS

This card has the following specifications:

MODEL :- TCL2002MB-33F

NAME :- Multimedia tuner System PAL B/G D/K&FM
   1. SCOPE :- This specification applies multimedia tuner: TCL2002MB-33F.


2.TYPE
2.1 Channel coverage:
       VHF     Low        band:   48.25 to 170.00MHz
       VHF     High       band: 170.00 to 450.00MHz
       UHF                band: 450.00 to 863.25MHz
       FM                 band: 87.00 to 108.00MHz


2.2 Receiving system:             PAL B/G D/K&FM
2.3 Intermediate frequency:
       Picture carrier:           38.9MHz
       Color carrier:             34.47MHz
       Sound              1:      33.4MHz
       Sound              2:      32.4MHz
       FM :                       10.7MHz


2.4 Antenna Input Impedance:           Unbalanced 75Ohms
2.5 Output Impedance:                  Unbalanced 75Ohms
2.6 Band Change-over system:           Digital change by PLL IC


A DC-DC converter is built tuner section to provide the tuning voltage,
thus making only 5V device.




____________________________________________________________________         69
Department of Electronics and Communication, SMIT.
3 - PIN DESCRIPTION




4 - RATING AND TEST CONDITION
4.1. Standard Voltage and Current:


             VCC(BTU):     5V±0.1V        75mA±10mA
             VCC(BIF):     5V±0.1V        90mA±15mA


4.2 Operating Voltage:     VCC:           5V±5%DC
4.3 Operating Temperature:        -10℃ to +60℃
4.4 Storage Temperature:   -20℃ to +60℃


4.5 Standard Test condition:
      Ambient Temperature:        15℃ to 25℃
      Humidity:                      45 to 70%RH



____________________________________________________________________   70
Department of Electronics and Communication, SMIT.
4.6 - I2C Chart
Table1 I2C -bus data format




4.8 - Table 3 Address selection




4.9 - Table 4 Test bits




4.10 - Table 5 Ratio select bits




____________________________________________________________________   71
Department of Electronics and Communication, SMIT.
4.11 - Table 6 Ports byte




   5 - GENERAL CHARACTERISTICS (Tuner section)




____________________________________________________________________   72
Department of Electronics and Communication, SMIT.
8.2.2.- CONNECTION DIAGRAM




                    Fig – 8.2.2(a):-Connection Diagram




          FRONT VIEW OF THE PIXEL VIEW TV TUNER CARD




                    Fig – 8.2.2(b):-Connection Diagram




____________________________________________________________________   73
Department of Electronics and Communication, SMIT.
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab

Mais conteúdo relacionado

Mais procurados

C015 apwcs10-positioning
C015 apwcs10-positioningC015 apwcs10-positioning
C015 apwcs10-positioningevegod
 
GSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display SystemGSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display SystemManish Kumar
 
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)Moe Moe Myint
 
A Modern Technique for Unauthorized Human Detection and Intimation
A Modern Technique for Unauthorized Human Detection and IntimationA Modern Technique for Unauthorized Human Detection and Intimation
A Modern Technique for Unauthorized Human Detection and Intimationijtsrd
 
Computer logical organization_tutorial
Computer logical organization_tutorialComputer logical organization_tutorial
Computer logical organization_tutorialHarikaReddy115
 
Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...
Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...
Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...Associate Professor in VSB Coimbatore
 
ms_project_israt_jarin
ms_project_israt_jarinms_project_israt_jarin
ms_project_israt_jarinIsrat Jarin
 
IRJET- Next Generation System Assistant
IRJET- Next Generation System AssistantIRJET- Next Generation System Assistant
IRJET- Next Generation System AssistantIRJET Journal
 
License plate recognition for toll payment application
License plate recognition for toll payment applicationLicense plate recognition for toll payment application
License plate recognition for toll payment applicationeSAT Journals
 
License plate recognition for toll payment application
License plate recognition for toll payment applicationLicense plate recognition for toll payment application
License plate recognition for toll payment applicationeSAT Publishing House
 
MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...
MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...
MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...IAEME Publication
 
Novel-design-Panoramic-camera-by dr MONIKA
Novel-design-Panoramic-camera-by dr MONIKANovel-design-Panoramic-camera-by dr MONIKA
Novel-design-Panoramic-camera-by dr MONIKADevarshi Bajpai
 
IRJET - Steering Wheel Angle Prediction for Self-Driving Cars
IRJET - Steering Wheel Angle Prediction for Self-Driving CarsIRJET - Steering Wheel Angle Prediction for Self-Driving Cars
IRJET - Steering Wheel Angle Prediction for Self-Driving CarsIRJET Journal
 
Turkish Sign Language Recognition Using Hidden Markov Model
Turkish Sign Language Recognition Using Hidden Markov Model Turkish Sign Language Recognition Using Hidden Markov Model
Turkish Sign Language Recognition Using Hidden Markov Model csandit
 
The Computation Complexity Reduction of 2-D Gaussian Filter
The Computation Complexity Reduction of 2-D Gaussian FilterThe Computation Complexity Reduction of 2-D Gaussian Filter
The Computation Complexity Reduction of 2-D Gaussian FilterIRJET Journal
 
Face Recognition on Linear Motion-blurred Image
Face Recognition on Linear Motion-blurred ImageFace Recognition on Linear Motion-blurred Image
Face Recognition on Linear Motion-blurred ImageTELKOMNIKA JOURNAL
 

Mais procurados (19)

C015 apwcs10-positioning
C015 apwcs10-positioningC015 apwcs10-positioning
C015 apwcs10-positioning
 
GSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display SystemGSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display System
 
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
 
A Modern Technique for Unauthorized Human Detection and Intimation
A Modern Technique for Unauthorized Human Detection and IntimationA Modern Technique for Unauthorized Human Detection and Intimation
A Modern Technique for Unauthorized Human Detection and Intimation
 
Computer logical organization_tutorial
Computer logical organization_tutorialComputer logical organization_tutorial
Computer logical organization_tutorial
 
Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...
Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...
Design and Implementation of Soft-i-Robot for face Detection and Obstacle Avo...
 
ms_project_israt_jarin
ms_project_israt_jarinms_project_israt_jarin
ms_project_israt_jarin
 
2010TDC_light
2010TDC_light2010TDC_light
2010TDC_light
 
Vinod cover 1
Vinod cover 1Vinod cover 1
Vinod cover 1
 
IRJET- Next Generation System Assistant
IRJET- Next Generation System AssistantIRJET- Next Generation System Assistant
IRJET- Next Generation System Assistant
 
License plate recognition for toll payment application
License plate recognition for toll payment applicationLicense plate recognition for toll payment application
License plate recognition for toll payment application
 
License plate recognition for toll payment application
License plate recognition for toll payment applicationLicense plate recognition for toll payment application
License plate recognition for toll payment application
 
MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...
MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...
MAPREDUCE METHODOLOGY FOR ELLIPTICAL CURVE DISCRETE LOGARITHMIC PROBLEMS – SE...
 
Novel-design-Panoramic-camera-by dr MONIKA
Novel-design-Panoramic-camera-by dr MONIKANovel-design-Panoramic-camera-by dr MONIKA
Novel-design-Panoramic-camera-by dr MONIKA
 
IRJET - Steering Wheel Angle Prediction for Self-Driving Cars
IRJET - Steering Wheel Angle Prediction for Self-Driving CarsIRJET - Steering Wheel Angle Prediction for Self-Driving Cars
IRJET - Steering Wheel Angle Prediction for Self-Driving Cars
 
Turkish Sign Language Recognition Using Hidden Markov Model
Turkish Sign Language Recognition Using Hidden Markov Model Turkish Sign Language Recognition Using Hidden Markov Model
Turkish Sign Language Recognition Using Hidden Markov Model
 
Internship Paper
Internship PaperInternship Paper
Internship Paper
 
The Computation Complexity Reduction of 2-D Gaussian Filter
The Computation Complexity Reduction of 2-D Gaussian FilterThe Computation Complexity Reduction of 2-D Gaussian Filter
The Computation Complexity Reduction of 2-D Gaussian Filter
 
Face Recognition on Linear Motion-blurred Image
Face Recognition on Linear Motion-blurred ImageFace Recognition on Linear Motion-blurred Image
Face Recognition on Linear Motion-blurred Image
 

Destaque

Provisional Pass Certificate - Sikkim Manipal University
Provisional Pass Certificate - Sikkim Manipal UniversityProvisional Pass Certificate - Sikkim Manipal University
Provisional Pass Certificate - Sikkim Manipal UniversityJayarous Antony
 
Aartselaar Aquafin water , Environmental water plant .
Aartselaar Aquafin water , Environmental water plant .Aartselaar Aquafin water , Environmental water plant .
Aartselaar Aquafin water , Environmental water plant .Mohamed Herzallah
 
Photoshop elements 10 features
Photoshop elements 10 featuresPhotoshop elements 10 features
Photoshop elements 10 featuresAurora Jordan
 
Management Consulting Talent Study
Management Consulting Talent StudyManagement Consulting Talent Study
Management Consulting Talent StudyJason G. Sanders
 
Findings of market researc1
Findings of market researc1Findings of market researc1
Findings of market researc1cat663
 
2.Personal Research
2.Personal Research2.Personal Research
2.Personal ResearchHarvey Hyde
 
Projectpresentatie Onvoltooid Verleden Tijd
Projectpresentatie Onvoltooid Verleden TijdProjectpresentatie Onvoltooid Verleden Tijd
Projectpresentatie Onvoltooid Verleden Tijdtapispleinvzw
 
#Solar mooc problem set 1 alternate exercise 1 solution.
#Solar mooc problem set 1 alternate exercise 1 solution.#Solar mooc problem set 1 alternate exercise 1 solution.
#Solar mooc problem set 1 alternate exercise 1 solution.solpowerpeople
 
Campaign: smartUSA - "Leave an Impression"
Campaign: smartUSA - "Leave an Impression"Campaign: smartUSA - "Leave an Impression"
Campaign: smartUSA - "Leave an Impression"claytonroot
 
Park prace dzieci
Park prace dzieciPark prace dzieci
Park prace dziecigosiak60
 
Flycast Management Consulting Talent Study
Flycast Management Consulting Talent StudyFlycast Management Consulting Talent Study
Flycast Management Consulting Talent StudyJason G. Sanders
 

Destaque (18)

Provisional Pass Certificate - Sikkim Manipal University
Provisional Pass Certificate - Sikkim Manipal UniversityProvisional Pass Certificate - Sikkim Manipal University
Provisional Pass Certificate - Sikkim Manipal University
 
Aartselaar Aquafin water , Environmental water plant .
Aartselaar Aquafin water , Environmental water plant .Aartselaar Aquafin water , Environmental water plant .
Aartselaar Aquafin water , Environmental water plant .
 
Photoshop elements 10 features
Photoshop elements 10 featuresPhotoshop elements 10 features
Photoshop elements 10 features
 
Management Consulting Talent Study
Management Consulting Talent StudyManagement Consulting Talent Study
Management Consulting Talent Study
 
Technical composition 1 sample
Technical composition 1 sampleTechnical composition 1 sample
Technical composition 1 sample
 
Infographicos
InfographicosInfographicos
Infographicos
 
MAD_Power Point_
MAD_Power Point_MAD_Power Point_
MAD_Power Point_
 
змейка1
змейка1змейка1
змейка1
 
Findings of market researc1
Findings of market researc1Findings of market researc1
Findings of market researc1
 
2.Personal Research
2.Personal Research2.Personal Research
2.Personal Research
 
Projectpresentatie Onvoltooid Verleden Tijd
Projectpresentatie Onvoltooid Verleden TijdProjectpresentatie Onvoltooid Verleden Tijd
Projectpresentatie Onvoltooid Verleden Tijd
 
#Solar mooc problem set 1 alternate exercise 1 solution.
#Solar mooc problem set 1 alternate exercise 1 solution.#Solar mooc problem set 1 alternate exercise 1 solution.
#Solar mooc problem set 1 alternate exercise 1 solution.
 
Cuaderno pasatiempos muncyt
Cuaderno pasatiempos muncytCuaderno pasatiempos muncyt
Cuaderno pasatiempos muncyt
 
O universo
O universoO universo
O universo
 
Campaign: smartUSA - "Leave an Impression"
Campaign: smartUSA - "Leave an Impression"Campaign: smartUSA - "Leave an Impression"
Campaign: smartUSA - "Leave an Impression"
 
Getting started
Getting startedGetting started
Getting started
 
Park prace dzieci
Park prace dzieciPark prace dzieci
Park prace dzieci
 
Flycast Management Consulting Talent Study
Flycast Management Consulting Talent StudyFlycast Management Consulting Talent Study
Flycast Management Consulting Talent Study
 

Semelhante a Real time multimedia-signal_proccesing_using_matlab

Wireless Electronic Notice Board
Wireless Electronic Notice BoardWireless Electronic Notice Board
Wireless Electronic Notice BoardSajan CK
 
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORTGSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORTAvinash Kannojia
 
A novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems devicesA novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems deviceseSAT Journals
 
A novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems devicesA novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems deviceseSAT Journals
 
MEMS Techanology full seminar report
MEMS Techanology full seminar  reportMEMS Techanology full seminar  report
MEMS Techanology full seminar reportgautam221094
 
Project Report on The Haptic Proximity Module (The HPM) by Sourabh Kumar
Project Report on The Haptic Proximity Module (The HPM) by Sourabh KumarProject Report on The Haptic Proximity Module (The HPM) by Sourabh Kumar
Project Report on The Haptic Proximity Module (The HPM) by Sourabh KumarSourabh Kumar
 
GSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display SystemGSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display SystemManish Kumar
 
Seminar report of mems
Seminar report of memsSeminar report of mems
Seminar report of memsGovind kumawat
 
GSM Besed prepaid energy meter
GSM Besed prepaid energy meterGSM Besed prepaid energy meter
GSM Besed prepaid energy meterGovil sharma
 
Seminar report of mems
Seminar report of memsSeminar report of mems
Seminar report of memsGovind kumawat
 
Training Report at Mobitel
Training Report at MobitelTraining Report at Mobitel
Training Report at MobitelDinusha Dilanka
 
Internship report on 3 g &amp; radio network optimization by md. farhad hasan
Internship report on 3 g &amp; radio network optimization by md. farhad hasanInternship report on 3 g &amp; radio network optimization by md. farhad hasan
Internship report on 3 g &amp; radio network optimization by md. farhad hasanFarhad Hasan
 
Smart Home Automation
Smart Home AutomationSmart Home Automation
Smart Home AutomationMitul Lakhani
 
SMS based Wireless Digital Board with Voice Recognition Based on GSM
SMS based Wireless Digital Board with Voice Recognition Based on GSMSMS based Wireless Digital Board with Voice Recognition Based on GSM
SMS based Wireless Digital Board with Voice Recognition Based on GSMIRJET Journal
 
WIRELESS ROBOT
WIRELESS ROBOTWIRELESS ROBOT
WIRELESS ROBOTAIRTEL
 
final-year-project-latest
final-year-project-latestfinal-year-project-latest
final-year-project-latestLasitha Konara
 
IOT Personal Weather Station
IOT Personal Weather StationIOT Personal Weather Station
IOT Personal Weather StationIRJET Journal
 
SOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITS
SOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITSSOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITS
SOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITSvivatechijri
 
automatic plant irrigation using aurdino and gsm technology
automatic plant irrigation using aurdino and gsm technologyautomatic plant irrigation using aurdino and gsm technology
automatic plant irrigation using aurdino and gsm technologythamil arasan
 

Semelhante a Real time multimedia-signal_proccesing_using_matlab (20)

Wireless Electronic Notice Board
Wireless Electronic Notice BoardWireless Electronic Notice Board
Wireless Electronic Notice Board
 
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORTGSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT
 
A novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems devicesA novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems devices
 
A novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems devicesA novel and innovative method for designing of rf mems devices
A novel and innovative method for designing of rf mems devices
 
MEMS Techanology full seminar report
MEMS Techanology full seminar  reportMEMS Techanology full seminar  report
MEMS Techanology full seminar report
 
Project Report on The Haptic Proximity Module (The HPM) by Sourabh Kumar
Project Report on The Haptic Proximity Module (The HPM) by Sourabh KumarProject Report on The Haptic Proximity Module (The HPM) by Sourabh Kumar
Project Report on The Haptic Proximity Module (The HPM) by Sourabh Kumar
 
GSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display SystemGSM Mobile Phone Based LCD Message Display System
GSM Mobile Phone Based LCD Message Display System
 
Seminar report of mems
Seminar report of memsSeminar report of mems
Seminar report of mems
 
GSM Besed prepaid energy meter
GSM Besed prepaid energy meterGSM Besed prepaid energy meter
GSM Besed prepaid energy meter
 
Seminar report of mems
Seminar report of memsSeminar report of mems
Seminar report of mems
 
Face Detection And Tracking
Face Detection And TrackingFace Detection And Tracking
Face Detection And Tracking
 
Training Report at Mobitel
Training Report at MobitelTraining Report at Mobitel
Training Report at Mobitel
 
Internship report on 3 g &amp; radio network optimization by md. farhad hasan
Internship report on 3 g &amp; radio network optimization by md. farhad hasanInternship report on 3 g &amp; radio network optimization by md. farhad hasan
Internship report on 3 g &amp; radio network optimization by md. farhad hasan
 
Smart Home Automation
Smart Home AutomationSmart Home Automation
Smart Home Automation
 
SMS based Wireless Digital Board with Voice Recognition Based on GSM
SMS based Wireless Digital Board with Voice Recognition Based on GSMSMS based Wireless Digital Board with Voice Recognition Based on GSM
SMS based Wireless Digital Board with Voice Recognition Based on GSM
 
WIRELESS ROBOT
WIRELESS ROBOTWIRELESS ROBOT
WIRELESS ROBOT
 
final-year-project-latest
final-year-project-latestfinal-year-project-latest
final-year-project-latest
 
IOT Personal Weather Station
IOT Personal Weather StationIOT Personal Weather Station
IOT Personal Weather Station
 
SOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITS
SOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITSSOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITS
SOFTWARE BASED CALCULATION OF CAPACITY OUTAGE OF GENERATING UNITS
 
automatic plant irrigation using aurdino and gsm technology
automatic plant irrigation using aurdino and gsm technologyautomatic plant irrigation using aurdino and gsm technology
automatic plant irrigation using aurdino and gsm technology
 

Último

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Último (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Real time multimedia-signal_proccesing_using_matlab

  • 1. MAJOR PROJECT REPORT ON REAL -TIME MULTIMEDIA SIGNAL PROCESSING USING MATLAB Submitted by: Angshuman Ghosh - (Reg.no. - 200212080) Aritri Debnath - (Reg.no. – 200212113) In partial fulfillment of VIII Semester, B.Tech (Electronics and communication Engineering) Under the Guidance of: Prof. Rabindranath Bera (Electronics and Communication Dept., SMIT) Dr. Jitendranath Bera and Dr. Madhuchhanda Mitra (Dept. of Applied Physics, University of Calcutta) ELECTRONICS AND COMMUNICATION ENGINEERING DEPARTMENT, JUNE 2006. SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY MAJITAR, RANGPO, EAST SIKKIM-737132 ____________________________________________________________________ 1 Department of Electronics and Communication, SMIT.
  • 2. SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY (A constituent college of Sikkim Manipal University of Health Medical and Technological Sciences) CERTIFICATE This is to certify that ANGSHUMAN GHOSH bearing the registration no:- 200212080 has successfully completed the major project titled ‘REAL-TIME MULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department of Applied Physics, University of Calcutta, in partial fulfillment of the requirement for the award of Bachelor Of Technology in Electronics and Communication Engineering of SIKKIM MANIPAL UNIVERSITY OF HEALTH MEDICAL AND TECHNOLOGICAL SCIENCES in the year 2005-06. ___________________________ Dr. R. N. Bera (Internal Guide) Head of Department, Department of Electronics and Communication Engineering, S.M.I.T, Majitar, Rangpo, Sikkim- 737132 DEPARTMENTAL SEAL DEPARTMENT OF ELECTRONICS AND COMMUNICATION. ____________________________________________________________________ 2 Department of Electronics and Communication, SMIT.
  • 3. SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY (A constituent college of Sikkim Manipal University of Health Medical and Technological Sciences) CERTIFICATE This is to certify that ARITRI DEBNATH bearing the registration no:- 200212113 has successfully completed the major project titled ‘REAL-TIME MULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department of Applied Physics, University of Calcutta, in partial fulfillment of the requirement for the award of Bachelor Of Technology in Electronics and Communication Engineering of SIKKIM MANIPAL UNIVERSITY OF HEALTH MEDICAL AND TECHNOLOGICAL SCIENCES in the year 2005-06. ___________________________ Dr. R. N. Bera (Internal Guide) Head of Department, Department of Electronics and Communication Engineering, S.M.I.T, Majitar, Rangpo, Sikkim- 737132 DEPARTMENTAL SEAL DEPARTMENT OF ELECTRONICS AND COMMUNICATION. ____________________________________________________________________ 3 Department of Electronics and Communication, SMIT.
  • 4. ACKNOWLEDGEMENT At the outset we would like to convey our sincere thanks to all the faculties and support staff of Applied Physics Department, University of Calcutta, for providing us the opportunity to carry out our 8th semester major project of B.Tech degree in Electronics and Communication in the institute. We would like to convey our profound gratitude to Prof. Rabindranath Bera (HOD, Dept of Electronics and Communication, SMIT) for providing us with an opportunity to carry out a major project on this emerging subject and encouraging and motivating us at every stage with valuable inputs which made it possible for us to be successful in our endeavor towards the completion of this major project in time. We wish to record our deep sense of gratitude to Prof. Samarjit Sengupta for his valuable inputs from time to time, indispensable support and proper guidance at every stage for completing our project work on “Real – Time Multimedia Signal Processing Using MATLAB”. Without his support and encouragement it was impossible to complete the project. Our sincere thanks and gratitude also goes to our Project Guides Dr. Jitendranath Bera (Reader, Dept. Applied Physics) and Dr. Madhuchhanda Mitra (Reader, Dept. of Applied Physics) for their support, encouragement and timely advice in our day-to-day activities. Last but not the least our thanks also go to the Laboratory Assistant Mr. Nirmal Kumar Debnath for assisting us in our day-to-day activities. __________________________ ___________________________ Angshuman Ghosh (Reg.no. 200212080) Aritri Debnath (Reg. no. 200212113) ____________________________________________________________________ 4 Department of Electronics and Communication, SMIT.
  • 5. ABSTRACT The aim of our major project is Real-Time Multimedia Signal Processing Using MATLAB using a comparatively cheaper card in contrast to expensive cards like TI DM642EVM. The project on completion will process the multi-media files like the video and audio from the TV as well as from the digital camera and these can be viewed on the computer. For this objective we have the following two Real-time approaches: • Tuner mode: - that is processing the data’s from the TV. • Composite mode: - that is processing the data’s from the digital camera. These two approaches works in two different video modes: the tuner mode and the composite mode. The online approach where the data are acquired from the TV works in the tuner video mode. While the offline approach where the data’s are acquired from a digital camera works in the composite video mode. These two modes can be turned on and off by the program we have developed in MATLAB. For acquiring data’s from the TV & Camera we have chosen a TV tuner card, which is the PIXEL VIEW TV Tuner card having the model no. TCL2002MB-33F. The reason for choosing the TV Tuner card as the video card is that the TV Tuner card has a wide bandwidth of 815MHz. And the digital camera we have chosen is OLYMPUS CAMEDIA C- 750. We have used MATLAB 7.1 for the simulation purpose, as it is a high-speed computation program, which performs various kinds of operations in much less time. ____________________________________________________________________ 5 Department of Electronics and Communication, SMIT.
  • 6. TABLE OF CONTENTS TOPIC PAGE NO. CHAPTER 1: LIST INSERTED………………………………………..9. 1.1 List of Tables………………………………………………..10. 1.2 List of Figures……………………………………………….11. CHAPTER 2: INTRODUCTION………………………………………13. 2.1 Why we are interested in this project .........................................14. 2.2 Mobile TV?……………………………………...……………..14. 2.1.1. What is a Mobile TV ……….…..……………………..14. 2.1.2. Mobile TV Theory……………..………………………14. 2.1.3 Companies Engaged……………………………………15. 2.1.4 Merits……………………….…………………………17. CHAPTER 3: MATLAB…………………….………………………….18. 3.1 Why We Are Using MATLAB?...............................................19. 3.2 What is MATLAB?………...........................................………19. 3.2.1 MATLAB Uses……………………………………………21. 3.2.2 MATLAB Syntax………………………………………….21. 3.2.3 The MATLAB Systems……………………………………21. 3.2.4 Functions……………………………………………...22 3.2.5 .Desktop Overview……………………………………23. 3.2.6 Start Button……………………………………………23. 3.2.7 Command Window……………………………………24. 3.2.8 Command History……………………………………..24. 3.2.9 Demos…………………………………………………25. 3.2 M-file…………………………………………………….….25. 3.3.1 What is a M-file?…………………………………………...25. 3.3.2 Why use M-file?……………………………………………25. ____________________________________________________________________ 6 Department of Electronics and Communication, SMIT.
  • 7. 3.3.3 How to Create, Save and Open a M-file?…………………..26. 3.3.4 How to Run a M-file?………………………………………26. CHAPTER 4: SIMULINK……………………………………………………27. 4.1 What is SIMULINK?……………………………………………………..28. 4.1.1 Tool For Simulation…………………………………………………….28. 4.1.2 Tool For Model Based Designs…………………………………………29. 4.1.3 Creating Empty Model………………………………………………….29. 4.1.4 Adding The Blocks……………………………………………………...31. 4.1.5 Configuring The Model…………………………………………………33. 4.1.6 Running The Model……………………………………………………..33. 4.2 How Does Simulink Works?……………………………………………...34. 4.2.1 Modeling Dynamic Systems…………………………………………….34. 4.2.2 Creating Models ………………………………………………………..34. 4.2.3 Time……………………………………………………………………..35. 4.2.4 State……………………………………………………………………...35. 4.2.5 Block Parameters……………………………………………………..…36. CHAPTER 5: GRAPHICAL USER INTERFACE (GUI)……………….….37. 5.1 GUI…………………………………………………………………….38. 5.2 Starting GUIDE………………………………………………………..38. 5.3 The Layout Editor……………………………………………………...39. 5.4 GUIDE Templates……………………………………………………..40. 5.5 Running A GUI………………………………………………………...41. 5.6 GUI Fig-file and M-file………………………………………………..42. 5.7 Programming The GUI M-files………………………………………..42. CHAPTER 6: SELECTION OF TV TUNER CARD………………………44. 6.1 Simulink Model Used For Data Acquisition…………………………..45. 6.2 Justification…………………………………………………………….47. ____________________________________________________________________ 7 Department of Electronics and Communication, SMIT.
  • 8. CHAPTER 7: PROGRAMMES……………………………………………..49. 7.1 Video Acquisition Program….………………………………………..50. 7.2 Program for Building GUI ……………………………..……………..51. 7.3 Audio Acquisition Block……………………………………………..64. 7.4 Simulink Model for Audio Acquisition……………………………...65. CHAPTER 8: TV TUNER CARD…………………………………………..66. 8.1 Theoretical Study …………………………………………………….67. 8.2 PIXEL VIEW TV Tuner Card………………………………………..68. 8.2.1 PIXEL VIEW TV Tuner Card Specification …………………67. 8.2.2 Connection Diagram…………………………………………..73. 8.3 S-Video……………………………………………………………….74. 8.3.1 Advantages…………………………………………………….76. 8.3.2 Disadvantages…………………………………………………76. 8.4 Composite Video……………………………………………………..77. 9. PROBLEMS…………………………………………………….78. 10. RESULT………………………………………………………….82. 10.1 Result Obtained…………………………………………………..83. 10.2 GUI Created……………………………………………………..86. 10.3 Result Obtained From TV………………………………………..87. 10.4 Result Obtained From Camera…………………………………...88. 11. CONCLUSION…………………………………………………..89. 12. DISCUSSION…………………………………………………….91. 13. BIBLIOGHRAPHY……………………………………………..92. ____________________________________________________________________ 8 Department of Electronics and Communication, SMIT.
  • 9. 1.-LIST OF TABLES AND FIGURES ____________________________________________________________________ 9 Department of Electronics and Communication, SMIT.
  • 10. 1.1 - LIST OF TABLES TOPIC PAGE NO. 1.1.1 Table - 3 :-TV Tuner Card PIN Description……………………….70. 1.1.2 Table - 4.6 :-12C - Bus Data Format……………………………….71. 1.1.3 Table - 4.8 :-Address Selection…………………………………….71. 1.1.4 Table - 4.9 :-Test Bits………………………………………………71. 1.1.5 Table - 4.10 :-Ratio Bits……………………………………………71. 1.1.6 Table - 4.11 :-Port Byte…………………………………………….72. 1.1.7 Table - 5 :-General Characteristics………………………………….72. 1.1.10 Table - 8.3.1 S-Video Pin Assignment ……………..………………75. ____________________________________________________________________ 10 Department of Electronics and Communication, SMIT.
  • 11. FIG1.2 - LIST OF FIGURES TOPICS PAGE NO. 1.2.1 Fig - 2.2.2(a):- Mobile TV………………………………….…15. 1.2.2 Fig - 3.2.5(a):- Desktop Overview…………………………….23. 1.2.3 Fig - 3.2.6(a):- Start Button……………………………………23. 1.2.4 Fig - 3.2.7(a):- Command Window……………………………24. 1.2.5 Fig - 3.2.8(a):- Command History……………………………..24. 1.2.6 Fig- 4.1.3(a):- Creating Empty Models………………………..30. 1.2.7 Fig - 4.1.3(b):- Simulink Library Browser…………………….30. 1.2.8 Fig - 4.1.3(c):- Simulink Model Window……………………..30. 1.2.9 Fig - 4.1.4(a):- Simulink Library Browser …………………....31. 1.2.10 Fig - 4.1.4(b):-Source Library Window……………………….32. 1.2.11 Fig - 4.1.4(c):-Adding blocks In Model Window……………..32. 1.2.12 Fig - 4.1.4(d):- Input and Output Ports………………………..32. 1.2.13 Fig - 4.1.6 (a):- Configuring The Model………………………33. 1.2.14 Fig - 4.1.7(a):-Running The Model……………………..……..33. 1.2.15 Fig - 4.3.5(a):- States…………………………………………..36. 1.2.16 Fig - 5.2(a):- GUI Starting Guide……………………………...38. 1.2.17 Fig - 5.3(a):- Layout Editor…………………………………….39. 1.2.18 Fig - 5.3(b):- Layout Editor…………………………………….39. 1.2.19 Fig - 5.4(b):- Guide Templates………………………….…..….40. 1.2.20 Fig - 5.4(b):- Guide Templates ……………………………..….41. 1.2.21 Fig -5.5(a):- Running A GUI…………………………………...41. 1.2.22 Fig - 5.7(b):- Programming The GUI M-files………………….43. 1.2.23 Fig - 5.7(c):- Programming The GUI M-file…….………….….43. 1.2.24 Fig - 6.1(a):- DM642EVM………………………………….….45. 1.2.25 Fig - 6.1(b):- DM642EVM Board…………………………..….45. 1.2.26 Fig - 7.3(a):- Audio Acquisition Block.……………………….64. 1.2.27 Fig - 7.3(b):- Simulink Based Audio Acquisition Block……....65. 1.2.28 Fig - 8.1(a):- TV Tuner Block Diagram……………………….67. ____________________________________________________________________ 11 Department of Electronics and Communication, SMIT.
  • 12. 1.2.29 Fig - 8.1(b):-TV Tuner Card………….……………………..…67. 1.2.30 Fig - 8.2.(a):- PIXEL VIEW TV Tuner Card…………….…....68. 1.2.31 Fig - 8.2.2(a):-Connection Diagram……………………………73. 1.2.32 Fig - 8.2.2(b):-Connection Diagram……………………………74. 1.2.33 Fig - 8.3(a):- S-Video Cable Connector………………………...74. 1.2.34 Fig - 8.3(b):-Y/C Diagram……………………………………...74. 1.2.35 Fig - 8.3.1(a):- S-Video Cable Connector……………………....75. 1.2.36 Fig -10.1(a):- Result Diagram……………………………..……83. 1.2.37 Fig - 10.2(a):- GUI Created……………………………………..86. 1.2.38 Fig - 10.3(a):- Result Obtained From TV……………………….87. 1.2.39 Fig -10.4(a):-Result Obtained From Camera……………………88. ____________________________________________________________________ 12 Department of Electronics and Communication, SMIT.
  • 13. 2. - INTRODUCTION ____________________________________________________________________ 13 Department of Electronics and Communication, SMIT.
  • 14. 2.1 - WHY WE ARE INTERESTED IN THIS PROJECT ? Latest multimedia development is interested in implementing the concept of mobile TV. Even SIMENS, NOKIA, ERICSSION etc mobile handset companies and other electronic chip pioneers have already developed an acquisition card which would fit into the size, prize and weight of a Mobile Phone, but the software for driving that chip is still under research . So, we have tried to develop an open source, functionally divided software , using the most popular, easily understandable , widely used and efficient engineering software-tool - MATLAB. 2.2 - MOBILE TV 2.2.1 - WHAT IS A MOBILE TV? Mobile TV is a recent concept where mobile subscribers will be able to view TV channels on their mobile sets. Mobile TV is a complete Phone Cast solution, which allows the subscribers to view TV channels, live events, sportscasts, and video on their mobile phones globally. 2.2.2 - MOBILE TV THEORY Phone Cast is a mobile video services platform, which enables wireless operators, content providers and media companies to allow their customers to experience Mobile TV and Video on Demand through wireless devices globally. Phone Cast reduces the complexity of managing and distributing video content, and by allowing the creation and distribution of the contents for a mobile TV network quickly. Channel surfing is also possible on the Mobile TV. It has been seen that Jupiter Research’s latest study on wireless TV found that 41 percent of US mobile phone users are interested in watching video on their handsets, and according to Strategy Analytics, mobile video content is projected to become a $4.5 billion business by 2008 ____________________________________________________________________ 14 Department of Electronics and Communication, SMIT.
  • 15. Fig – 2.2.2(a) Mobile TV 2.2.3 - COMPANIES ENGAGED Renowned companies worldwide are engaged in the development of Mobile TV. Some of the companies are: • Royal Philips Electronics. • Siemens. • NEXAGE, a wireless and multimedia software and services company. • Nokia. • T-mobile, Germany. • Alcatel. • Orange, France. • Ericsson. • Qualcomm, hand set manufacturers, United States. • Huawei Technologies, China. • LG Electronics. Royal Philips Electronics has announced its next generation TV-on-mobile solution, which is six times smaller than its previous version, the Digital Video Broadcast – ____________________________________________________________________ 15 Department of Electronics and Communication, SMIT.
  • 16. Handheld (DVB-H) front-end solution, BGT216, which is predicted to have 15 million consumer users by 2009, up from only 1.2 million in 2005, according to e-Marketer. DVB-H technologies enable consumers to receive live TV-like experiences directly onto mobile handsets and other DVB-H-based devices. In addition, operators benefit from increased revenue opportunities while preserving cellular network bandwidth for voice and other data services. Philips’ DVB-H front-end solution, BGT216, measures 7x7 mm, far smaller than the previous 15x26 mm version. The smaller size improves the integration potential of the chip into mobile devices, which will enable handset and other mobile hardware manufacturers to create simpler, sleeker designs, which satisfy the current consumer trends towards small, ultra-portable devices. DVB-H enables most efficient mass distribution of mobile TV and is optimized for mobile devices (e.g. power consumption and resolution). In regards to the industry issue of power consumption the chip BGT216 has been designed in such a way that it require low power, which will in return maximize the battery life and provide better service to the consumers. Research shows that end users want to switch between different mobile TV channels as easily and fast as using their remote control at home. Siemens’ Media Delivery Solution (MDS) offers just that. And on top of this users can download and store video files for further usage. Siemens’ (MDS) enables mobile network operators to deliver rich media content to their subscribers and roaming mobile devices. The solution is designed to generate new revenues with services such as video on demand, live video streaming and content download. LG Electronics has selected Microtune's ultra low-power Microtune's Mobile MicroTuner MT2260 chip, to enable high-performance mobile television on LG's LG-U900 DVB-H mobile phone. It is a miniature DVB-H digital TV tuner, engineered to deliver robust performance in a very low-power consumption. The Mobile MicroTuner MT2260 features higher integration than other leading DVB-H tuner solutions on the market by not requiring bulky and costly external components, such as a low-noise amplifier and transformer. The tuners are developed in such a way that they detect very small signals and simultaneously manage fading conditions, 0dB echo and large adjacent channels, ____________________________________________________________________ 16 Department of Electronics and Communication, SMIT.
  • 17. Italian mobile telecommunications service provider, Hutchison 3 Italia, expects to broadcast the FIFA World Cup games to mobile handheld devices using the digital video broadcast handheld (DVB-H) standard, in June. 2.2.4 – MERITS • Subscribers can view live TV on their mobile handset. • Mobile TV and video services provide music videos and concert coverage to younger audience. • Targets the widest possible subscriber base and allows insertion of advertisements and promotions within live TV programming and VOD services.” • Universal Theater is a premier online digital music business that produces music downloads, concerts, sporting events, special events, interviews, news clips, reality shows, ring tones, movies, and music videos and interactive programming which is distributed over the Internet and mobile platform. • Maximize revenue by attracting more users. ____________________________________________________________________ 17 Department of Electronics and Communication, SMIT.
  • 18. 3. – MATLAB ____________________________________________________________________ 18 Department of Electronics and Communication, SMIT.
  • 19. 3.1 - WHY WE ARE USING MATLAB? MATLAB is a high-speed computation program. It is an interactive system whose basic data element is an array that does not require dimensioning. This allows the user to solve many technical computing problems, especially those with matrix and vector formulations. It is a high-end programming language that gives result within a fraction of seconds. For example if we want to compute the Fast Fourier Transformation (FFT) of a function, all we have to do is type the function and then simply click on the FFT option an within seconds we have the result. MATLAB does long and complex computations in much less time and with perfect accuracy. It has got many facilities like computing FFT, DFT, IDFT, etc. More it is that to write or develop a program in MATLAB is to keep it on open source that is any body can further modify it for its betterment and can develop a better program and can work further with the basics. It also has three major tools – 1. Simple MATLAB .m file programming. 2. Simulink block approach. 3. “Guide” a tool to form useful and easy interactive GUI’s (Graphics User Interface). These three tools can be used to see the same problem from different angles or to deal with the desired output with different approaches. 3.2. - WHAT IS MATLAB? MATLAB is a high-performance language Created by The MathWorks, for technical computing. MATLAB allows: • easy matrix manipulation, • plotting of functions and data, • implementation of algorithms, • creation of user interfaces, and interfacing with programs in other languages ____________________________________________________________________ 19 Department of Electronics and Communication, SMIT.
  • 20. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows the user to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar non-interactive language such as C or Fortran. The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy access to matrix software. Today, MATLAB engines incorporate the LAPACK and BLAS libraries, embedding the state of the art in software for matrix computation. MATLAB features a family of add-on application-specific solutions called toolboxes. Very important to most users of MATLAB, toolboxes allow the user to learn and apply specialized technology. Toolboxes are comprehensive collections of MATLAB functions (M-files) that extend the MATLAB environment to solve particular classes of problems. Areas in which toolboxes are available include: • Signal processing, • Control systems, • Neural networks, • Fuzzy logic, • Wavelets, • Image Acquisition • Data Acquisition • Simulation, and many others. MATLAB can plot values created with its own commands, MATLAB is also very useful for plotting data from other sources, e.g., experimental measurements. The simplest way ____________________________________________________________________ 20 Department of Electronics and Communication, SMIT.
  • 21. to import your data into MATLAB is with the load command. 3.2.1 – MATLAB USES Typical uses of Matlab include: • Math and computation, • Algorithm development, • Data acquisition, • Modeling, simulation, and prototyping, • Data analysis, exploration, and visualization, • Scientific and engineering graphics, • Application development, including graphical user interface building. 3.2.2 – MATLAB SYNTAX MATLAB's M-Code (or simply m) is primarily value oriented. Unlike languages such as Java and C++, m is not statically typed, meaning that variables themselves do not have types, only the runtime values stored in those variables have types, as in PHP or JavaScript. 3.2.3 - THE MATLAB SYSTEM The MATLAB system consists of five main parts: Desktop Tools and Development Environment: - This is the set of tools and facilities that help the user to use MATLAB functions and files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop and Command Window, a command history, an editor and debugger, and browsers for viewing help, the workspace, files, and the search path. The MATLAB Mathematical Function Library: - ____________________________________________________________________ 21 Department of Electronics and Communication, SMIT.
  • 22. This is a vast collection of computational algorithms ranging from elementary functions, like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigen values, Bessel functions, and fast Fourier transforms. The MATLAB Language: - This is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features. It allows both "programming in the small" that is to rapidly create quickly and dirty throw away Program and "programming in the large" that is to create large and complex application program. Graphics: - MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. It includes high-level functions for two- dimensional and three-dimensional data visualization, image processing, animation, and presentation graphics. It also includes low-level functions that allow the users to fully customize the appearance of graphics as well as to build complete graphical user interfaces on the MATLAB applications. The MATLAB External Interfaces/API: - This is a library that allows the user to write C and Fortran programs that interact with MATLAB. It includes facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing MAT-files. 3.2.4 - FUNCTIONS MATLAB provides a large number of standard elementary mathematical functions, including abs, sqrt, exp, and sin. Taking the square root or logarithm of a negative number is not an error, and the appropriate complex result is produced automatically. MATLAB also provides many more advanced mathematical functions, including Bessel and gamma functions. Most of these functions accept complex arguments. For viewing a list of the elementary mathematical functions, help elfin is typed. For viewing a list of more advanced mathematical and matrix functions, help specfun is typed. ____________________________________________________________________ 22 Department of Electronics and Communication, SMIT.
  • 23. 3.2.5 - DESKTOP OVERVIEW Desktop tools are used to manage the work in MATLAB. The user can also use MATLAB functions to perform the equivalent of most of the features found in the desktop tools. The following illustration shows the default configuration of the MATLAB desktop. The setup can modified as per the users requirements. Fig – 3.2.5(a):- Desktop Overview 3.2.6 - START BUTTON The MATLAB Start button provides easy access to tools, demos, shortcuts, and documentation. By clicking on the Start button the options can be viewed. Fig – 3.2.6(a):- Start Button ____________________________________________________________________ 23 Department of Electronics and Communication, SMIT.
  • 24. 3.2.7 - COMMAND WINDOW The Command Window is used to enter variables and to run functions and M-file scripts. Fig – 3.2.7(a):-Command Window By pressing the up arrow key a previously typed statement can be recalled. Then the statement can be edited as needed and then can be run by pressing Enter. 3.2.8 - COMMAND HISTORY The statements entered by the user in the Command Window are logged in the Command History. From the Command History, the user can view previously run statements, as well as copy and execute selected statements. The user can also create an M-file from selected statements. Fig – 3.2.8(a):- Command History To save the input and output from a MATLAB session to a file, the diary function is used. ____________________________________________________________________ 24 Department of Electronics and Communication, SMIT.
  • 25. 3.2.9 - DEMOS AVAILABLE WITH MATLAB MATLAB comes with a wide array of visual demonstrations to help the user to see the extent of what they can do with the product. To start running any of the demos, demo should be typed at the MATLAB command prompt. Demos cover the following major areas: • MATLAB. • Toolboxes. • Simulink. • Blocksets. • Real-Time Workshop. • Stateflow. 3.3 - M-FILE 3.3.1 – WHAT IS AN M-FILE? An m-file, or script file, is a simple text file where the user can place Matlab commands. When the file is run, Matlab reads the commands and executes them exactly as it would if the user had typed each command sequentially at the Matlab prompt. All m-file names must end with the extension '.m' (e.g. plot .m). If a new m-file is created with the same name as an existing m-file, Matlab will choose the one, which appears first in the path order. So for a new m-file a new name should be chosen. To see if a filename.m exists, the user can type help filename at the Matlab prompt. 3.3.2 - WHY USE M-FILES? For simple problems, entering the users requests at the Matlab prompt is fast and efficient. However, as the number of commands increases or changing certain variables or values does trial and error, typing the commands over and over at the Matlab prompt becomes tedious. M-files will be helpful and almost necessary in these cases. ____________________________________________________________________ 25 Department of Electronics and Communication, SMIT.
  • 26. 3.3.3. - HOW TO CREATE, SAVE OR OPEN AN M-FILE? To create an m-file, New from the File menu in chosen and m-file has to be selected. This procedure brings up a text editor window in which the user can enter Matlab commands. To save the m-file, Save is chosen from File menu. The file should be saved with the '.m' extension. To open an existing m-file, Open is chosen from the File menu. 3.3.4 - HOW TO RUN THE M-FILE? After the m-file is saved with the name filename.m in the Matlab folder or directory, the user can execute the commands in the m-file by simply typing filename at the Matlab prompt. If the user doesn’t want to run the whole m-file, he or she can just copy the part of m-file that is desired to run and paste it at the Matlab prompt. ____________________________________________________________________ 26 Department of Electronics and Communication, SMIT.
  • 27. 4. - SIMULINK ____________________________________________________________________ 27 Department of Electronics and Communication, SMIT.
  • 28. Simulink is a block library tool for modeling, simulating and analyzing dynamic systems. It is developed by The MathWorks and works with their flagship product, MATLAB. Simulink is widely used in control theory and digital signal processing for multidomain simulation and design. Coupled with Real Time Workshop, another product from The MathWorks, Simulink can do automatic code generation for real-time implementation of systems. As the efficiency and flexibility of the code is improving, this is becoming more widely adopted for production systems, in addition to being a popular tool for embedded system design work because of its flexibility and capacity for quick iteration. A number of third-party hardware and software products are available for use with Simulink software. 4.1 - WHAT IS SIMULINK? Simulink is a software package for modeling, simulating, and analyzing dynamic systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two. Systems can also be multirate, i.e., have different parts that are sampled or updated at different rates. 4.1.1 - TOOL FOR SIMULATION Simulink encourages and allows the users to try things out. The users can easily build models from scratch, or take an existing model and add to it. The user has instant access to all the analysis tools in MATLAB, so they can take the results and analyze and visualize them. A goal of Simulink is to give the user a sense of the fun of modeling and simulation, through an environment that encourages the user to pose a question, model it, and see what happens. Simulink is also practical. With thousands of engineers around the world using it to model and solve real problems, knowledge of this tool will serve the user well throughout their professional career. ____________________________________________________________________ 28 Department of Electronics and Communication, SMIT.
  • 29. 4.1.2 - TOOL FOR MODEL-BASED DESIGN For modeling, Simulink provides a graphical user interface (GUI) for building models as block diagrams, using click-and-drag mouse operations. With this interface, the user can draw the models just as they would with pencil and paper (or as most textbooks depict them). This is far advanced from previous simulation packages that required the user to formulate differential equations and difference equations in a language or program. Simulink includes a comprehensive block library of sinks, sources, linear and nonlinear components, and connectors. The user can also customize and create their own blocks. Models are hierarchical, so the user can build models using both top-down and bottom-up approaches. The system at a high level can be viewed, and then by double-clicking on the blocks to go down through the levels to see increasing levels of model detail. This approach provides insight into how a model is organized and how its parts interact. After a model is defined, the user can simulate it, using a choice of integration methods, either from the Simulink menus or by entering commands in the MATLAB Command Window. The menus are particularly convenient for interactive work, while the command-line approach is very useful for running a batch of simulations. Using scopes and other display blocks, the user can see the simulation results while the simulation is running. In addition, the user can change many parameters and see what happens due to that change for "what if" exploration. The simulation results can be put in the MATLAB workspace for post processing and visualization. 4.1.3 - CREATING AN EMPTY MODEL To create the model, first Simulink is entered in the MATLAB Command Window. On Microsoft Windows, the Simulink Library Browser appears. ____________________________________________________________________ 29 Department of Electronics and Communication, SMIT.
  • 30. Fig – 4.1.3(a):- Creating An Empty Model To create a new model on Windows, the New Model button on the Library Browser's toolbar is clicked. Fig – 4.1.3(b):- Simulink Library Browser Simulink opens a new model window. Fig – 4.1.3(c ):- Simulink Model Window ____________________________________________________________________ 30 Department of Electronics and Communication, SMIT.
  • 31. 4.1.4 - ADDING BLOCKS To create this model, the blocks are copied into the model from the following Simulink block libraries: • Sources library (the Sine Wave block) • Sinks library (the Scope block) • Continuous library (the Integrator block) • Signal Routing library (the Mux block) A Sine Wave block can be copied from the Sources library, using the Library Browser for Windows only To copy the Sine Wave block from the Library Browser, first the Library Browser tree expanded to display the blocks in the Sources library. This is done by clicking the Sources node to display the Sources library blocks. Finally, the Sine Wave block is selected by clicking the Sine Wave node. Here is how the Library Browser should look after this is done. Fig – 4.1.4(a):- Simulink Library Browser Now a copy of the Sine Wave block is dragged from the browser and dropped in the model window. To copy the Sine Wave block from the Sources library window, double- clicking the Sources icon in the Simulink library window opens the Sources window. ____________________________________________________________________ 31 Department of Electronics and Communication, SMIT.
  • 32. On Windows, right clicking on the Simulink node in the Library Browser and then clicking the resulting Open Library button can open the Simulink library window. Simulink displays the Sources library window. . Fig – 4.1.4(b):- Source Library Window Now the Sine Wave block is dragged from the Sources window to the model window. Fig – 4.1.4(c):- Adding Blocks In Model Window The rest of the blocks are copied in a similar manner from their respective libraries into the model window. The user can move a block from one place in the model window to another by dragging the block. The user can move a block a short distance by selecting the block, then pressing the arrow keys. It is noticed that one or both sides of the blocks have angle brackets. The > symbol pointing out of a block is an output port; if the symbol points to a block, it is an input port. Fig – 4.1.4(d):- Input and Output Ports ____________________________________________________________________ 32 Department of Electronics and Communication, SMIT.
  • 33. 4.1.5 - CONFIGURING THE MODEL Now Simulink is set up to run the simulation for 10 seconds. First, choosing Configuration Parameters from the Simulation menu opens the Configuration Parameters dialog box. On the dialog box that appears, the Stop time is set to 10.0, it is the default value. Changing the Stop time as per the user’s choice can change this run time. Fig – 4.1.5(a):- Configuring The Model Clicking the OK button closes the Configuration Parameters dialog box. Simulink applies the parameters and closes the dialog box. 4.1.6 - RUNNING THE MODEL Now by double-clicking on the Scope block its display window is opened. Finally, the Start is chosen from the Simulation menu for running the simulation and then the simulation output can be viewed on the Scope. Fig – 4.1.6(a):- Running The Model ____________________________________________________________________ 33 Department of Electronics and Communication, SMIT.
  • 34. The simulation stops when it reaches the stop time specified in the Configuration Parameters dialog box. The user can also stop the simulation if he or she choose Stop from the Simulation menu or click the Stop button on the model window's toolbar as per their choice. To save this model, Save has to be chosen from the File menu and enter a filename and location. That file contains the description of the model. 4.2 - HOW SIMULINK WORKS? Simulink is a software package that enables the user to model, simulate, and analyze systems whose outputs change over time. Such systems are often referred to as dynamic systems. Simulink can be used to explore the behavior of a wide range of real-world dynamic systems, including the following: • Electrical circuits, • Shock absorbers, • Braking systems, • Many other electrical, mechanical, and thermodynamic systems. Simulating a dynamic system is a two-step process with Simulink. First, a user creates a block diagram, using the Simulink model editor, which graphically depicts time- dependent mathematical relationships among the system's inputs, states, and outputs. The user then commands Simulink to simulate the system represented by the model from a specified start time to a specified stop time. 4.2.1 - MODELING DYNAMIC SYSTEMS A Simulink block diagram model is a graphical representation of a mathematical model of a dynamic system. A mathematical model of a dynamic system is described by a set of equations. The mathematical equations described by a block diagram model are known as algebraic, differential, and/or difference equations. 4.2.2 - CREATING MODELS Simulink provides a graphical editor that allows the user to create and connect instances of block types selected from libraries of block types via a library browser. Simulink ____________________________________________________________________ 34 Department of Electronics and Communication, SMIT.
  • 35. provides libraries of blocks representing elementary systems that can be used as building blocks. The blocks supplied with Simulink are called built-in blocks. Simulink users can also create their own block types and use the Simulink editor to create instances of them in a diagram. User-defined blocks are called custom blocks. 4.2.3 - TIME Time is an inherent component of block diagrams in that the results of a block diagram simulation change with time. Put another way, a block diagram represents the instantaneous behavior of a dynamic system. Determining a system's behavior over time thus entails repeatedly solving the model at intervals, called time steps, from the start of the time span to the end of the time span. Simulink refers to the process of solving a model at successive time steps as simulating the system that the model represents. 4.2.4 - STATES Typically the current values of some system, and hence model, outputs are functions of the previous values of temporal variables. Such variables are called states. Computing a model's outputs from a block diagram hence entails saving the value of states at the current time step for use in computing the outputs at a subsequent time step. Simulink performs this task during simulation for models that define states. Two types of states can occur in a Simulink model: • Discrete states • Continuous states. A continuous state changes continuously. Examples of continuous states are the position and speed of a car. A discrete state is an approximation of a continuous state where the state is updated (recomputed) using finite (periodic or a-periodic) intervals. An example of a discrete state would be the position of a car shown on a digital odometer where it is updated every second as opposed to continuously. In the limit, as the discrete state time interval approaches zero, a discrete state becomes equivalent to a continuous state. The following is a graphical representation of a block that has states: ____________________________________________________________________ 35 Department of Electronics and Communication, SMIT.
  • 36. Fig – 4.2.4(a):- States 4.2.5 - BLOCK PARAMETERS Key properties of many standard blocks are parameterized. For example, the Constant value of the Simulink Constant block is a parameter. Each parameterized block has a block dialog that allows the users to set the values of the parameters. ____________________________________________________________________ 36 Department of Electronics and Communication, SMIT.
  • 37. 5. – GRAPHICAL USER INTERFACE (GUI) ____________________________________________________________________ 37 Department of Electronics and Communication, SMIT.
  • 38. 5.1 - GUI ( GRAPHICAL USER INTERFACE ) GUIDE is a MATLAB Graphical User Interface development environment, which provides a set of tools for creating graphical user interfaces (GUIs). These tools greatly simplify the process of designing and building GUIs. The user can use the GUIDE tools to: • Lay out the GUI Using the GUIDE Layout Editor, the user can lay out a GUI easily by clicking and dragging GUI components — such as panels, buttons, text fields, sliders, menus, and so on — into the layout area. • Program the GUI GUIDE automatically generates an M-file that controls how the GUI operates. The M-file initializes the GUI and contains a framework for all the GUI callbacks — the commands that are executed when a user clicks a GUI component. Using the M-file editor, the user can add code to the callbacks to perform the functions the user want them to. The following sections provide an overview of creating GUIs with GUIDE. 5.2 - STARTING GUIDE To start the GUIDE, guide is entered at the MATLAB prompt. This displays the GUIDE Quick Start dialog, as shown in the following figure. Fig – 5.2(a):- Starting Guide ____________________________________________________________________ 38 Department of Electronics and Communication, SMIT.
  • 39. From the Quick Start dialog, the user can: • Create a new GUI from one of the GUIDE templates — prebuilt GUIs that the user can modify for their own purposes. • Open an existing GUI. Once the user have selected one of these options, by clicking OK, the GUI in the Layout Editor opens. 5.3 - THE LAYOUT EDITOR When a GUI is opened in GUIDE, it is displayed in the Layout Editor, which is the control panel for all of the GUIDE tools. The following figure shows the Layout Editor with a blank GUI template. Fig – 5.3(a):- Layout Editor The user can lay out the GUI by dragging the components, such as push buttons, pop-up menus, or axes, from the component palette, at the left side of the Layout Editor, into the layout area. ____________________________________________________________________ 39 Department of Electronics and Communication, SMIT.
  • 40. For example, if the user drags a push button into the layout area, it appears as in the following figure. Fig – 5.3(b):- Layout Editor 5.4 - GUIDE TEMPLATES The GUIDE Quick Start dialog provides templates for several basic types of GUIs. The advantage of using templates is that often the user can modify a template more quickly and easily than by starting from a blank GUI. When the user selects a template in the Templates pane, a preview of it appears in the right-hand pane. Fig – 5.4(a):- Guide Templates ____________________________________________________________________ 40 Department of Electronics and Communication, SMIT.
  • 41. Clicking OK opens the template in the Layout Editor, as shown in the following figure. Fig – 5.4(b):- Guide Templates To display the names of the GUI components in the component palette, select Preferences from the File menu, check the box next to Show names in component palette, and click OK. Note that the Layout Editor does not display the functioning GUI. 5.5 - RUNNING A GUI To run a GUI, select Run from the Tools menu, or click the run button on the toolbar. This displays the functioning GUI outside the Layout Editor. For example, when the user runs the GUI with Axes and Menu template, it appears as shown in the following figure. Fig – 5.5(a):- Running A GUI ____________________________________________________________________ 41 Department of Electronics and Communication, SMIT.
  • 42. This GUI displays various MATLAB plots. Select a plot from the pop-up menu and click Update. If the user is running the GUI for the first time, the user has to save it first. After it is saved, the GUIDE runs the GUI and opens an M-file for the GUI in the default text editor. 5.6 - GUI FIG-FILES AND M-FILES GUIDE stores a GUI in two files, which are generated the first time the user save or run the GUI: • A FIG-file, with extension .fig, which contains a complete description of the GUI layout and the components of the GUI: push buttons, menus, axes, and so on. • • An M-file, with extension .m, which contains the code that controls the GUI, including the callbacks for its components. These two files correspond to the tasks of laying out and programming the GUI. When the user lay out of the GUI in the Layout Editor, their work is stored in the FIG-file. When the user programs the GUI, their work is stored in the M-file. 5.7 - PROGRAMMING THE GUI M-FILE After laying out the user’s GUI, the user can program the GUI M-file using the M-file Editor. GUIDE automatically generates this file from the user’s layout the first time the user saves or run the GUI. The GUI M-file: • Initializes the GUI. • Contains code to perform tasks before the GUI appears on the screen, such as creating data or graphics. • Contains the callback functions that are executed each time a user clicks a GUI component. Initially, each callback contains just a function definition line. The user then use the M-file editor to add code that makes the component function the way he or she want it to. To open the M-file, the M-file Editor icon on the Layout Editor Toolbar is clicked. The following figure shows the M-file for the GUI with Axes and Menu template. ____________________________________________________________________ 42 Department of Electronics and Communication, SMIT.
  • 43. The user can view the callback for any of the GUI components by clicking the function icon on the toolbar. This displays a list of all the callbacks, as shown in the following figure. Fig – 5.7(b):- Programming The GUI M-files Clicking a callback on the list displays the section of the M-file containing the callback, where the user can edit it. This example shows the callback template for pushbutton1_Callback. Fig – 5.7(c):- Programming The GUI M-files Whatever may be the approach towards designing a specific project that is we can use MATLAB Simulink blockset or Guide to make GUI or just to simply create a .m file, the basics remain the same that is on the background of a GUI figure or Simulink block a basic .m file is functional only the user interfacing changes .Though all are working with the help of m-files the format and the syntax changes according to the approach . ____________________________________________________________________ 43 Department of Electronics and Communication, SMIT.
  • 44. 6.- SELECTION OF TV TUNER CARD ____________________________________________________________________ 44 Department of Electronics and Communication, SMIT.
  • 45. 6.1 - SIMULINK MODEL USED FOR DATA ACQUISITION As we have worked more with data acquisition and image acquisition, so we have focused more light on the topic. According to our aim of Real- Time Multimedia Signal Processing using MATLAB, previously we were trying to study the multimedia card (TI DM642EVM) already provided in the Simulink blockset. For that we were using DM642EVM block, which is the TI C6000 target preference block. Fig – 6.1(a):- DM642EVM These are the DM642EVM Board Support blocks. These blocks must be present on the DM642EVM block Fig – 6.1 (b):- DM642EVM Board Support blocks ____________________________________________________________________ 45 Department of Electronics and Communication, SMIT.
  • 46. We were using it just to know the basics of a standard multimedia card like TI DM642EVM (the price of the Texas Instrument TV Tuner card costs more than $ 1, 50000), after studying it we had planned to get a cheaper card and to modify it with software according to the desired parameters. Moreover the block provided in the simulink could be set to different parameters but we had no acess to the main .m source code due to PROPITORY RIGHTS. And the DM642EVM block was a block as a whole with no inputs or outputs on it. There was even no sub-blocks, from which we could gather some information about the working of the block. After a lot of effort we found out an option that is the “look under mask” option, which provides an acess to the sub-blocks of the main block. But unfortunately the look under mask for DM642EVM provided us with nothing All these took a lot of time. After spending a lot of time that is almost two and half months in this, we decided to change the Tuner card, and we selected the Pinacle TV Tuner card for our project. But unfortunately we could not buy it due to its high price, which was Rs 2800/-. We even could not get hold of the theory of the Pinacle tuner card, which was also not available due to the company’s proprietary rights. Finally we bought the Pixel View TV Tuner card, which was of little low price Rs 1400/-. With lot of effort we got hold of the product specification of the Pixel View tuner card, which was send to us by the company after a humble request to do so. After studying the specifications we tried to build up a model for data acquisition and display in the MATLAB itself. This model could access the videos, which were inbuilt in MATLAB. We had add audio from microphone and inserted according to our choice. After running this we could view the video, which we have selected from the inbuilt videos in MATLAB along with the text we had inserted and at the same time could receive the audio recorded and inserted by us. The apparent problem with this model was that there was no proper video streaming and so there was lag between the video and the audio. MATLAB “winvideo” video adapter by default selects the composite source in RGB format. RGB format was not a problem, but the composite source selection became a big problem. According to it when we are getting the source from camera it is in composite ____________________________________________________________________ 46 Department of Electronics and Communication, SMIT.
  • 47. mode and the winvideo adapter in MATLAB also selects the composite mode and we get an output that is the preview of a real-time video captured by the camera as a result. But when we were trying to get the real-time output from the TV antenna, we could not get an output because the antenna input source is in tuner mode, and winvideo adapter by default selects the composite mode. So we have to change the source code (m-file) of the image acquisition blockset of simulink. But unfortunately the source m-file of the block was in .dll format so was inaccessible to us, so ultimately at the cost of time and effort we had to switch over to simple m-file programming. Thus Simulink could not be used for viewing the TV channels in MATLAB. So we decided to develop program in MATLAB itself for that purpose. The tuner card is set to the tuner video mode, while the winvideo adapter in MATLAB is set to the composite video mode by default. Since we are working on both on-line and off-line, so we have to take the data from the TV as well as from the digital camera. For this purpose we have to access both the Tuner card and the camera. And for accessing the tuner card the default video mode of the MATLAB had to be changed. With lot of efforts we have developed a program with which we could access the tuner card as well as the camera. This program is developed in such a way that when it’s debugged and run, it can change the default video mode of MATLAB that is the “composite video” into the “tuner” mode, as per the choice. By doing so we could view the TV channels in MATLAB, and we even received the audio signals of the TV channel. ____________________________________________________________________ 47 Department of Electronics and Communication, SMIT.
  • 48. 6.2 – JUSTIFICATION We could not use TI due to the following major reasons: 1. it takes at least six months to order and get the card in hand. 2. It is too costly i.e., it is in $1, 8000, so we could not afford it. Reasons for using PIXEL VIEW card are: 1. it is almost the same like TI card, the only difference is in quality of output. 2. There is no TV-out for further broadcasting like TI. This can be used for future programming, but at this stage we do not need it. 3. There are many extra features in TI, which we can use while using the card for viewing and broadcasting, but they are not so important as the requirement for our program. 4. The PIXEL VIEW card is readily available. 5. it is very cheap in comparison to TI card, it cost only Rs-1400/-. ____________________________________________________________________ 48 Department of Electronics and Communication, SMIT.
  • 49. 7.– PROGRAMMES ____________________________________________________________________ 49 Department of Electronics and Communication, SMIT.
  • 50. 7.1 – VIDEO ACQUISITION PROGRAMME vidobj = videoinput(“winvideo”) sources = vidobj.source whos sources set(vidobj,’selectedsourcename’,’tuner’) sources = vidobj.source get(vidobj) src = getselectedsource(vidobj) get(src) framesPerTriggerValue = get((vidobj),’FramesPerTrigger’) brightnessValue = get(src,’Brightness’) set(vidobj) set(src) set(src,’Contrast’,9000) set(src,’Brightness’,5000) set(src,’Saturation’,3000) set(src,’Hue’,3000) get(src) start(vidobj) preview(vidobj) delete(vidobj) Here we make a video object i.e. “vidobj” and then access the properties of the video object i.e. colors, brightness, hue, etc and also the properties of the video source. Not only we access them but also we can modify them. By default the source selects the composite mode, out of the three possible modes, which are: 1. S-Video mode. 2. Tuber mode. ____________________________________________________________________ 50 Department of Electronics and Communication, SMIT.
  • 51. 3. Composite mode. Now in the line “set(vidobj,’selectedsourcename’,’tuner’)” we select the tuner source so the problem is solved i.e. if we keep this line we can access TV and if we omit this line we can access camera. This program also had some problems, which are: 1. Though it cost a lot of time and effort it seems too simple. 2. It is not user friendly. 3. A puzzle to a lay man. So, ultimately we switched over to GUIDE tool of MATLAB to build a user friendly and sophisticated looking GUI. We faced a lot of problems in there to. Though the basic image acquisition concept remains the same, the basic m-file writing format and syntax changes drastically from command window m-file to Simulink model to a GUI. But finally with lots of efforts we developed a program for building a GUI. 7.2 - PROGRAMME FOR BUILDING GUI function varargout = cameracompositeandtvtuner(varargin) % cameracompositeandtvtuner - launch a GUI to control image acquisition session: % The GUI helps in: % craeting the video object, % previewing and snap shotting, % controlling frame grabber parameters, % The video object constructor is: videoinput('winvideo', 1, format) - % session begins with pressing the 'VideoInput' pushbutton to create the video object. % % The application sends its messages to the MATLAB environment. % user should keep the MATLAB environment visible. % % Quick start: % 1. Press VideoInput (wait untill the label changes to: 'Delete VideoInput'). % 2. Press Preview (user should see the video stream from the camera or tv % the label changes to: 'Close Preview'). % 3. Press FramesAcquired (=0), FramesAvailable (=0), IsRunning (No), IsLogging (No) - ____________________________________________________________________ 51 Department of Electronics and Communication, SMIT.
  • 52. % all answers appear in the Matlab environment. % 4. Press START (the acquisition begins with default parameters: FramesPerTrigger=10 etc...). % 5. Press FramesAcquired (=10), FramesAvailable(=10). % 6. Press GetData (to get the acquired data from the video object). % 7. Press Save ( a dialog box appears suggesting a file-name composed from the Test name and % the time yyyymmdd_HHMMSS). % 8. Press ImageDisplay (it should load another independent GUI to view what user created in VideoControl). % % Image Acquisition: % Editing the fields: FrameGrabInterval (take a frame every X frames), % FramesPerTrigger, TriggerRepeat (the system expects 1+TriggerRepeat triggers after START), % TriggerFrameDelay (number of frames to skip after trigger). % Note: When video object is created it always has the defaults values, % regardless of what is written in the edit fields. % Video Source: % From this pannel user can control Brightness, Contrast and % resolution . % Function: % START - make the video object running (ready for logging upon % trigger) % Trigger - useful at manual trigger only, begins logging. % STOP - stop the video object from running. % GetData - brings acquired data from video object to the MATLAB % environment. user can not save data unless he pressed it before! % Save - save the acquired data to a file. user can change the % suggested file name as user like. % ImageDisplay - launch an independent GUI to display images of the % unique structure preduced by CAMERACOMPOSITEANDTVTUNER. % Trigger: % Immediate - begin logging immediately after user press's START. % Manual - begin logging after user press's TRIGGER. % % Logging: % LoggingMode - 'memory' (producing data structure that will be saved by SAVE), % 'disk&memory' (creating also an avi file) or 'disk'. % % MENU: % On the menu bar user has 'Trigger' and 'Info' to display the status % of the video object, video source and trigger info. If user's window % is docked into the MATLAB window, the menus will join the MATLAB % menu bar on top of the window. % gui_Singleton = 1; ____________________________________________________________________ 52 Department of Electronics and Communication, SMIT.
  • 53. gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @cameracompositeandtvtuner_OpeningFcn, ... 'gui_OutputFcn', @cameracompositeandtvtuner_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before cameracompositeandtvtuner is made visible. function cameracompositeandtvtuner_OpeningFcn(hObject, eventdata, handles, varargin) %avidobj = videoinput('winvideo') %sources = avidobj.source %whos sources %set(avidobj,'selectedsourcename','tuner') %sources = avidobj.source % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to cameracompositeandtvtuner (see VARARGIN) % Choose default command line output for cameracompositeandtvtuner handles.output = hObject; % my global definitions: handles.data = []; handles.aviobj =[]; imaqreset % Update handles structure guidata(hObject, handles); % UIWAIT makes cameracompositeandtvtuner wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = cameracompositeandtvtuner_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % -------------------------------------------------------------------- ____________________________________________________________________ 53 Department of Electronics and Communication, SMIT.
  • 54. function miFramesPerTrigger_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; fpt = num2str(get(handles.vid, 'FramesPerTrigger')); disp([' Frames per trigger: ', fpt]); return % -------------------------------------------------------------------- function miTriggerType_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; t = get(handles.vid, 'TriggerType'); disp([' Trigger type: ', t]); return % -------------------------------------------------------------------- function miTriggerCondition_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; tc = get(handles.vid, 'TriggerCondition'); disp([' Trigger condition: ', tc]); return % -------------------------------------------------------------------- function miTriggerSource_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; ts = get(handles.vid, 'TriggerSource'); disp([' Trigger source: ', ts]); return % -------------------------------------------------------------------- function menuTrigger_Callback(hObject, eventdata, handles) % --- Executes on button press in pbVideoInput. function pbVideoInput_Callback(hObject, eventdata, handles) if get(hObject, 'userdata') == 0, % video is closed imaqreset; handles.vid = videoinput('winvideo'); set((handles.vid),'selectedsourcename','tuner'); handles.source = getselectedsource(handles.vid); set(hObject, 'string', 'Delete VideoInput'); set(hObject, 'userdata', 1); guidata(hObject, handles); return else delete(handles.vid); clear handles.vid; set(hObject, 'string', 'VideoInput'); set(hObject, 'userdata', 0); set(handles.pbPreview, 'userdata', 0, 'string', 'Preview'); %set(handles.pbCreateSource, 'userdata', 0, 'string', 'CreateSource'); guidata(hObject, handles); return end % --- Executes on button press in pbPreview. function pbPreview_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if get(hObject, 'userdata') == 0, %preview is OFF ____________________________________________________________________ 54 Department of Electronics and Communication, SMIT.
  • 55. preview(handles.vid); set(hObject, 'string', 'ClosePreview'); set(hObject, 'userdata', 1.0); guidata(hObject, handles); return else closepreview(handles.vid); set(hObject, 'string', 'Preview'); set(hObject, 'userdata', 0.0); guidata(hObject, handles); return end % --- Executes during object creation, after setting all properties. function figure1_CreateFcn(hObject, eventdata, handles) handles.vid = []; handles.source = []; guidata(hObject, handles); return % --- Executes on slider movement. function slBrightness_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; b = round(get(hObject, 'value')); set(handles.source, 'Brightness', b); set(handles.edBrightness, 'string', num2str(b)); return % --- Executes during object creation, after setting all properties. function slBrightness_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes upon editing. function edBrightness_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; b = round(str2num(get(hObject, 'string'))); set(handles.slBrightness, 'value', b); set(handles.src, 'Brightness', b); return % --- Executes during object creation, after setting all properties. function edBrightness_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else ____________________________________________________________________ 55 Department of Electronics and Communication, SMIT.
  • 56. set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % -------------------------------------------------------------------- function miGetSelectedSource_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; get(handles.source) return % -------------------------------------------------------------------- function menuInfo_Callback(hObject, eventdata, handles) function edContrast_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; c = round(str2num(get(hObject, 'string'))); set(handles.slContrast, 'value', c); set(handles.src, 'Contrast', c); return % --- Executes during object creation, after setting all properties. function edContrast_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on slider movement. function slContrast_Callback(hObject, eventdata, handles) % hObject handle to slContrast (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider if get(handles.pbVideoInput, 'userdata') == 0, return, end; c = round(get(hObject, 'value')); set(handles.source, 'Contrast', c); set(handles.edContrast, 'string', num2str(c)); return % --- Executes during object creation, after setting all properties. function slContrast_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else ____________________________________________________________________ 56 Department of Electronics and Communication, SMIT.
  • 57. set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on selection change in ppTriggerConfig. function ppTriggerConfig_Callback(hObject, eventdata, handles) % hObject handle to ppTriggerConfig (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns ppTriggerConfig contents as cell array % contents{get(hObject,'Value')} returns selected item from ppTriggerConfig if get(handles.pbVideoInput, 'userdata') == 0, return, end; selection = get(hObject, 'value'); config = triggerinfo(handles.vid); triggerconfig(handles.vid, config(selection)); % --- Executes during object creation, after setting all properties. function ppTriggerConfig_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on button press in pbFramesAcquired. function pbFramesAcquired_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; frames = get(handles.vid, 'FramesAcquired'); s = sprintf('%s%gn', 'Frames acquired: ', frames); disp(s); % -------------------------------------------------------------------- function miGetVideoInput_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; get(handles.vid) return function edFrameGrabInterval_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'FrameGrabInterval', str2num(get(hObject, 'string'))); guidata(hObject, handles); return % --- Executes during object creation, after setting all properties. function edFrameGrabInterval_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else ____________________________________________________________________ 57 Department of Electronics and Communication, SMIT.
  • 58. set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end function edFramesPerTrigger_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'FramesPerTrigger', str2num(get(hObject, 'string'))); guidata(hObject, handles); return % --- Executes during object creation, after setting all properties. function edFramesPerTrigger_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end function edTriggerRepeat_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'TriggerRepeat', str2num(get(hObject, 'string'))); guidata(hObject, handles); return % --- Executes during object creation, after setting all properties. function edTriggerRepeat_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on button press in pbDefaultsAcquisition. function pbDefaultsAcquisition_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.edFrameGrabInterval, 'string', '1'); set(handles.vid, 'FrameGrabInterval', 1); set(handles.edFramesPerTrigger, 'string', '10'); set(handles.vid, 'FramesPerTrigger', 10); set(handles.edTriggerRepeat, 'string', '0'); set(handles.vid, 'TriggerRepeat', 0); set(handles.edTriggerFrameDelay, 'string', '0'); set(handles.vid, 'TriggerFrameDelay', 0); guidata(hObject, handles); return function edTriggerFrameDelay_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'TriggerFrameDelay', str2num(get(hObject, 'string'))); guidata(hObject, handles); return ____________________________________________________________________ 58 Department of Electronics and Communication, SMIT.
  • 59. % --- Executes during object creation, after setting all properties. function edTriggerFrameDelay_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on button press in pbSnapshot. function pbGetSnapshot_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; % video object absent if get(hObject, 'userdata') == 0, set(hObject, 'userdata', 1.0); s = getsnapshot(handles.vid); figure(1); imshow(s); set(hObject, 'userdata', 0.0); guidata(hObject, handles); return else return end return % --- Executes on button press in pbFramesAvailable. function pbFramesAvailable_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; frames = get(handles.vid, 'FramesAvailable'); s = sprintf('%s%gn', 'Frames available: ', frames); disp(s); return % --- Executes on button press in pbStart. function pbStart_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if isrunning(handles.vid), return, end; start(handles.vid); return % --- Executes on button press in pbTrigger. function pbTrigger_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if ~strcmp(get(handles.vid, 'TriggerType'), 'manual'), return, end; if ~isrunning(handles.vid), return, end; if islogging(handles.vid), return, end; trigger(handles.vid); return % --- Executes on button press in pbStop. function pbStop_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if ~isrunning(handles.vid), return, end; ____________________________________________________________________ 59 Department of Electronics and Communication, SMIT.
  • 60. stop(handles.vid); return % % --- Executes on button press in pbImaqMontage. % function pbImaqMontage_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % % figure(2);% TO DO:: use the correct data structure to display... % % imaqmontage(handles.data); % return % --- Executes on button press in pbFlushData. function pbFlushData_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; flushdata(handles.vid); return % --- Executes on button press in pbImageDisplay. function pbImageDisplay_Callback(hObject, eventdata, handles) ImageDisplay return % --- Executes on button press in pbGetData. function pbGetData_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if get(handles.vid, 'FramesAvailable') == 0, return, end; if get(handles.vid, 'TriggersExecuted') < 1, return, end; handles.data = []; T = get(handles.vid, 'TriggersExecuted'); for t=1:T, [handles.data{t}.frames, handles.data{t}.time, handles.data{t}.metadata] = getdata(handles.vid); end guidata(hObject, handles); return % --- Executes on button press in pbSave. function pbSave_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if isempty(handles.data), return, end; tx = get(handles.edTransducerID, 'string'); d=handles.data; c = fix(clock); filename=sprintf('%s_%4d-%02d-%02d_%02d%02d%02d%s', tx, c(1), c(2), c(3), c(4), c(5), c(6), '.mat'); prompt={'Enter file name:'}; name='Save current data to a file'; numlines=1; defaultanswer= {filename}; filename2=''; filename2=inputdlg(prompt,name,numlines,defaultanswer); if isempty(filename2), return, end; save(filename2{1}, 'd'); return ____________________________________________________________________ 60 Department of Electronics and Communication, SMIT.
  • 61. % --- Executes on editing. function edROIx_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % a = get(handles.vid, 'ROI'); % new = str2num(get(hObject, 'string')); % set(handles.vid, 'ROI', [new a(2) a(3) a(4)]); return; % --- Executes during object creation, after setting all properties. function edROIx_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on editing. function edROIy_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % a = get(handles.vid, 'ROI'); % new = str2num(get(hObject, 'string')); % set(handles.vid, 'ROI', [a(1) new a(3) a(4)]); return; % --- Executes during object creation, after setting all properties. function edROIy_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on editing. function edROIwidth_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % a = get(handles.vid, 'ROI'); % new = str2num(get(hObject, 'string')); % set(handles.vid, 'ROI', [a(1) a(2) new a(4)]); return; % --- Executes during object creation, after setting all properties. function edROIwidth_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end ____________________________________________________________________ 61 Department of Electronics and Communication, SMIT.
  • 62. % --- Executes on editing. function edROIheight_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edROIheight_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on button press in pbROIdefaults. function pbROIdefaults_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; a = get(handles.vid, 'videoresolution'); x = 0; y = 0; set(handles.vid, 'ROI', [x y a(1) a(2)]); set(handles.edROIx, 'string', num2str(x)); set(handles.edROIy, 'string', num2str(y)); set(handles.edROIwidth, 'string', num2str(a(1))); set(handles.edROIheight, 'string', num2str(a(2))); guidata(hObject, handles); return % --- Executes on button press in pbROIupdate. function pbROIupdate_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; a = zeros(1,4); a(1) = str2num(get(handles.edROIx, 'string')); a(2) = str2num(get(handles.edROIy, 'string')); a(3) = str2num(get(handles.edROIwidth, 'string')); a(4) = str2num(get(handles.edROIheight, 'string')); set(handles.vid, 'ROI', a); guidata(hObject, handles); return % --- Executes on editing. function edTransducerID_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edTransducerID_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on button press in pbIsRunning. function pbIsRunning_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; s = isrunning(handles.vid); ____________________________________________________________________ 62 Department of Electronics and Communication, SMIT.
  • 63. switch s case 0 disp(' Video object is NOT running'); case 1 disp(' Video object is running'); end return % --- Executes on button press in pbIsLogging. function pbIsLogging_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; s = islogging(handles.vid); switch s case 0 disp(' Video object is NOT logging'); case 1 disp(' Video object is logging'); end return % --- Executes on selection change in ppLoggingMode. function ppLoggingMode_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; index = get(hObject, 'value'); str = get(hObject, 'string'); sLoggingMode = str{index}; set(handles.vid, 'LoggingMode', sLoggingMode); guidata(hObject, handles); return % --- Executes on creation. function ppLoggingMode_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on editing. function edFps_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edFps_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')) ; end % --- Executes on button press in pushbutton25. function pushbutton25_Callback(hObject, eventdata, handles) close(gcf) % hObject handle to pushbutton25 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ____________________________________________________________________ 63 Department of Electronics and Communication, SMIT.
  • 64. With the help of this program we have created a GUI for the video files from both the TV and the camera. GUIDE tool used for creating GUI is set to composite mode by default. By this program we change the composite mode to tuner mode. Department of Electronics and Communication, SMIT 7.3 - AUDIO ACQUISITION BLOCK Digitized MIC Sound card ADC Audio Work space Software control Audio Wave MATLAB AUDIO MUX VIDEO T S A/V DEVICE Fig – 7.3(a) Audio Acquisition Block The audio input from a microphone is feed into the sound card, which is an analog to digital converter. The output is a digitized audio. This digitized audio is then saved in MATLAB workspace, where it is converted into audio wave. The sound card does not access both the video and audio simultaneously. It accesses them separately with a faction of time interval in between, which we cannot notice. So the video and audio are merged together in a multiplexer, which together forms a transport stream, which in the audio video output (A/V). This A/V then goes to the display device. ____________________________________________________________________ 64 Department of Electronics and Communication, SMIT.
  • 65. 7.4 - SIMULILNK MODEL FOR AUDIO ACQUISITION Fig – 7.4(a):- Simulink Based Audio Acquisition Block For audio acquisition we have designed the above model. The model consists of a audio input block which takes audio inputs, a audio output block for producing audio output and a “to web file” block which records and saves the audio data as a web file i.e. audio file. The audio data taken from the audio input device goes to the audio output device form where we can be heard and then to a “web file” block where it is recorded and saved as a web file. The model can be modified by changing the parameters the blocks. The parameters which can be changed are: Audio input block parameters are:- Sample rate(Hz), Sample width(bits), Samples per frame, Queue(seconds), Audio device, Data type. Audio output block parameters are:- Queue duration(seconds), Initial output delay (seconds) and Audio device. To web file block parameters are:- File name, Sample width(bits) and Minimum number of samples for each write to file. ____________________________________________________________________ 65 Department of Electronics and Communication, SMIT.
  • 66. 8. - TV TUNER CARD ____________________________________________________________________ 66 Department of Electronics and Communication, SMIT.
  • 67. 8.1 - THEORITICAL STUDY The TV tuner card works on the basis of the following block diagram. The input data’s are converted from analog to digital by the AD/C block, then they are multiplexed. This data is then processed by the DSP and again converted back to analog by the DA/C block and feed into the TV. And the digital data from the DSP block is also feed into the computer monitor. ANALOG TO DATA DIGITAL INPUT 1 CONVERTER (ADC ) - 1 DIGITAL MULTIPLEXER SIGNAL PROCESSOR MONITOR ( MUX ) ( DSP ) DATA INPUT 2 ANALOG TO DIGITAL CONVERTER (ADC ) - 2 DIGITAL TO ANALOG CONVERTER (DA/C) TV Fig – 8.1(a):- TV Tuner Block Diagram A TV tuner card is a computer component that allows television signals to be received by a computer. Most TV tuners also function as video capture cards, allowing them to record television programs onto a hard disk. Fig – 8.1(b):- TV Tuner Card While typically a PCI-bus expansion card, they can also be a USB device. The card contains a receiver, tuner, demodulator, and a analog-to-digital converter for analog ____________________________________________________________________ 67 Department of Electronics and Communication, SMIT.
  • 68. TV and DSP. Like TV sets, each version is designed for the radio frequencies and video formats used in each country. Many newer TV tuners have Flash memory big enough to hold the firmware for decoding several different video formats, making it possible to use the tuner in many countries without having to flash the firmware. In addition to the frequency tuner, many include a composite video input. Many TV tuners can function as FM radios: this is because the FM radio spectrum lies between television channels 6 and 7, and the DSP can be easily programmed to decode FM. Some provide DVB reception for digital radio, television or data signals (either with or without hardware MPEG decoding capability); these may be used to receive satellite broadcasts but normally provide no analogue input capability. Most internal tuners do all the low level demodulation needed to convert a radio signal into an on-screen image using a hardware DSP chip or ASIC; some also have hardware MPEG decoders and use DMA to bypass the CPU entirely. Some cheaper tuners don't do much of the onboard signal processing and rely on the system's CPU for that task. External tuners may convert the signal into either a video stream suitable for display on the screen, or to an intermediate format such as MPEG; in either case, the CPU is needed to direct the image onto the screen. 8.2 – PXELVIEW TV TUNER CARD: We are using the Pixel View TV Tuner card with the chip Bt-787 , having the model no. TCL2002MB-33F. Fig-8.2(a):-PIXEL VIEW TV Tuner card ____________________________________________________________________ 68 Department of Electronics and Communication, SMIT.
  • 69. 8.2.1 – PIXEL VIEW CARD SPECIFICATIONS This card has the following specifications: MODEL :- TCL2002MB-33F NAME :- Multimedia tuner System PAL B/G D/K&FM 1. SCOPE :- This specification applies multimedia tuner: TCL2002MB-33F. 2.TYPE 2.1 Channel coverage: VHF Low band: 48.25 to 170.00MHz VHF High band: 170.00 to 450.00MHz UHF band: 450.00 to 863.25MHz FM band: 87.00 to 108.00MHz 2.2 Receiving system: PAL B/G D/K&FM 2.3 Intermediate frequency: Picture carrier: 38.9MHz Color carrier: 34.47MHz Sound 1: 33.4MHz Sound 2: 32.4MHz FM : 10.7MHz 2.4 Antenna Input Impedance: Unbalanced 75Ohms 2.5 Output Impedance: Unbalanced 75Ohms 2.6 Band Change-over system: Digital change by PLL IC A DC-DC converter is built tuner section to provide the tuning voltage, thus making only 5V device. ____________________________________________________________________ 69 Department of Electronics and Communication, SMIT.
  • 70. 3 - PIN DESCRIPTION 4 - RATING AND TEST CONDITION 4.1. Standard Voltage and Current: VCC(BTU): 5V±0.1V 75mA±10mA VCC(BIF): 5V±0.1V 90mA±15mA 4.2 Operating Voltage: VCC: 5V±5%DC 4.3 Operating Temperature: -10℃ to +60℃ 4.4 Storage Temperature: -20℃ to +60℃ 4.5 Standard Test condition: Ambient Temperature: 15℃ to 25℃ Humidity: 45 to 70%RH ____________________________________________________________________ 70 Department of Electronics and Communication, SMIT.
  • 71. 4.6 - I2C Chart Table1 I2C -bus data format 4.8 - Table 3 Address selection 4.9 - Table 4 Test bits 4.10 - Table 5 Ratio select bits ____________________________________________________________________ 71 Department of Electronics and Communication, SMIT.
  • 72. 4.11 - Table 6 Ports byte 5 - GENERAL CHARACTERISTICS (Tuner section) ____________________________________________________________________ 72 Department of Electronics and Communication, SMIT.
  • 73. 8.2.2.- CONNECTION DIAGRAM Fig – 8.2.2(a):-Connection Diagram FRONT VIEW OF THE PIXEL VIEW TV TUNER CARD Fig – 8.2.2(b):-Connection Diagram ____________________________________________________________________ 73 Department of Electronics and Communication, SMIT.