MAJOR PROJECT REPORT ON       REAL -TIME MULTIMEDIA SIGNAL            PROCESSING USING MATLAB                             ...
SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY  (A constituent college of Sikkim Manipal University of Health Medical and         ...
SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY  (A constituent college of Sikkim Manipal University of Health Medical and         ...
ACKNOWLEDGEMENTAt the outset we would like to convey our sincere thanks to all the faculties and supportstaff of Applied P...
ABSTRACTThe aim of our major project is Real-Time Multimedia Signal Processing UsingMATLAB using a comparatively cheaper c...
TABLE OF CONTENTS          TOPIC                                                                       PAGE NO.   CHAPTER ...
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: SIM...
CHAPTER 7: PROGRAMMES……………………………………………..49.   7.1 Video Acquisition Program….………………………………………..50.   7.2 Program for Buildi...
1.-LIST OF TABLES                  AND FIGURES____________________________________________________________________   9Depa...
1.1 - LIST OF TABLES      TOPIC                                              PAGE NO.   1.1.1 Table - 3 :-TV Tuner Card PI...
FIG1.2 - LIST OF FIGURES                  TOPICS                                           PAGE NO.           1.2.1 Fig - ...
1.2.29 Fig - 8.1(b):-TV Tuner Card………….……………………..…67.            1.2.30 Fig - 8.2.(a):- PIXEL VIEW TV Tuner Card…………….…......
2. - INTRODUCTION____________________________________________________________________   13Department of Electronics and Co...
2.1 - WHY WE ARE INTERESTED IN THIS PROJECT ?Latest multimedia development is interested in implementing the concept of mo...
Fig – 2.2.2(a) Mobile TV2.2.3 - COMPANIES ENGAGEDRenowned companies worldwide are engaged in the development of Mobile TV....
Handheld (DVB-H) front-end solution, BGT216, which is predicted to have 15 millionconsumer users by 2009, up from only 1.2...
Italian mobile telecommunications service provider, Hutchison 3 Italia, expects tobroadcast the FIFA World Cup games to mo...
3. – MATLAB____________________________________________________________________   18Department of Electronics and Communic...
3.1 - WHY WE ARE USING MATLAB?MATLAB is a high-speed computation program. It is an interactive system whose basicdata elem...
•   It integrates computation, visualization, and programming in an easy-to-use        environment where problems and solu...
to import your data into MATLAB is with the load command.3.2.1 – MATLAB USESTypical uses of Matlab include:•      Math and...
This is a vast collection of computational algorithms ranging from elementary functions,like sum, sine, cosine, and comple...
3.2.5 - DESKTOP OVERVIEWDesktop tools are used to manage the work in MATLAB. The user can also useMATLAB functions to perf...
3.2.7 - COMMAND WINDOWThe Command Window is used to enter variables and to run functions and M-file scripts.              ...
3.2.9 - DEMOS AVAILABLE WITH MATLABMATLAB comes with a wide array of visual demonstrations to help the user to see theexte...
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 ...
4. - SIMULINK____________________________________________________________________   27Department of Electronics and Commun...
Simulink is a block library tool for modeling, simulating and analyzing dynamicsystems. It is developed by The MathWorks a...
4.1.2 - TOOL FOR MODEL-BASED DESIGNFor modeling, Simulink provides a graphical user interface (GUI) for building models as...
Fig – 4.1.3(a):- Creating An Empty ModelTo create a new model on Windows, the New Model button on the Library Browserstool...
4.1.4 - ADDING BLOCKSTo create this model, the blocks are copied into the model from the following Simulinkblock libraries...
On Windows, right clicking on the Simulink node in the Library Browser and thenclicking the resulting Open Library button ...
4.1.5 - CONFIGURING THE MODELNow Simulink is set up to run the simulation for 10 seconds. First, choosingConfiguration Par...
The simulation stops when it reaches the stop time specified in the ConfigurationParameters dialog box. The user can also ...
provides libraries of blocks representing elementary systems that can be used as buildingblocks. The blocks supplied with ...
Fig – 4.2.4(a):- States4.2.5 - BLOCK PARAMETERSKey properties of many standard blocks are parameterized. For example, the ...
5. – GRAPHICAL USER         INTERFACE (GUI)____________________________________________________________________   37Depart...
5.1 - GUI ( GRAPHICAL USER INTERFACE )GUIDE is a MATLAB Graphical User Interface development environment, whichprovides a ...
From the Quick Start dialog, the user can:• Create a new GUI from one of the GUIDE templates — prebuilt GUIs that the user...
For example, if the user drags a push button into the layout area, it appears as in thefollowing figure.                  ...
Clicking OK opens the template in the Layout Editor, as shown in the following figure.                            Fig – 5....
This GUI displays various MATLAB plots. Select a plot from the pop-up menu and clickUpdate. If the user is running the GUI...
The user can view the callback for any of the GUI components by clicking the functionicon      on the toolbar. This displa...
6.- SELECTION OF TV                TUNER CARD____________________________________________________________________   44Depa...
6.1 - SIMULINK MODEL USED FOR DATA ACQUISITIONAs we have worked more with data acquisition and image acquisition, so we ha...
We were using it just to know the basics of a standard multimedia card like TIDM642EVM (the price of the Texas Instrument ...
mode and the winvideo adapter in MATLAB also selects the composite mode and we getan output that is the preview of a real-...
6.2 – JUSTIFICATIONWe could not use TI due to the following major reasons:   1.      it takes at least six months to order...
7.– PROGRAMMES____________________________________________________________________   49Department of Electronics and Commu...
7.1 – VIDEO ACQUISITION PROGRAMMEvidobj = videoinput(“winvideo”)sources = vidobj.sourcewhos sourcesset(vidobj,’selectedsou...
3. Composite mode.Now in the line “set(vidobj,’selectedsourcename’,’tuner’)” we select the tuner source sothe problem is s...
%              all answers appear in the Matlab environment.%         4. Press START (the acquisition begins with default ...
gui_State = struct(gui_Name,       mfilename, ...    gui_Singleton, gui_Singleton, ...    gui_OpeningFcn, @cameracomposite...
function miFramesPerTrigger_Callback(hObject, eventdata, handles)if get(handles.pbVideoInput, userdata) == 0, return, end;...
preview(handles.vid);     set(hObject, string, ClosePreview);     set(hObject, userdata, 1.0);     guidata(hObject, handle...
set(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor));end% -------------------------------------------------...
set(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor));end% --- Executes on selection change in ppTriggerConf...
set(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor));endfunction edFramesPerTrigger_Callback(hObject, event...
% --- Executes during object creation, after setting all properties.function edTriggerFrameDelay_CreateFcn(hObject, eventd...
stop(handles.vid);return%   % --- Executes on button press in pbImaqMontage.%   function pbImaqMontage_Callback(hObject, e...
% --- Executes on editing.function edROIx_Callback(hObject, eventdata, handles)% if get(handles.pbVideoInput, userdata) ==...
% --- Executes on editing.function edROIheight_Callback(hObject, eventdata, handles)% --- Executes during object creation,...
switch s    case 0         disp( Video object is NOT running);    case 1         disp( Video object is running);endreturn%...
With the help of this program we have created a GUI for the video files from both the TVand the camera. GUIDE tool used fo...
7.4 - SIMULILNK MODEL FOR AUDIO ACQUISITION                Fig – 7.4(a):- Simulink Based Audio Acquisition BlockFor audio ...
8. - TV TUNER CARD____________________________________________________________________   66Department of Electronics and C...
8.1 - THEORITICAL STUDYThe TV tuner card works on the basis of the following block diagram. The input data’sare converted ...
TV and DSP. Like TV sets, each version is designed for the radio frequencies and videoformats used in each country. Many n...
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
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
Upcoming SlideShare
Loading in …5
×

Real time multimedia-signal_proccesing_using_matlab

3,878 views
3,739 views

Published on

8th sem, Major project, engineering

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
  • could u plz forward me codes report at suryankbabu@gmail.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
3,878
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

Real time multimedia-signal_proccesing_using_matlab

  1. 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____________________________________________________________________ 1Department of Electronics and Communication, SMIT.
  2. 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-TIMEMULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department ofApplied Physics, University of Calcutta, in partial fulfillment of the requirement for theaward of Bachelor Of Technology in Electronics and Communication Engineering ofSIKKIM MANIPAL UNIVERSITY OF HEALTH MEDICAL ANDTECHNOLOGICAL 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.____________________________________________________________________ 2Department of Electronics and Communication, SMIT.
  3. 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-TIMEMULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department ofApplied Physics, University of Calcutta, in partial fulfillment of the requirement for theaward of Bachelor Of Technology in Electronics and Communication Engineering ofSIKKIM MANIPAL UNIVERSITY OF HEALTH MEDICAL ANDTECHNOLOGICAL 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.____________________________________________________________________ 3Department of Electronics and Communication, SMIT.
  4. 4. ACKNOWLEDGEMENTAt the outset we would like to convey our sincere thanks to all the faculties and supportstaff of Applied Physics Department, University of Calcutta, for providing us theopportunity to carry out our 8th semester major project of B.Tech degree in Electronicsand 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 anopportunity to carry out a major project on this emerging subject and encouraging andmotivating us at every stage with valuable inputs which made it possible for us to besuccessful 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 valuableinputs from time to time, indispensable support and proper guidance at every stage forcompleting our project work on “Real – Time Multimedia Signal Processing UsingMATLAB”. Without his support and encouragement it was impossible to complete theproject.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 AppliedPhysics) 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 KumarDebnath for assisting us in our day-to-day activities.__________________________ ___________________________Angshuman Ghosh (Reg.no. 200212080) Aritri Debnath (Reg. no. 200212113)____________________________________________________________________ 4Department of Electronics and Communication, SMIT.
  5. 5. ABSTRACTThe aim of our major project is Real-Time Multimedia Signal Processing UsingMATLAB using a comparatively cheaper card in contrast to expensive cards like TIDM642EVM. The project on completion will process the multi-media files like the videoand audio from the TV as well as from the digital camera and these can be viewed on thecomputer. 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 thecomposite mode. The online approach where the data are acquired from the TV works inthe tuner video mode.While the offline approach where the data’s are acquired from a digital camera works inthe composite video mode. These two modes can be turned on and off by the program wehave developed in MATLAB.For acquiring data’s from the TV & Camera we have chosen a TV tuner card, which isthe PIXEL VIEW TV Tuner card having the model no. TCL2002MB-33F. The reason forchoosing the TV Tuner card as the video card is that the TV Tuner card has a widebandwidth of 815MHz. And the digital camera we have chosen is OLYMPUSCAMEDIA C- 750.We have used MATLAB 7.1 for the simulation purpose, as it is a high-speed computationprogram, which performs various kinds of operations in much less time.____________________________________________________________________ 5Department of Electronics and Communication, SMIT.
  6. 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.____________________________________________________________________ 6Department of Electronics and Communication, SMIT.
  7. 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.____________________________________________________________________ 7Department of Electronics and Communication, SMIT.
  8. 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.____________________________________________________________________ 8Department of Electronics and Communication, SMIT.
  9. 9. 1.-LIST OF TABLES AND FIGURES____________________________________________________________________ 9Department of Electronics and Communication, SMIT.
  10. 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.____________________________________________________________________ 10Department of Electronics and Communication, SMIT.
  11. 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.____________________________________________________________________ 11Department of Electronics and Communication, SMIT.
  12. 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.____________________________________________________________________ 12Department of Electronics and Communication, SMIT.
  13. 13. 2. - INTRODUCTION____________________________________________________________________ 13Department of Electronics and Communication, SMIT.
  14. 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 electronicchip 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 underresearch . So, we have tried to develop an open source, functionally divided software ,using the most popular, easily understandable , widely used and efficient engineeringsoftware-tool - MATLAB. 2.2 - MOBILE TV2.2.1 - WHAT IS A MOBILE TV?Mobile TV is a recent concept where mobile subscribers will be able to view TVchannels on their mobile sets. Mobile TV is a complete Phone Cast solution, whichallows the subscribers to view TV channels, live events, sportscasts, and video on theirmobile phones globally.2.2.2 - MOBILE TV THEORYPhone Cast is a mobile video services platform, which enables wireless operators, contentproviders and media companies to allow their customers to experience Mobile TV andVideo on Demand through wireless devices globally. Phone Cast reduces the complexityof managing and distributing video content, and by allowing the creation and distributionof the contents for a mobile TV network quickly. Channel surfing is also possible on theMobile TV.It has been seen that Jupiter Research’s latest study on wireless TV found that 41 percentof US mobile phone users are interested in watching video on their handsets, andaccording to Strategy Analytics, mobile video content is projected to become a $4.5billion business by 2008____________________________________________________________________ 14Department of Electronics and Communication, SMIT.
  15. 15. Fig – 2.2.2(a) Mobile TV2.2.3 - COMPANIES ENGAGEDRenowned companies worldwide are engaged in the development of Mobile TV. Some ofthe 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 –____________________________________________________________________ 15Department of Electronics and Communication, SMIT.
  16. 16. Handheld (DVB-H) front-end solution, BGT216, which is predicted to have 15 millionconsumer 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 ontomobile handsets and other DVB-H-based devices. In addition, operators benefit fromincreased revenue opportunities while preserving cellular network bandwidth for voiceand 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 theintegration potential of the chip into mobile devices, which will enable handset and othermobile hardware manufacturers to create simpler, sleeker designs, which satisfy thecurrent consumer trends towards small, ultra-portable devices. DVB-H enables mostefficient mass distribution of mobile TV and is optimized for mobile devices (e.g. powerconsumption and resolution). In regards to the industry issue of power consumption thechip BGT216 has been designed in such a way that it require low power, which will inreturn maximize the battery life and provide better service to the consumers.Research shows that end users want to switch between different mobile TV channels aseasily 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 forfurther usage. Siemens’ (MDS) enables mobile network operators to deliver rich mediacontent to their subscribers and roaming mobile devices. The solution is designed togenerate new revenues with services such as video on demand, live video streaming andcontent download.LG Electronics has selected Microtunes ultra low-power Microtunes Mobile MicroTunerMT2260 chip, to enable high-performance mobile television on LGs LG-U900 DVB-Hmobile phone. It is a miniature DVB-H digital TV tuner, engineered to deliver robustperformance in a very low-power consumption. The Mobile MicroTuner MT2260features higher integration than other leading DVB-H tuner solutions on the market bynot requiring bulky and costly external components, such as a low-noise amplifier andtransformer. The tuners are developed in such a way that they detect very small signalsand simultaneously manage fading conditions, 0dB echo and large adjacent channels,____________________________________________________________________ 16Department of Electronics and Communication, SMIT.
  17. 17. Italian mobile telecommunications service provider, Hutchison 3 Italia, expects tobroadcast the FIFA World Cup games to mobile handheld devices using the digital videobroadcast 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.____________________________________________________________________ 17Department of Electronics and Communication, SMIT.
  18. 18. 3. – MATLAB____________________________________________________________________ 18Department of Electronics and Communication, SMIT.
  19. 19. 3.1 - WHY WE ARE USING MATLAB?MATLAB is a high-speed computation program. It is an interactive system whose basicdata element is an array that does not require dimensioning. This allows the user to solvemany technical computing problems, especially those with matrix and vectorformulations. It is a high-end programming language that gives result within a fraction ofseconds. For example if we want to compute the Fast Fourier Transformation (FFT) of afunction, all we have to do is type the function and then simply click on the FFT optionan within seconds we have the result. MATLAB does long and complex computations inmuch 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 iton open source that is any body can further modify it for its betterment and can develop abetter 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 dealwith the desired output with different approaches.3.2. - WHAT IS MATLAB?MATLAB is a high-performance language Created by The MathWorks, for technicalcomputing. MATLAB allows: • easy matrix manipulation, • plotting of functions and data, • implementation of algorithms, • creation of user interfaces, and interfacing with programs in other languages____________________________________________________________________ 19Department of Electronics and Communication, SMIT.
  20. 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 notrequire 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 wouldtake 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 toprovide easy access to matrix software. Today, MATLAB engines incorporate theLAPACK and BLAS libraries, embedding the state of the art in software for matrixcomputation.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 applyspecialized 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 usefulfor plotting data from other sources, e.g., experimental measurements. The simplest way____________________________________________________________________ 20Department of Electronics and Communication, SMIT.
  21. 21. to import your data into MATLAB is with the load command.3.2.1 – MATLAB USESTypical 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 SYNTAXMATLABs M-Code (or simply m) is primarily value oriented. Unlike languages such asJava and C++, m is not statically typed, meaning that variables themselves do not havetypes, only the runtime values stored in those variables have types, as in PHP orJavaScript.3.2.3 - THE MATLAB SYSTEMThe 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 andfiles. Many of these tools are graphical user interfaces. It includes the MATLAB desktopand Command Window, a command history, an editor and debugger, and browsers forviewing help, the workspace, files, and the search path.The MATLAB Mathematical Function Library: -____________________________________________________________________ 21Department of Electronics and Communication, SMIT.
  22. 22. This is a vast collection of computational algorithms ranging from elementary functions,like sum, sine, cosine, and complex arithmetic, to more sophisticated functions likematrix 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, datastructures, input/output, and object-oriented programming features. It allows both"programming in the small" that is to rapidly create quickly and dirty throw awayProgram and "programming in the large" that is to create large and complex applicationprogram.Graphics: -MATLAB has extensive facilities for displaying vectors and matrices as graphs, as wellas annotating and printing these graphs. It includes high-level functions for two-dimensional and three-dimensional data visualization, image processing, animation, andpresentation graphics. It also includes low-level functions that allow the users to fullycustomize the appearance of graphics as well as to build complete graphical userinterfaces 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 withMATLAB. 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 - FUNCTIONSMATLAB provides a large number of standard elementary mathematical functions,including abs, sqrt, exp, and sin. Taking the square root or logarithm of a negativenumber is not an error, and the appropriate complex result is produced automatically.MATLAB also provides many more advanced mathematical functions, including Besseland gamma functions. Most of these functions accept complex arguments. For viewing alist of the elementary mathematical functions, help elfin is typed. For viewing a list ofmore advanced mathematical and matrix functions, help specfun is typed.____________________________________________________________________ 22Department of Electronics and Communication, SMIT.
  23. 23. 3.2.5 - DESKTOP OVERVIEWDesktop tools are used to manage the work in MATLAB. The user can also useMATLAB functions to perform the equivalent of most of the features found in thedesktop tools. The following illustration shows the default configuration of the MATLABdesktop. The setup can modified as per the users requirements. Fig – 3.2.5(a):- Desktop Overview3.2.6 - START BUTTONThe MATLAB Start button provides easy access to tools, demos, shortcuts, anddocumentation. By clicking on the Start button the options can be viewed. Fig – 3.2.6(a):- Start Button____________________________________________________________________ 23Department of Electronics and Communication, SMIT.
  24. 24. 3.2.7 - COMMAND WINDOWThe Command Window is used to enter variables and to run functions and M-file scripts. Fig – 3.2.7(a):-Command WindowBy pressing the up arrow key a previously typed statement can be recalled. Then thestatement can be edited as needed and then can be run by pressing Enter.3.2.8 - COMMAND HISTORYThe statements entered by the user in the Command Window are logged in the CommandHistory. From the Command History, the user can view previously run statements, aswell as copy and execute selected statements. The user can also create an M-file fromselected statements. Fig – 3.2.8(a):- Command HistoryTo save the input and output from a MATLAB session to a file, the diary function isused.____________________________________________________________________ 24Department of Electronics and Communication, SMIT.
  25. 25. 3.2.9 - DEMOS AVAILABLE WITH MATLABMATLAB comes with a wide array of visual demonstrations to help the user to see theextent of what they can do with the product. To start running any of the demos, demoshould be typed at the MATLAB command prompt. Demos cover the following majorareas: • MATLAB. • Toolboxes. • Simulink. • Blocksets. • Real-Time Workshop. • Stateflow. 3.3 - M-FILE3.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 ifthe user had typed each command sequentially at the Matlab prompt. All m-file namesmust end with the extension .m (e.g. plot .m). If a new m-file is created with the samename as an existing m-file, Matlab will choose the one, which appears first in the pathorder. 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 andefficient. However, as the number of commands increases or changing certain variablesor values does trial and error, typing the commands over and over at the Matlab promptbecomes tedious. M-files will be helpful and almost necessary in these cases.____________________________________________________________________ 25Department of Electronics and Communication, SMIT.
  26. 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 Matlabcommands. To save the m-file, Save is chosen from File menu. The file should be savedwith 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, theuser can execute the commands in the m-file by simply typing filename at the Matlabprompt. If the user doesn’t want to run the whole m-file, he or she can just copy the partof m-file that is desired to run and paste it at the Matlab prompt.____________________________________________________________________ 26Department of Electronics and Communication, SMIT.
  27. 27. 4. - SIMULINK____________________________________________________________________ 27Department of Electronics and Communication, SMIT.
  28. 28. Simulink is a block library tool for modeling, simulating and analyzing dynamicsystems. 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 multidomainsimulation and design. Coupled with Real Time Workshop, another product from TheMathWorks, Simulink can do automatic code generation for real-time implementation ofsystems. As the efficiency and flexibility of the code is improving, this is becoming morewidely adopted for production systems, in addition to being a popular tool for embeddedsystem design work because of its flexibility and capacity for quick iteration. A numberof third-party hardware and software products are available for use with Simulinksoftware.4.1 - WHAT IS SIMULINK?Simulink is a software package for modeling, simulating, and analyzing dynamicsystems. It supports linear and nonlinear systems, modeled in continuous time, sampledtime, or a hybrid of the two. Systems can also be multirate, i.e., have different parts thatare sampled or updated at different rates.4.1.1 - TOOL FOR SIMULATIONSimulink encourages and allows the users to try things out. The users can easily buildmodels from scratch, or take an existing model and add to it. The user has instant accessto all the analysis tools in MATLAB, so they can take the results and analyze andvisualize them. A goal of Simulink is to give the user a sense of the fun of modeling andsimulation, 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 tomodel and solve real problems, knowledge of this tool will serve the user well throughouttheir professional career.____________________________________________________________________ 28Department of Electronics and Communication, SMIT.
  29. 29. 4.1.2 - TOOL FOR MODEL-BASED DESIGNFor modeling, Simulink provides a graphical user interface (GUI) for building models asblock diagrams, using click-and-drag mouse operations. With this interface, the user candraw the models just as they would with pencil and paper (or as most textbooks depictthem). This is far advanced from previous simulation packages that required the user toformulate differential equations and difference equations in a language or program.Simulink includes a comprehensive block library of sinks, sources, linear and nonlinearcomponents, 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-upapproaches. The system at a high level can be viewed, and then by double-clicking on theblocks to go down through the levels to see increasing levels of model detail. Thisapproach 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 CommandWindow. The menus are particularly convenient for interactive work, while thecommand-line approach is very useful for running a batch of simulations. Using scopesand other display blocks, the user can see the simulation results while the simulation isrunning. In addition, the user can change many parameters and see what happens due tothat change for "what if" exploration. The simulation results can be put in the MATLABworkspace for post processing and visualization.4.1.3 - CREATING AN EMPTY MODELTo create the model, first Simulink is entered in the MATLAB Command Window. OnMicrosoft Windows, the Simulink Library Browser appears.____________________________________________________________________ 29Department of Electronics and Communication, SMIT.
  30. 30. Fig – 4.1.3(a):- Creating An Empty ModelTo create a new model on Windows, the New Model button on the Library Browserstoolbar is clicked. Fig – 4.1.3(b):- Simulink Library BrowserSimulink opens a new model window. Fig – 4.1.3(c ):- Simulink Model Window____________________________________________________________________ 30Department of Electronics and Communication, SMIT.
  31. 31. 4.1.4 - ADDING BLOCKSTo create this model, the blocks are copied into the model from the following Simulinkblock 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 forWindows only To copy the Sine Wave block from the Library Browser, first the LibraryBrowser tree expanded to display the blocks in the Sources library. This is done byclicking the Sources node to display the Sources library blocks. Finally, the Sine Waveblock is selected by clicking the Sine Wave node. Here is how the Library Browsershould look after this is done. Fig – 4.1.4(a):- Simulink Library BrowserNow a copy of the Sine Wave block is dragged from the browser and dropped in themodel 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.____________________________________________________________________ 31Department of Electronics and Communication, SMIT.
  32. 32. On Windows, right clicking on the Simulink node in the Library Browser and thenclicking the resulting Open Library button can open the Simulink library window.Simulink displays the Sources library window. . Fig – 4.1.4(b):- Source Library WindowNow the Sine Wave block is dragged from the Sources window to the model window. Fig – 4.1.4(c):- Adding Blocks In Model WindowThe rest of the blocks are copied in a similar manner from their respective libraries intothe model window. The user can move a block from one place in the model window toanother by dragging the block. The user can move a block a short distance by selectingthe block, then pressing the arrow keys. It is noticed that one or both sides of the blockshave angle brackets. The > symbol pointing out of a block is an output port; if the symbolpoints to a block, it is an input port. Fig – 4.1.4(d):- Input and Output Ports____________________________________________________________________ 32Department of Electronics and Communication, SMIT.
  33. 33. 4.1.5 - CONFIGURING THE MODELNow Simulink is set up to run the simulation for 10 seconds. First, choosingConfiguration Parameters from the Simulation menu opens the Configuration Parametersdialog box. On the dialog box that appears, the Stop time is set to 10.0, it is the defaultvalue. Changing the Stop time as per the user’s choice can change this run time. Fig – 4.1.5(a):- Configuring The ModelClicking the OK button closes the Configuration Parameters dialog box. Simulink appliesthe parameters and closes the dialog box.4.1.6 - RUNNING THE MODELNow by double-clicking on the Scope block its display window is opened. Finally, theStart is chosen from the Simulation menu for running the simulation and then thesimulation output can be viewed on the Scope. Fig – 4.1.6(a):- Running The Model____________________________________________________________________ 33Department of Electronics and Communication, SMIT.
  34. 34. The simulation stops when it reaches the stop time specified in the ConfigurationParameters dialog box. The user can also stop the simulation if he or she choose Stopfrom the Simulation menu or click the Stop button on the model windows toolbar as pertheir choice. To save this model, Save has to be chosen from the File menu and enter afilename 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 analyzesystems whose outputs change over time. Such systems are often referred to as dynamicsystems. Simulink can be used to explore the behavior of a wide range of real-worlddynamic 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 ablock diagram, using the Simulink model editor, which graphically depicts time-dependent mathematical relationships among the systems inputs, states, and outputs. Theuser then commands Simulink to simulate the system represented by the model from aspecified start time to a specified stop time.4.2.1 - MODELING DYNAMIC SYSTEMSA Simulink block diagram model is a graphical representation of a mathematical modelof a dynamic system. A mathematical model of a dynamic system is described by a set ofequations. The mathematical equations described by a block diagram model are known asalgebraic, differential, and/or difference equations.4.2.2 - CREATING MODELSSimulink provides a graphical editor that allows the user to create and connect instancesof block types selected from libraries of block types via a library browser. Simulink____________________________________________________________________ 34Department of Electronics and Communication, SMIT.
  35. 35. provides libraries of blocks representing elementary systems that can be used as buildingblocks. The blocks supplied with Simulink are called built-in blocks. Simulink users canalso create their own block types and use the Simulink editor to create instances of themin a diagram. User-defined blocks are called custom blocks.4.2.3 - TIMETime is an inherent component of block diagrams in that the results of a block diagramsimulation change with time. Put another way, a block diagram represents theinstantaneous behavior of a dynamic system. Determining a systems behavior over timethus entails repeatedly solving the model at intervals, called time steps, from the start ofthe time span to the end of the time span. Simulink refers to the process of solving amodel at successive time steps as simulating the system that the model represents.4.2.4 - STATESTypically the current values of some system, and hence model, outputs are functions ofthe previous values of temporal variables. Such variables are called states. Computing amodels outputs from a block diagram hence entails saving the value of states at thecurrent time step for use in computing the outputs at a subsequent time step. Simulinkperforms 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 positionand speed of a car. A discrete state is an approximation of a continuous state where thestate is updated (recomputed) using finite (periodic or a-periodic) intervals. An exampleof a discrete state would be the position of a car shown on a digital odometer where it isupdated every second as opposed to continuously. In the limit, as the discrete state timeinterval approaches zero, a discrete state becomes equivalent to a continuous state. Thefollowing is a graphical representation of a block that has states:____________________________________________________________________ 35Department of Electronics and Communication, SMIT.
  36. 36. Fig – 4.2.4(a):- States4.2.5 - BLOCK PARAMETERSKey properties of many standard blocks are parameterized. For example, the Constantvalue of the Simulink Constant block is a parameter. Each parameterized block has ablock dialog that allows the users to set the values of the parameters.____________________________________________________________________ 36Department of Electronics and Communication, SMIT.
  37. 37. 5. – GRAPHICAL USER INTERFACE (GUI)____________________________________________________________________ 37Department of Electronics and Communication, SMIT.
  38. 38. 5.1 - GUI ( GRAPHICAL USER INTERFACE )GUIDE is a MATLAB Graphical User Interface development environment, whichprovides a set of tools for creating graphical user interfaces (GUIs). These tools greatlysimplify the process of designing and building GUIs. The user can use the GUIDE toolsto:• Lay out the GUIUsing the GUIDE Layout Editor, the user can lay out a GUI easily by clicking anddragging GUI components — such as panels, buttons, text fields, sliders, menus, and soon — into the layout area.• Program the GUIGUIDE automatically generates an M-file that controls how the GUI operates. The M-fileinitializes the GUI and contains a framework for all the GUI callbacks — the commandsthat are executed when a user clicks a GUI component. Using the M-file editor, the usercan add code to the callbacks to perform the functions the user want them to. Thefollowing sections provide an overview of creating GUIs with GUIDE.5.2 - STARTING GUIDETo start the GUIDE, guide is entered at the MATLAB prompt. This displays the GUIDEQuick Start dialog, as shown in the following figure. Fig – 5.2(a):- Starting Guide____________________________________________________________________ 38Department of Electronics and Communication, SMIT.
  39. 39. From the Quick Start dialog, the user can:• Create a new GUI from one of the GUIDE templates — prebuilt GUIs that the user canmodify for their own purposes.• Open an existing GUI.Once the user have selected one of these options, by clicking OK, the GUI in theLayout Editor opens.5.3 - THE LAYOUT EDITORWhen a GUI is opened in GUIDE, it is displayed in the Layout Editor, which is thecontrol panel for all of the GUIDE tools. The following figure shows the Layout Editorwith a blank GUI template. Fig – 5.3(a):- Layout EditorThe user can lay out the GUI by dragging the components, such as push buttons, pop-upmenus, or axes, from the component palette, at the left side of the Layout Editor, into thelayout area.____________________________________________________________________ 39Department of Electronics and Communication, SMIT.
  40. 40. For example, if the user drags a push button into the layout area, it appears as in thefollowing figure. Fig – 5.3(b):- Layout Editor5.4 - GUIDE TEMPLATESThe GUIDE Quick Start dialog provides templates for several basic types of GUIs. Theadvantage of using templates is that often the user can modify a template more quicklyand easily than by starting from a blank GUI. When the user selects a template in theTemplates pane, a preview of it appears in the right-hand pane. Fig – 5.4(a):- Guide Templates____________________________________________________________________ 40Department of Electronics and Communication, SMIT.
  41. 41. Clicking OK opens the template in the Layout Editor, as shown in the following figure. Fig – 5.4(b):- Guide TemplatesTo display the names of the GUI components in the component palette, selectPreferences from the File menu, check the box next to Show names in componentpalette, and click OK. Note that the Layout Editor does not display the functioning GUI.5.5 - RUNNING A GUITo 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 userruns the GUI with Axes and Menu template, it appears as shown in the following figure. Fig – 5.5(a):- Running A GUI____________________________________________________________________ 41Department of Electronics and Communication, SMIT.
  42. 42. This GUI displays various MATLAB plots. Select a plot from the pop-up menu and clickUpdate. If the user is running the GUI for the first time, the user has to save it first. Afterit is saved, the GUIDE runs the GUI and opens an M-file for the GUI in the default texteditor.5.6 - GUI FIG-FILES AND M-FILESGUIDE stores a GUI in two files, which are generated the first time the user save or runthe 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-FILEAfter laying out the user’s GUI, the user can program the GUI M-file using the M-fileEditor. GUIDE automatically generates this file from the user’s layout the first time theuser 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 theM-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.____________________________________________________________________ 42Department of Electronics and Communication, SMIT.
  43. 43. The user can view the callback for any of the GUI components by clicking the functionicon on the toolbar. This displays a list of all the callbacks, as shown in the followingfigure. Fig – 5.7(b):- Programming The GUI M-filesClicking 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 forpushbutton1_Callback. Fig – 5.7(c):- Programming The GUI M-filesWhatever may be the approach towards designing a specific project that is we can useMATLAB Simulink blockset or Guide to make GUI or just to simply create a .m file, thebasics remain the same that is on the background of a GUI figure or Simulink block abasic .m file is functional only the user interfacing changes .Though all are working withthe help of m-files the format and the syntax changes according to the approach .____________________________________________________________________ 43Department of Electronics and Communication, SMIT.
  44. 44. 6.- SELECTION OF TV TUNER CARD____________________________________________________________________ 44Department of Electronics and Communication, SMIT.
  45. 45. 6.1 - SIMULINK MODEL USED FOR DATA ACQUISITIONAs we have worked more with data acquisition and image acquisition, so we havefocused more light on the topic. According to our aim of Real- Time Multimedia SignalProcessing using MATLAB, previously we were trying to study the multimedia card (TIDM642EVM) already provided in the Simulink blockset. For that we were usingDM642EVM block, which is the TI C6000 target preference block. Fig – 6.1(a):- DM642EVMThese are the DM642EVM Board Support blocks. These blocks must be present on theDM642EVM block Fig – 6.1 (b):- DM642EVM Board Support blocks____________________________________________________________________ 45Department of Electronics and Communication, SMIT.
  46. 46. We were using it just to know the basics of a standard multimedia card like TIDM642EVM (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 withsoftware according to the desired parameters.Moreover the block provided in the simulink could be set to different parameters but wehad no acess to the main .m source code due to PROPITORY RIGHTS. And theDM642EVM block was a block as a whole with no inputs or outputs on it. There waseven no sub-blocks, from which we could gather some information about the working ofthe 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 unfortunatelythe look under mask for DM642EVM provided us with nothingAll these took a lot of time. After spending a lot of time that is almost two and halfmonths in this, we decided to change the Tuner card, and we selected the Pinacle TVTuner 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 thespecifications we tried to build up a model for data acquisition and display in theMATLAB 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 runningthis we could view the video, which we have selected from the inbuilt videos inMATLAB along with the text we had inserted and at the same time could receive theaudio recorded and inserted by us. The apparent problem with this model was that therewas 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 RGBformat. RGB format was not a problem, but the composite source selection became a bigproblem. According to it when we are getting the source from camera it is in composite____________________________________________________________________ 46Department of Electronics and Communication, SMIT.
  47. 47. mode and the winvideo adapter in MATLAB also selects the composite mode and we getan 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 notget an output because the antenna input source is in tuner mode, and winvideo adapter bydefault selects the composite mode. So we have to change the source code (m-file) of theimage acquisition blockset of simulink. But unfortunately the source m-file of the blockwas in .dll format so was inaccessible to us, so ultimately at the cost of time and effort wehad to switch over to simple m-file programming.Thus Simulink could not be used for viewing the TV channels in MATLAB. So wedecided to develop program in MATLAB itself for that purpose. The tuner card is set tothe tuner video mode, while the winvideo adapter in MATLAB is set to the compositevideo mode by default.Since we are working on both on-line and off-line, so we have to take the data from theTV as well as from the digital camera. For this purpose we have to access both the Tunercard and the camera. And for accessing the tuner card the default video mode of theMATLAB had to be changed. With lot of efforts we have developed a program withwhich we could access the tuner card as well as the camera. This program is developed insuch a way that when it’s debugged and run, it can change the default video mode ofMATLAB that is the “composite video” into the “tuner” mode, as per the choice. Bydoing so we could view the TV channels in MATLAB, and we even received the audiosignals of the TV channel.____________________________________________________________________ 47Department of Electronics and Communication, SMIT.
  48. 48. 6.2 – JUSTIFICATIONWe 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/-.____________________________________________________________________ 48Department of Electronics and Communication, SMIT.
  49. 49. 7.– PROGRAMMES____________________________________________________________________ 49Department of Electronics and Communication, SMIT.
  50. 50. 7.1 – VIDEO ACQUISITION PROGRAMMEvidobj = videoinput(“winvideo”)sources = vidobj.sourcewhos sourcesset(vidobj,’selectedsourcename’,’tuner’)sources = vidobj.sourceget(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 videoobject i.e. colors, brightness, hue, etc and also the properties of the video source. Notonly we access them but also we can modify them. By default the source selects thecomposite mode, out of the three possible modes, which are: 1. S-Video mode. 2. Tuber mode.____________________________________________________________________ 50Department of Electronics and Communication, SMIT.
  51. 51. 3. Composite mode.Now in the line “set(vidobj,’selectedsourcename’,’tuner’)” we select the tuner source sothe problem is solved i.e. if we keep this line we can access TV and if we omit this linewe 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 andsophisticated looking GUI.We faced a lot of problems in there to. Though the basic image acquisition conceptremains the same, the basic m-file writing format and syntax changes drastically fromcommand window m-file to Simulink model to a GUI. But finally with lots of efforts wedeveloped a program for building a GUI.7.2 - PROGRAMME FOR BUILDING GUIfunction varargout = cameracompositeandtvtuner(varargin)% cameracompositeandtvtuner - launch a GUI to control imageacquisition 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 createthe 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: DeleteVideoInput).% 2. Press Preview (user should see the video stream from thecamera or tv% the label changes to: Close Preview).% 3. Press FramesAcquired (=0), FramesAvailable (=0), IsRunning(No), IsLogging (No) -____________________________________________________________________ 51Department of Electronics and Communication, SMIT.
  52. 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 videoobject).% 7. Press Save ( a dialog box appears suggesting a file-namecomposed from the Test name and% the time yyyymmdd_HHMMSS).% 8. Press ImageDisplay (it should load another independent GUIto view what user created in VideoControl).%% Image Acquisition:% Editing the fields: FrameGrabInterval (take a frame every Xframes),% FramesPerTrigger, TriggerRepeat (the system expects1+TriggerRepeat triggers after START),% TriggerFrameDelay (number of frames to skip after trigger).% Note: When video object is created it always has the defaultsvalues,% 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 itbefore!% 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 ofthe% unique structure preduced by CAMERACOMPOSITEANDTVTUNER.% Trigger:% Immediate - begin logging immediately after user presss START.% Manual - begin logging after user presss TRIGGER.%% Logging:% LoggingMode - memory (producing data structure that will besaved by SAVE),% disk&memory (creating also an avi file) or disk.%% MENU:% On the menu bar user has Trigger and Info to display thestatus% of the video object, video source and trigger info. If userswindow% is docked into the MATLAB window, the menus will join theMATLAB% menu bar on top of the window.%gui_Singleton = 1;____________________________________________________________________ 52Department of Electronics and Communication, SMIT.
  53. 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});endif 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 (seeVARARGIN)% Choose default command line output for cameracompositeandtvtunerhandles.output = hObject;% my global definitions:handles.data = [];handles.aviobj =[];imaqreset% Update handles structureguidata(hObject, handles);% UIWAIT makes cameracompositeandtvtuner wait for user response (seeUIRESUME)% 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 structurevarargout{1} = handles.output;% --------------------------------------------------------------------____________________________________________________________________ 53Department of Electronics and Communication, SMIT.
  54. 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); returnelse 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); returnend% --- 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____________________________________________________________________ 54Department of Electronics and Communication, SMIT.
  55. 55. preview(handles.vid); set(hObject, string, ClosePreview); set(hObject, userdata, 1.0); guidata(hObject, handles); returnelse closepreview(handles.vid); set(hObject, string, Preview); set(hObject, userdata, 0.0); guidata(hObject, handles); returnend% --- 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]);elseset(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____________________________________________________________________ 55Department of Electronics and Communication, SMIT.
  56. 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);elseset(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 rangeof sliderif 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____________________________________________________________________ 56Department of Electronics and Communication, SMIT.
  57. 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 ppTriggerConfigcontents as cell array% contents{get(hObject,Value)} returns selected item fromppTriggerConfigif 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);elseset(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)returnfunction 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____________________________________________________________________ 57Department of Electronics and Communication, SMIT.
  58. 58. set(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor));endfunction 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);elseset(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor));endfunction 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);elseset(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);returnfunction 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____________________________________________________________________ 58Department of Electronics and Communication, SMIT.
  59. 59. % --- Executes during object creation, after setting all properties.function edTriggerFrameDelay_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,BackgroundColor,white);elseset(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; % videoobject absentif 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); returnelse returnendreturn% --- 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;____________________________________________________________________ 59Department of Electronics and Communication, SMIT.
  60. 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)ImageDisplayreturn% --- 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);endguidata(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____________________________________________________________________ 60Department of Electronics and Communication, SMIT.
  61. 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);elseset(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);elseset(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);elseset(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor));end____________________________________________________________________ 61Department of Electronics and Communication, SMIT.
  62. 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);elseset(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);elseset(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);____________________________________________________________________ 62Department of Electronics and Communication, SMIT.
  63. 63. switch s case 0 disp( Video object is NOT running); case 1 disp( Video object is running);endreturn% --- 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);endreturn% --- 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);elseset(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);elseset(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)____________________________________________________________________ 63Department of Electronics and Communication, SMIT.
  64. 64. With the help of this program we have created a GUI for the video files from both the TVand 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, SMIT7.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 BlockThe audio input from a microphone is feed into the sound card, which is an analog todigital converter. The output is a digitized audio. This digitized audio is then saved inMATLAB workspace, where it is converted into audio wave. The sound card does notaccess both the video and audio simultaneously. It accesses them separately with afaction of time interval in between, which we cannot notice. So the video and audio aremerged together in a multiplexer, which together forms a transport stream, which in theaudio video output (A/V). This A/V then goes to the display device.____________________________________________________________________ 64Department of Electronics and Communication, SMIT.
  65. 65. 7.4 - SIMULILNK MODEL FOR AUDIO ACQUISITION Fig – 7.4(a):- Simulink Based Audio Acquisition BlockFor audio acquisition we have designed the above model. The model consists of a audioinput block which takes audio inputs, a audio output block for producing audio outputand a “to web file” block which records and saves the audio data as a web file i.e. audiofile. The audio data taken from the audio input device goes to the audio output deviceform where we can be heard and then to a “web file” block where it is recorded and savedas a web file. The model can be modified by changing the parameters the blocks. Theparameters which can be changed are:Audio input block parameters are:- Sample rate(Hz), Sample width(bits), Samples perframe, 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 numberof samples for each write to file.____________________________________________________________________ 65Department of Electronics and Communication, SMIT.
  66. 66. 8. - TV TUNER CARD____________________________________________________________________ 66Department of Electronics and Communication, SMIT.
  67. 67. 8.1 - THEORITICAL STUDYThe TV tuner card works on the basis of the following block diagram. The input data’sare converted from analog to digital by the AD/C block, then they are multiplexed. Thisdata is then processed by the DSP and again converted back to analog by the DA/C blockand feed into the TV. And the digital data from the DSP block is also feed into thecomputer 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 DiagramA TV tuner card is a computer component that allows television signals to be receivedby a computer. Most TV tuners also function as video capture cards, allowing them torecord television programs onto a hard disk. Fig – 8.1(b):- TV Tuner CardWhile typically a PCI-bus expansion card, they can also be a USB device. The cardcontains a receiver, tuner, demodulator, and a analog-to-digital converter for analog____________________________________________________________________ 67Department of Electronics and Communication, SMIT.
  68. 68. TV and DSP. Like TV sets, each version is designed for the radio frequencies and videoformats used in each country. Many newer TV tuners have Flash memory big enough tohold the firmware for decoding several different video formats, making it possible to usethe tuner in many countries without having to flash the firmware. In addition to thefrequency tuner, many include a composite video input. Many TV tuners can function asFM radios: this is because the FM radio spectrum lies between television channels 6 and7, and the DSP can be easily programmed to decode FM. Some provide DVB receptionfor digital radio, television or data signals (either with or without hardware MPEGdecoding capability); these may be used to receive satellite broadcasts but normallyprovide no analogue input capability. Most internal tuners do all the low leveldemodulation needed to convert a radio signal into an on-screen image using a hardwareDSP chip or ASIC; some also have hardware MPEG decoders and use DMA to bypassthe CPU entirely. Some cheaper tuners dont do much of the onboard signal processingand rely on the systems CPU for that task. External tuners may convert the signal intoeither a video stream suitable for display on the screen, or to an intermediate format suchas 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____________________________________________________________________ 68Department of Electronics and Communication, SMIT.

×