major project engineering
Post on 10-Mar-2016
222 Views
Preview:
DESCRIPTION
TRANSCRIPT
____________________________________________________________________Department of Electronics and Communication, SMIT.
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
____________________________________________________________________Department of Electronics and Communication, SMIT.
2
SIKKIM MANIPAL INSTITUTE OF TECHNOLOGY (A constituent college of Sikkim Manipal University of Health Medical and
Technological Sciences)
CERTIFICATE
This is to certify that ANGSHUMAN GHOSH bearing the registration no:-
200212080 has successfully completed the major project titled ‘REAL-TIME
MULTIMEDIA SIGNAL PROCESSING USING MATLAB’ at Department of
Applied Physics, University of Calcutta, in partial fulfillment of the requirement for the
award of Bachelor Of Technology in Electronics and Communication Engineering of
SIKKIM MANIPAL UNIVERSITY OF HEALTH MEDICAL AND
TECHNOLOGICAL SCIENCES in the year 2005-06.
___________________________ Dr. R. N. Bera (Internal Guide) Head of Department, Department of Electronics and Communication Engineering, S.M.I.T, Majitar, Rangpo, Sikkim- 737132
DEPARTMENTAL SEAL
DEPARTMENT OF ELECTRONICS AND COMMUNICATION.
____________________________________________________________________Department of Electronics and Communication, SMIT.
5
ABSTRACT
The aim of our major project is Real-Time Multimedia Signal Processing Using
MATLAB using a comparatively cheaper card in contrast to expensive cards like TI
DM642EVM. The project on completion will process the multi-media files like the video
and audio from the TV as well as from the digital camera and these can be viewed on the
computer. For this objective we have the following two Real-time approaches:
• Tuner mode: - that is processing the data’s from the TV.
• Composite mode: - that is processing the data’s from the digital camera.
These two approaches works in two different video modes: the tuner mode and the
composite mode. The online approach where the data are acquired from the TV works in
the tuner video mode.
While the offline approach where the data’s are acquired from a digital camera works in
the composite video mode. These two modes can be turned on and off by the program we
have developed in MATLAB.
For acquiring data’s from the TV & Camera we have chosen a TV tuner card, which is
the PIXEL VIEW TV Tuner card having the model no. TCL2002MB-33F. The reason for
choosing the TV Tuner card as the video card is that the TV Tuner card has a wide
bandwidth of 815MHz. And the digital camera we have chosen is OLYMPUS
CAMEDIA C- 750.
We have used MATLAB 7.1 for the simulation purpose, as it is a high-speed computation
program, which performs various kinds of operations in much less time.
____________________________________________________________________Department of Electronics and Communication, SMIT.
6
TABLE OF CONTENTS
TOPIC PAGE NO.
CHAPTER 1: LIST INSERTED………………………………………..9.
1.1 List of Tables………………………………………………..10.
1.2 List of Figures……………………………………………….11.
CHAPTER 2: INTRODUCTION………………………………………13.
2.1 Why we are interested in this project .........................................14.
2.2 Mobile TV?……………………………………...……………..14.
2.1.1. What is a Mobile TV ……….…..……………………..14.
2.1.2. Mobile TV Theory……………..………………………14.
2.1.3 Companies Engaged……………………………………15.
2.1.4 Merits……………………….…………………………17.
CHAPTER 3: MATLAB…………………….………………………….18.
3.1 Why We Are Using MATLAB?...............................................19.
3.2 What is MATLAB?………...........................................………19.
3.2.1 MATLAB Uses……………………………………………21.
3.2.2 MATLAB Syntax………………………………………….21.
3.2.3 The MATLAB Systems……………………………………21.
3.2.4 Functions……………………………………………...22
3.2.5 .Desktop Overview……………………………………23.
3.2.6 Start Button……………………………………………23.
3.2.7 Command Window……………………………………24.
3.2.8 Command History……………………………………..24.
3.2.9 Demos…………………………………………………25.
3.2 M-file…………………………………………………….….25.
3.3.1 What is a M-file?…………………………………………...25.
3.3.2 Why use M-file?……………………………………………25.
____________________________________________________________________Department of Electronics and Communication, SMIT.
7
3.3.3 How to Create, Save and Open a M-file?…………………..26.
3.3.4 How to Run a M-file?………………………………………26.
CHAPTER 4: SIMULINK……………………………………………………27.
4.1 What is SIMULINK?……………………………………………………..28.
4.1.1 Tool For Simulation…………………………………………………….28.
4.1.2 Tool For Model Based Designs…………………………………………29.
4.1.3 Creating Empty Model………………………………………………….29.
4.1.4 Adding The Blocks……………………………………………………...31.
4.1.5 Configuring The Model…………………………………………………33.
4.1.6 Running The Model……………………………………………………..33.
4.2 How Does Simulink Works?……………………………………………...34.
4.2.1 Modeling Dynamic Systems…………………………………………….34.
4.2.2 Creating Models ………………………………………………………..34.
4.2.3 Time……………………………………………………………………..35.
4.2.4 State……………………………………………………………………...35.
4.2.5 Block Parameters……………………………………………………..…36.
CHAPTER 5: GRAPHICAL USER INTERFACE (GUI)……………….….37.
5.1 GUI…………………………………………………………………….38.
5.2 Starting GUIDE………………………………………………………..38.
5.3 The Layout Editor……………………………………………………...39.
5.4 GUIDE Templates……………………………………………………..40.
5.5 Running A GUI………………………………………………………...41.
5.6 GUI Fig-file and M-file………………………………………………..42.
5.7 Programming The GUI M-files………………………………………..42.
CHAPTER 6: SELECTION OF TV TUNER CARD………………………44.
6.1 Simulink Model Used For Data Acquisition…………………………..45.
6.2 Justification…………………………………………………………….47.
____________________________________________________________________Department of Electronics and Communication, SMIT.
8
CHAPTER 7: PROGRAMMES……………………………………………..49.
7.1 Video Acquisition Program….………………………………………..50.
7.2 Program for Building GUI ……………………………..……………..51.
7.3 Audio Acquisition Block……………………………………………..64.
7.4 Simulink Model for Audio Acquisition……………………………...65.
CHAPTER 8: TV TUNER CARD…………………………………………..66.
8.1 Theoretical Study …………………………………………………….67.
8.2 PIXEL VIEW TV Tuner Card………………………………………..68.
8.2.1 PIXEL VIEW TV Tuner Card Specification …………………67.
8.2.2 Connection Diagram…………………………………………..73.
8.3 S-Video……………………………………………………………….74.
8.3.1 Advantages…………………………………………………….76.
8.3.2 Disadvantages…………………………………………………76.
8.4 Composite Video……………………………………………………..77.
9. PROBLEMS…………………………………………………….78.
10. RESULT………………………………………………………….82.
10.1 Result Obtained…………………………………………………..83.
10.2 GUI Created……………………………………………………..86.
10.3 Result Obtained From TV………………………………………..87.
10.4 Result Obtained From Camera…………………………………...88.
11. CONCLUSION…………………………………………………..89.
12. DISCUSSION…………………………………………………….91.
13. BIBLIOGHRAPHY……………………………………………..92.
____________________________________________________________________Department of Electronics and Communication, SMIT.
13
2. - INTRODUCTION
____________________________________________________________________Department of Electronics and Communication, SMIT.
14
2.1 - WHY WE ARE INTERESTED IN THIS PROJECT ?
Latest multimedia development is interested in implementing the concept of mobile TV.
Even SIMENS, NOKIA, ERICSSION etc mobile handset companies and other electronic
chip pioneers have already developed an acquisition card which would fit into the size,
prize and weight of a Mobile Phone, but the software for driving that chip is still under
research . So, we have tried to develop an open source, functionally divided software ,
using the most popular, easily understandable , widely used and efficient engineering
software-tool - MATLAB.
2.2 - MOBILE TV
2.2.1 - WHAT IS A MOBILE TV?
Mobile TV is a recent concept where mobile subscribers will be able to view TV
channels on their mobile sets. Mobile TV is a complete Phone Cast solution, which
allows the subscribers to view TV channels, live events, sportscasts, and video on their
mobile phones globally.
2.2.2 - MOBILE TV THEORY
Phone Cast is a mobile video services platform, which enables wireless operators, content
providers and media companies to allow their customers to experience Mobile TV and
Video on Demand through wireless devices globally. Phone Cast reduces the complexity
of managing and distributing video content, and by allowing the creation and distribution
of the contents for a mobile TV network quickly. Channel surfing is also possible on the
Mobile TV.
It has been seen that Jupiter Research’s latest study on wireless TV found that 41 percent
of US mobile phone users are interested in watching video on their handsets, and
according to Strategy Analytics, mobile video content is projected to become a $4.5
billion business by 2008
____________________________________________________________________Department of Electronics and Communication, SMIT.
15
Fig – 2.2.2(a) Mobile TV
2.2.3 - COMPANIES ENGAGED
Renowned companies worldwide are engaged in the development of Mobile TV. Some of
the companies are:
• Royal Philips Electronics.
• Siemens.
• NEXAGE, a wireless and multimedia software and services company.
• Nokia.
• T-mobile, Germany.
• Alcatel.
• Orange, France.
• Ericsson.
• Qualcomm, hand set manufacturers, United States.
• Huawei Technologies, China.
• LG Electronics.
Royal Philips Electronics has announced its next generation TV-on-mobile solution,
which is six times smaller than its previous version, the Digital Video Broadcast –
____________________________________________________________________Department of Electronics and Communication, SMIT.
16
Handheld (DVB-H) front-end solution, BGT216, which is predicted to have 15 million
consumer users by 2009, up from only 1.2 million in 2005, according to e-Marketer.
DVB-H technologies enable consumers to receive live TV-like experiences directly onto
mobile handsets and other DVB-H-based devices. In addition, operators benefit from
increased revenue opportunities while preserving cellular network bandwidth for voice
and other data services. Philips’ DVB-H front-end solution, BGT216, measures 7x7 mm,
far smaller than the previous 15x26 mm version. The smaller size improves the
integration potential of the chip into mobile devices, which will enable handset and other
mobile hardware manufacturers to create simpler, sleeker designs, which satisfy the
current consumer trends towards small, ultra-portable devices. DVB-H enables most
efficient mass distribution of mobile TV and is optimized for mobile devices (e.g. power
consumption and resolution). In regards to the industry issue of power consumption the
chip BGT216 has been designed in such a way that it require low power, which will in
return maximize the battery life and provide better service to the consumers.
Research shows that end users want to switch between different mobile TV channels as
easily and fast as using their remote control at home. Siemens’ Media Delivery Solution
(MDS) offers just that. And on top of this users can download and store video files for
further usage. Siemens’ (MDS) enables mobile network operators to deliver rich media
content to their subscribers and roaming mobile devices. The solution is designed to
generate new revenues with services such as video on demand, live video streaming and
content download.
LG Electronics has selected Microtune's ultra low-power Microtune's Mobile MicroTuner
MT2260 chip, to enable high-performance mobile television on LG's LG-U900 DVB-H
mobile phone. It is a miniature DVB-H digital TV tuner, engineered to deliver robust
performance in a very low-power consumption. The Mobile MicroTuner MT2260
features higher integration than other leading DVB-H tuner solutions on the market by
not requiring bulky and costly external components, such as a low-noise amplifier and
transformer. The tuners are developed in such a way that they detect very small signals
and simultaneously manage fading conditions, 0dB echo and large adjacent channels,
____________________________________________________________________Department of Electronics and Communication, SMIT.
17
Italian mobile telecommunications service provider, Hutchison 3 Italia, expects to
broadcast the FIFA World Cup games to mobile handheld devices using the digital video
broadcast handheld (DVB-H) standard, in June.
2.2.4 – MERITS
• Subscribers can view live TV on their mobile handset.
• Mobile TV and video services provide music videos and concert coverage to
younger audience.
• Targets the widest possible subscriber base and allows insertion of advertisements
and promotions within live TV programming and VOD services.”
• Universal Theater is a premier online digital music business that produces music
downloads, concerts, sporting events, special events, interviews, news clips,
reality shows, ring tones, movies, and music videos and interactive programming
which is distributed over the Internet and mobile platform.
• Maximize revenue by attracting more users.
____________________________________________________________________Department of Electronics and Communication, SMIT.
18
3. – MATLAB
____________________________________________________________________Department of Electronics and Communication, SMIT.
19
3.1 - WHY WE ARE USING MATLAB?
MATLAB is a high-speed computation program. It is an interactive system whose basic
data element is an array that does not require dimensioning. This allows the user to solve
many technical computing problems, especially those with matrix and vector
formulations. It is a high-end programming language that gives result within a fraction of
seconds. For example if we want to compute the Fast Fourier Transformation (FFT) of a
function, all we have to do is type the function and then simply click on the FFT option
an within seconds we have the result. MATLAB does long and complex computations in
much less time and with perfect accuracy. It has got many facilities like computing FFT,
DFT, IDFT, etc. More it is that to write or develop a program in MATLAB is to keep it
on open source that is any body can further modify it for its betterment and can develop a
better program and can work further with the basics. It also has three major tools –
1. Simple MATLAB .m file programming.
2. Simulink block approach.
3. “Guide” a tool to form useful and easy interactive GUI’s (Graphics User
Interface).
These three tools can be used to see the same problem from different angles or to deal
with the desired output with different approaches.
3.2. - WHAT IS MATLAB?
MATLAB is a high-performance language Created by The MathWorks, for technical
computing. MATLAB allows:
• easy matrix manipulation,
• plotting of functions and data,
• implementation of algorithms,
• creation of user interfaces, and interfacing with programs in other languages
____________________________________________________________________Department of Electronics and Communication, SMIT.
20
• It integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar
mathematical notation.
MATLAB is an interactive system whose basic data element is an array that does not
require dimensioning. This allows the user to solve many technical computing problems,
especially those with matrix and vector formulations, in a fraction of the time it would
take to write a program in a scalar non-interactive language such as C or Fortran.
The name MATLAB stands for matrix laboratory. MATLAB was originally written to
provide easy access to matrix software. Today, MATLAB engines incorporate the
LAPACK and BLAS libraries, embedding the state of the art in software for matrix
computation.
MATLAB features a family of add-on application-specific solutions called toolboxes.
Very important to most users of MATLAB, toolboxes allow the user to learn and apply
specialized technology. Toolboxes are comprehensive collections of MATLAB functions
(M-files) that extend the MATLAB environment to solve particular classes of problems.
Areas in which toolboxes are available include:
• Signal processing,
• Control systems,
• Neural networks,
• Fuzzy logic,
• Wavelets,
• Image Acquisition
• Data Acquisition
• Simulation, and many others.
MATLAB can plot values created with its own commands, MATLAB is also very useful
for plotting data from other sources, e.g., experimental measurements. The simplest way
____________________________________________________________________Department of Electronics and Communication, SMIT.
44
6.- SELECTION OF TV
TUNER CARD
____________________________________________________________________Department of Electronics and Communication, SMIT.
45
6.1 - SIMULINK MODEL USED FOR DATA ACQUISITION
As we have worked more with data acquisition and image acquisition, so we have
focused more light on the topic. According to our aim of Real- Time Multimedia Signal
Processing using MATLAB, previously we were trying to study the multimedia card (TI
DM642EVM) already provided in the Simulink blockset. For that we were using
DM642EVM block, which is the TI C6000 target preference block.
Fig – 6.1(a):- DM642EVM
These are the DM642EVM Board Support blocks. These blocks must be present on the
DM642EVM block
Fig – 6.1 (b):- DM642EVM Board Support blocks
____________________________________________________________________Department of Electronics and Communication, SMIT.
46
We were using it just to know the basics of a standard multimedia card like TI
DM642EVM (the price of the Texas Instrument TV Tuner card costs more than $ 1,
50000), after studying it we had planned to get a cheaper card and to modify it with
software according to the desired parameters.
Moreover the block provided in the simulink could be set to different parameters but we
had no acess to the main .m source code due to PROPITORY RIGHTS. And the
DM642EVM block was a block as a whole with no inputs or outputs on it. There was
even no sub-blocks, from which we could gather some information about the working of
the block. After a lot of effort we found out an option that is the “look under mask”
option, which provides an acess to the sub-blocks of the main block. But unfortunately
the look under mask for DM642EVM provided us with nothing
All these took a lot of time. After spending a lot of time that is almost two and half
months in this, we decided to change the Tuner card, and we selected the Pinacle TV
Tuner card for our project. But unfortunately we could not buy it due to its high price,
which was Rs 2800/-. We even could not get hold of the theory of the Pinacle tuner card,
which was also not available due to the company’s proprietary rights.
Finally we bought the Pixel View TV Tuner card, which was of little low price Rs 1400/-.
With lot of effort we got hold of the product specification of the Pixel View tuner card,
which was send to us by the company after a humble request to do so. After studying the
specifications we tried to build up a model for data acquisition and display in the
MATLAB itself. This model could access the videos, which were inbuilt in MATLAB.
We had add audio from microphone and inserted according to our choice. After running
this we could view the video, which we have selected from the inbuilt videos in
MATLAB along with the text we had inserted and at the same time could receive the
audio recorded and inserted by us. The apparent problem with this model was that there
was no proper video streaming and so there was lag between the video and the audio.
MATLAB “winvideo” video adapter by default selects the composite source in RGB
format. RGB format was not a problem, but the composite source selection became a big
problem. According to it when we are getting the source from camera it is in composite
____________________________________________________________________Department of Electronics and Communication, SMIT.
47
mode and the winvideo adapter in MATLAB also selects the composite mode and we get
an output that is the preview of a real-time video captured by the camera as a result.
But when we were trying to get the real-time output from the TV antenna, we could not
get an output because the antenna input source is in tuner mode, and winvideo adapter by
default selects the composite mode. So we have to change the source code (m-file) of the
image acquisition blockset of simulink. But unfortunately the source m-file of the block
was in .dll format so was inaccessible to us, so ultimately at the cost of time and effort we
had to switch over to simple m-file programming.
Thus Simulink could not be used for viewing the TV channels in MATLAB. So we
decided to develop program in MATLAB itself for that purpose. The tuner card is set to
the tuner video mode, while the winvideo adapter in MATLAB is set to the composite
video mode by default.
Since we are working on both on-line and off-line, so we have to take the data from the
TV as well as from the digital camera. For this purpose we have to access both the Tuner
card and the camera. And for accessing the tuner card the default video mode of the
MATLAB had to be changed. With lot of efforts we have developed a program with
which we could access the tuner card as well as the camera. This program is developed in
such a way that when it’s debugged and run, it can change the default video mode of
MATLAB that is the “composite video” into the “tuner” mode, as per the choice. By
doing so we could view the TV channels in MATLAB, and we even received the audio
signals of the TV channel.
____________________________________________________________________Department of Electronics and Communication, SMIT.
48
6.2 – JUSTIFICATION
We could not use TI due to the following major reasons:
1. it takes at least six months to order and get the card in hand.
2. It is too costly i.e., it is in $1, 8000, so we could not afford it.
Reasons for using PIXEL VIEW card are:
1. it is almost the same like TI card, the only difference is in quality of output.
2. There is no TV-out for further broadcasting like TI. This can be used for future
programming, but at this stage we do not need it.
3. There are many extra features in TI, which we can use while using the card for
viewing and broadcasting, but they are not so important as the requirement for our
program.
4. The PIXEL VIEW card is readily available.
5. it is very cheap in comparison to TI card, it cost only Rs-1400/-.
____________________________________________________________________Department of Electronics and Communication, SMIT.
49
7.– PROGRAMMES
____________________________________________________________________Department of Electronics and Communication, SMIT.
50
7.1 – VIDEO ACQUISITION PROGRAMME
vidobj = videoinput(“winvideo”) sources = vidobj.source whos sources set(vidobj,’selectedsourcename’,’tuner’) sources = vidobj.source get(vidobj) src = getselectedsource(vidobj) get(src) framesPerTriggerValue = get((vidobj),’FramesPerTrigger’) brightnessValue = get(src,’Brightness’) set(vidobj) set(src) set(src,’Contrast’,9000) set(src,’Brightness’,5000) set(src,’Saturation’,3000) set(src,’Hue’,3000) get(src) start(vidobj) preview(vidobj) delete(vidobj)
Here we make a video object i.e. “vidobj” and then access the properties of the video
object i.e. colors, brightness, hue, etc and also the properties of the video source. Not
only we access them but also we can modify them. By default the source selects the
composite mode, out of the three possible modes, which are:
1. S-Video mode.
2. Tuber mode.
____________________________________________________________________Department of Electronics and Communication, SMIT.
51
3. Composite mode.
Now in the line “set(vidobj,’selectedsourcename’,’tuner’)” we select the tuner source so
the problem is solved i.e. if we keep this line we can access TV and if we omit this line
we can access camera. This program also had some problems, which are:
1. Though it cost a lot of time and effort it seems too simple.
2. It is not user friendly.
3. A puzzle to a lay man.
So, ultimately we switched over to GUIDE tool of MATLAB to build a user friendly and
sophisticated looking GUI.
We faced a lot of problems in there to. Though the basic image acquisition concept
remains the same, the basic m-file writing format and syntax changes drastically from
command window m-file to Simulink model to a GUI. But finally with lots of efforts we
developed a program for building a GUI.
7.2 - PROGRAMME FOR BUILDING GUI
function varargout = cameracompositeandtvtuner(varargin) % cameracompositeandtvtuner - launch a GUI to control image acquisition session: % The GUI helps in: % craeting the video object, % previewing and snap shotting, % controlling frame grabber parameters, % The video object constructor is: videoinput('winvideo', 1, format) - % session begins with pressing the 'VideoInput' pushbutton to create the video object. % % The application sends its messages to the MATLAB environment. % user should keep the MATLAB environment visible. % % Quick start: % 1. Press VideoInput (wait untill the label changes to: 'Delete VideoInput'). % 2. Press Preview (user should see the video stream from the camera or tv % the label changes to: 'Close Preview'). % 3. Press FramesAcquired (=0), FramesAvailable (=0), IsRunning (No), IsLogging (No) -
____________________________________________________________________Department of Electronics and Communication, SMIT.
52
% all answers appear in the Matlab environment. % 4. Press START (the acquisition begins with default parameters: FramesPerTrigger=10 etc...). % 5. Press FramesAcquired (=10), FramesAvailable(=10). % 6. Press GetData (to get the acquired data from the video object). % 7. Press Save ( a dialog box appears suggesting a file-name composed from the Test name and % the time yyyymmdd_HHMMSS). % 8. Press ImageDisplay (it should load another independent GUI to view what user created in VideoControl). % % Image Acquisition: % Editing the fields: FrameGrabInterval (take a frame every X frames), % FramesPerTrigger, TriggerRepeat (the system expects 1+TriggerRepeat triggers after START), % TriggerFrameDelay (number of frames to skip after trigger). % Note: When video object is created it always has the defaults values, % regardless of what is written in the edit fields. % Video Source: % From this pannel user can control Brightness, Contrast and % resolution . % Function: % START - make the video object running (ready for logging upon % trigger) % Trigger - useful at manual trigger only, begins logging. % STOP - stop the video object from running. % GetData - brings acquired data from video object to the MATLAB % environment. user can not save data unless he pressed it before! % Save - save the acquired data to a file. user can change the % suggested file name as user like. % ImageDisplay - launch an independent GUI to display images of the % unique structure preduced by CAMERACOMPOSITEANDTVTUNER. % Trigger: % Immediate - begin logging immediately after user press's START. % Manual - begin logging after user press's TRIGGER. % % Logging: % LoggingMode - 'memory' (producing data structure that will be saved by SAVE), % 'disk&memory' (creating also an avi file) or 'disk'. % % MENU: % On the menu bar user has 'Trigger' and 'Info' to display the status % of the video object, video source and trigger info. If user's window % is docked into the MATLAB window, the menus will join the MATLAB % menu bar on top of the window. % gui_Singleton = 1;
____________________________________________________________________Department of Electronics and Communication, SMIT.
53
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @cameracompositeandtvtuner_OpeningFcn, ... 'gui_OutputFcn', @cameracompositeandtvtuner_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before cameracompositeandtvtuner is made visible. function cameracompositeandtvtuner_OpeningFcn(hObject, eventdata, handles, varargin) %avidobj = videoinput('winvideo') %sources = avidobj.source %whos sources %set(avidobj,'selectedsourcename','tuner') %sources = avidobj.source % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to cameracompositeandtvtuner (see VARARGIN) % Choose default command line output for cameracompositeandtvtuner handles.output = hObject; % my global definitions: handles.data = []; handles.aviobj =[]; imaqreset % Update handles structure guidata(hObject, handles); % UIWAIT makes cameracompositeandtvtuner wait for user response (see
UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = cameracompositeandtvtuner_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --------------------------------------------------------------------
____________________________________________________________________Department of Electronics and Communication, SMIT.
54
function miFramesPerTrigger_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; fpt = num2str(get(handles.vid, 'FramesPerTrigger')); disp([' Frames per trigger: ', fpt]); return % -------------------------------------------------------------------- function miTriggerType_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; t = get(handles.vid, 'TriggerType'); disp([' Trigger type: ', t]); return % -------------------------------------------------------------------- function miTriggerCondition_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; tc = get(handles.vid, 'TriggerCondition'); disp([' Trigger condition: ', tc]); return % -------------------------------------------------------------------- function miTriggerSource_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; ts = get(handles.vid, 'TriggerSource'); disp([' Trigger source: ', ts]); return % -------------------------------------------------------------------- function menuTrigger_Callback(hObject, eventdata, handles) % --- Executes on button press in pbVideoInput. function pbVideoInput_Callback(hObject, eventdata, handles) if get(hObject, 'userdata') == 0, % video is closed imaqreset; handles.vid = videoinput('winvideo'); set((handles.vid),'selectedsourcename','tuner'); handles.source = getselectedsource(handles.vid); set(hObject, 'string', 'Delete VideoInput'); set(hObject, 'userdata', 1); guidata(hObject, handles); return else delete(handles.vid); clear handles.vid; set(hObject, 'string', 'VideoInput'); set(hObject, 'userdata', 0); set(handles.pbPreview, 'userdata', 0, 'string', 'Preview'); %set(handles.pbCreateSource, 'userdata', 0, 'string', 'CreateSource'); guidata(hObject, handles); return end % --- Executes on button press in pbPreview. function pbPreview_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if get(hObject, 'userdata') == 0, %preview is OFF
____________________________________________________________________Department of Electronics and Communication, SMIT.
55
preview(handles.vid); set(hObject, 'string', 'ClosePreview'); set(hObject, 'userdata', 1.0); guidata(hObject, handles); return else closepreview(handles.vid); set(hObject, 'string', 'Preview'); set(hObject, 'userdata', 0.0); guidata(hObject, handles); return end % --- Executes during object creation, after setting all properties. function figure1_CreateFcn(hObject, eventdata, handles) handles.vid = []; handles.source = []; guidata(hObject, handles); return % --- Executes on slider movement. function slBrightness_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; b = round(get(hObject, 'value')); set(handles.source, 'Brightness', b); set(handles.edBrightness, 'string', num2str(b)); return % --- Executes during object creation, after setting all properties. function slBrightness_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);
else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes upon editing. function edBrightness_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; b = round(str2num(get(hObject, 'string'))); set(handles.slBrightness, 'value', b); set(handles.src, 'Brightness', b); return % --- Executes during object creation, after setting all properties. function edBrightness_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else
____________________________________________________________________Department of Electronics and Communication, SMIT.
56
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % -------------------------------------------------------------------- function miGetSelectedSource_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; get(handles.source) return % -------------------------------------------------------------------- function menuInfo_Callback(hObject, eventdata, handles) function edContrast_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; c = round(str2num(get(hObject, 'string'))); set(handles.slContrast, 'value', c); set(handles.src, 'Contrast', c); return % --- Executes during object creation, after setting all properties. function edContrast_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function slContrast_Callback(hObject, eventdata, handles) % hObject handle to slContrast (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider if get(handles.pbVideoInput, 'userdata') == 0, return, end; c = round(get(hObject, 'value')); set(handles.source, 'Contrast', c); set(handles.edContrast, 'string', num2str(c)); return % --- Executes during object creation, after setting all properties. function slContrast_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else
____________________________________________________________________Department of Electronics and Communication, SMIT.
57
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in ppTriggerConfig. function ppTriggerConfig_Callback(hObject, eventdata, handles) % hObject handle to ppTriggerConfig (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns ppTriggerConfig contents as cell array % contents{get(hObject,'Value')} returns selected item from ppTriggerConfig if get(handles.pbVideoInput, 'userdata') == 0, return, end; selection = get(hObject, 'value'); config = triggerinfo(handles.vid); triggerconfig(handles.vid, config(selection)); % --- Executes during object creation, after setting all properties. function ppTriggerConfig_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in pbFramesAcquired. function pbFramesAcquired_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; frames = get(handles.vid, 'FramesAcquired'); s = sprintf('%s%g\n', 'Frames acquired: ', frames); disp(s); % -------------------------------------------------------------------- function miGetVideoInput_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; get(handles.vid) return function edFrameGrabInterval_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'FrameGrabInterval', str2num(get(hObject, 'string'))); guidata(hObject, handles); return % --- Executes during object creation, after setting all properties. function edFrameGrabInterval_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else
____________________________________________________________________Department of Electronics and Communication, SMIT.
58
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function edFramesPerTrigger_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'FramesPerTrigger', str2num(get(hObject, 'string'))); guidata(hObject, handles); return % --- Executes during object creation, after setting all properties. function edFramesPerTrigger_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function edTriggerRepeat_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'TriggerRepeat', str2num(get(hObject, 'string'))); guidata(hObject, handles); return % --- Executes during object creation, after setting all properties. function edTriggerRepeat_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in pbDefaultsAcquisition. function pbDefaultsAcquisition_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.edFrameGrabInterval, 'string', '1'); set(handles.vid, 'FrameGrabInterval', 1); set(handles.edFramesPerTrigger, 'string', '10'); set(handles.vid, 'FramesPerTrigger', 10); set(handles.edTriggerRepeat, 'string', '0'); set(handles.vid, 'TriggerRepeat', 0); set(handles.edTriggerFrameDelay, 'string', '0'); set(handles.vid, 'TriggerFrameDelay', 0); guidata(hObject, handles); return function edTriggerFrameDelay_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; set(handles.vid, 'TriggerFrameDelay', str2num(get(hObject, 'string'))); guidata(hObject, handles); return
____________________________________________________________________Department of Electronics and Communication, SMIT.
59
% --- Executes during object creation, after setting all properties. function edTriggerFrameDelay_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in pbSnapshot. function pbGetSnapshot_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; % video object absent if get(hObject, 'userdata') == 0, set(hObject, 'userdata', 1.0); s = getsnapshot(handles.vid); figure(1); imshow(s); set(hObject, 'userdata', 0.0); guidata(hObject, handles); return else return end return % --- Executes on button press in pbFramesAvailable. function pbFramesAvailable_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; frames = get(handles.vid, 'FramesAvailable'); s = sprintf('%s%g\n', '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;
____________________________________________________________________Department of Electronics and Communication, SMIT.
60
stop(handles.vid); return % % --- Executes on button press in pbImaqMontage. % function pbImaqMontage_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % % figure(2);% TO DO:: use the correct data structure to display... % % imaqmontage(handles.data); % return % --- Executes on button press in pbFlushData. function pbFlushData_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; flushdata(handles.vid); return % --- Executes on button press in pbImageDisplay. function pbImageDisplay_Callback(hObject, eventdata, handles) ImageDisplay return
% --- Executes on button press in pbGetData. function pbGetData_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if get(handles.vid, 'FramesAvailable') == 0, return, end; if get(handles.vid, 'TriggersExecuted') < 1, return, end; handles.data = []; T = get(handles.vid, 'TriggersExecuted'); for t=1:T, [handles.data{t}.frames, handles.data{t}.time, handles.data{t}.metadata] = getdata(handles.vid); end guidata(hObject, handles); return % --- Executes on button press in pbSave. function pbSave_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; if isempty(handles.data), return, end; tx = get(handles.edTransducerID, 'string'); d=handles.data; c = fix(clock); filename=sprintf('%s_%4d-%02d-%02d_%02d%02d%02d%s', tx, c(1), c(2), c(3), c(4), c(5), c(6), '.mat'); prompt={'Enter file name:'}; name='Save current data to a file'; numlines=1; defaultanswer= {filename}; filename2=''; filename2=inputdlg(prompt,name,numlines,defaultanswer); if isempty(filename2), return, end; save(filename2{1}, 'd'); return
____________________________________________________________________Department of Electronics and Communication, SMIT.
61
% --- Executes on editing. function edROIx_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % a = get(handles.vid, 'ROI'); % new = str2num(get(hObject, 'string')); % set(handles.vid, 'ROI', [new a(2) a(3) a(4)]); return; % --- Executes during object creation, after setting all properties. function edROIx_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on editing.
function edROIy_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % a = get(handles.vid, 'ROI'); % new = str2num(get(hObject, 'string')); % set(handles.vid, 'ROI', [a(1) new a(3) a(4)]); return; % --- Executes during object creation, after setting all properties. function edROIy_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on editing. function edROIwidth_Callback(hObject, eventdata, handles) % if get(handles.pbVideoInput, 'userdata') == 0, return, end; % a = get(handles.vid, 'ROI'); % new = str2num(get(hObject, 'string')); % set(handles.vid, 'ROI', [a(1) a(2) new a(4)]); return; % --- Executes during object creation, after setting all properties. function edROIwidth_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
____________________________________________________________________Department of Electronics and Communication, SMIT.
62
% --- Executes on editing. function edROIheight_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edROIheight_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in pbROIdefaults. function pbROIdefaults_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; a = get(handles.vid, 'videoresolution');
x = 0; y = 0; set(handles.vid, 'ROI', [x y a(1) a(2)]); set(handles.edROIx, 'string', num2str(x)); set(handles.edROIy, 'string', num2str(y)); set(handles.edROIwidth, 'string', num2str(a(1))); set(handles.edROIheight, 'string', num2str(a(2))); guidata(hObject, handles); return % --- Executes on button press in pbROIupdate. function pbROIupdate_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; a = zeros(1,4); a(1) = str2num(get(handles.edROIx, 'string')); a(2) = str2num(get(handles.edROIy, 'string')); a(3) = str2num(get(handles.edROIwidth, 'string')); a(4) = str2num(get(handles.edROIheight, 'string')); set(handles.vid, 'ROI', a); guidata(hObject, handles); return % --- Executes on editing. function edTransducerID_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edTransducerID_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in pbIsRunning. function pbIsRunning_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; s = isrunning(handles.vid);
____________________________________________________________________Department of Electronics and Communication, SMIT.
63
switch s case 0 disp(' Video object is NOT running'); case 1 disp(' Video object is running'); end return % --- Executes on button press in pbIsLogging. function pbIsLogging_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; s = islogging(handles.vid); switch s case 0 disp(' Video object is NOT logging'); case 1 disp(' Video object is logging'); end return % --- Executes on selection change in ppLoggingMode. function ppLoggingMode_Callback(hObject, eventdata, handles) if get(handles.pbVideoInput, 'userdata') == 0, return, end; index = get(hObject, 'value'); str = get(hObject, 'string'); sLoggingMode = str{index}; set(handles.vid, 'LoggingMode', sLoggingMode); guidata(hObject, handles); return % --- Executes on creation. function ppLoggingMode_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on editing. function edFps_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edFps_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in pushbutton25. function pushbutton25_Callback(hObject, eventdata, handles) close(gcf) % hObject handle to pushbutton25 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
____________________________________________________________________Department of Electronics and Communication, SMIT.
64
With the help of this program we have created a GUI for the video files from both the TV
and the camera. GUIDE tool used for creating GUI is set to composite mode by default.
By this program we change the composite mode to tuner mode.
Department of Electronics and Communication, SMIT
7.3 - AUDIO ACQUISITION BLOCK
Work space
MATLAB AUDIO
VIDEO
A/V
Fig – 7.3(a) Audio Acquisition Block
The audio input from a microphone is feed into the sound card, which is an analog to
digital converter. The output is a digitized audio. This digitized audio is then saved in
MATLAB workspace, where it is converted into audio wave. The sound card does not
access both the video and audio simultaneously. It accesses them separately with a
faction of time interval in between, which we cannot notice. So the video and audio are
merged together in a multiplexer, which together forms a transport stream, which in the
audio video output (A/V). This A/V then goes to the display device.
MIC Sound card
Software control
ADC Digitized
Audio
Audio Wave
MUX
T S
DEVICE
____________________________________________________________________Department of Electronics and Communication, SMIT.
65
7.4 - SIMULILNK MODEL FOR AUDIO ACQUISITION
Fig – 7.4(a):- Simulink Based Audio Acquisition Block
For audio acquisition we have designed the above model. The model consists of a audio
input block which takes audio inputs, a audio output block for producing audio output
and a “to web file” block which records and saves the audio data as a web file i.e. audio
file. The audio data taken from the audio input device goes to the audio output device
form where we can be heard and then to a “web file” block where it is recorded and saved
as a web file. The model can be modified by changing the parameters the blocks. The
parameters which can be changed are:
Audio input block parameters are:- Sample rate(Hz), Sample width(bits), Samples per
frame, Queue(seconds), Audio device, Data type.
Audio output block parameters are:- Queue duration(seconds), Initial output delay
(seconds) and Audio device.
To web file block parameters are:- File name, Sample width(bits) and Minimum number
of samples for each write to file.
____________________________________________________________________Department of Electronics and Communication, SMIT.
66
8. - TV TUNER CARD
____________________________________________________________________Department of Electronics and Communication, SMIT.
67
8.1 - THEORITICAL STUDY
The TV tuner card works on the basis of the following block diagram. The input data’s
are converted from analog to digital by the AD/C block, then they are multiplexed. This
data is then processed by the DSP and again converted back to analog by the DA/C block
and feed into the TV. And the digital data from the DSP block is also feed into the
computer monitor.
Fig – 8.1(a):- TV Tuner Block Diagram
A TV tuner card is a computer component that allows television signals to be received
by a computer. Most TV tuners also function as video capture cards, allowing them to
record television programs onto a hard disk.
Fig – 8.1(b):- TV Tuner Card
While typically a PCI-bus expansion card, they can also be a USB device. The card
contains a receiver, tuner, demodulator, and a analog-to-digital converter for analog
MULTIPLEXER ( MUX )
DIGITAL TO ANALOG
CONVERTER (DA/C)
DIGITAL SIGNAL
PROCESSOR ( DSP )
MONITOR
TV
DATA INPUT 1
DATA INPUT 2
ANALOG TO DIGITAL
CONVERTER (ADC ) - 1
ANALOG TO DIGITAL
CONVERTER (ADC ) - 2
____________________________________________________________________Department of Electronics and Communication, SMIT.
68
TV and DSP. Like TV sets, each version is designed for the radio frequencies and video
formats used in each country. Many newer TV tuners have Flash memory big enough to
hold the firmware for decoding several different video formats, making it possible to use
the tuner in many countries without having to flash the firmware. In addition to the
frequency tuner, many include a composite video input. Many TV tuners can function as
FM radios: this is because the FM radio spectrum lies between television channels 6 and
7, and the DSP can be easily programmed to decode FM. Some provide DVB reception
for digital radio, television or data signals (either with or without hardware MPEG
decoding capability); these may be used to receive satellite broadcasts but normally
provide no analogue input capability. Most internal tuners do all the low level
demodulation needed to convert a radio signal into an on-screen image using a hardware
DSP chip or ASIC; some also have hardware MPEG decoders and use DMA to bypass
the CPU entirely. Some cheaper tuners don't do much of the onboard signal processing
and rely on the system's CPU for that task. External tuners may convert the signal into
either a video stream suitable for display on the screen, or to an intermediate format such
as MPEG; in either case, the CPU is needed to direct the image onto the screen.
8.2 – PXELVIEW TV TUNER CARD:
We are using the Pixel View TV Tuner card with the chip Bt-787 , having the model no.
TCL2002MB-33F.
Fig-8.2(a):-PIXEL VIEW TV Tuner card
____________________________________________________________________Department of Electronics and Communication, SMIT.
78
9. - PROBLEMS
____________________________________________________________________Department of Electronics and Communication, SMIT.
79
PROBLEMS
• MATLAB and Simulink have very vast syllabus which is impossible to cover in
the given time period. We have downloaded some e-books like Getting Started
and Using Simulink from the Mathworks in the Internet. But the contents of these
books are vast and are hard to learn. It had numerous functions, which are
difficult to understand, and memorize.
• We had no working model as a whole, from where we could study the model’s
working and analyze it.
• Our plan was to use a comparatively cheaper card TV tuner card instead of TI
DM642EVM and to use it as efficiently as TI with the software which we have
planned to develop in MATLAB. At first we have selected TI to understand it’s
functionality so that we can develop our software. We had selected TI because
there was a Simulink block of the card in the MATLAB, but unfortunately we
could not access the source m-file of the card. We could change the parameters
but the source codes were inaccessible due to proprietor rights, so we could not
understand the functionality of the card as thoroughly as we had expected.
• The DM642EVM blockset is a block, which does not have any internal blocks or
sub-blocks. By double clicking on the block only some parameters can be set.
Even by going to the look under mask option in the DM642EVM block we got
nothing.. The block has no input or output in it. Due to all these reasons further
study of the properties and working of this block could not be possible. Thus
customizing the block was not possible.
• We had planned to use Pinacle TV Tuner card in our project, but Pinacle card was
also very costly so we have switched to Pixel View card. The Pinacle card was Rs
2800/-. And more over there was no theory available on the Pinacle TV Tuner
____________________________________________________________________Department of Electronics and Communication, SMIT.
80
card; from which we could study its properties and working. So due to the high
cost factor and non-availability of any theory the Pinacle card was rejected.
Finally we bought the Pixel View TV Tuner card, which costs only Rs 1400/-.
• When we developed the model in Simulink and tried it with the avi-files already
fetched in the MATLAB, with this model we could read and write a video and
audio and could also insert text. The apparent problem with this model was that
there was no proper video streaming and so there was lag between the video and
the audio. When we used camera as the video source still we could do it. But
when we were trying to get the real-time output from the TV antenna, we could
not get an output because the antenna input source is in tuner mode, and winvideo
adapter by default selects the composite mode. So we have to change the source
code (m-file) of the image acquisition blockset of simulink. But unfortunately the
source m-file of the block was in .dll format so was inaccessible to us, so
ultimately at the cost of time and effort we had to switch over to simple m-file
programming.
• When we used Digital Camera as the video source, then also we could see the
video images in MATLAB, as the Digital Camera also works in the composite
mode. But when we tried to view TV channels in MATLAB we got no output,
because the antenna input source is in tuner mode. So the default video mode i.e.
the composite mode has to be changed to the”tuner mode”. With lot of efforts we
have developed a program with which we could change the composite mode to
the tuner mode, so that both the video modes can be selected as per the choice.
• We could also access the video object and modify its properties like contrast,
brightness, hue, etc. but the problem with this program was that though it cost our
hard labor and time, it seemed too simple to a lame man and also it was not so
user friendly.
• Another problem was the streaming problem. When we were using Digital
Camera as the video source, video images had a big lag in them. The video
____________________________________________________________________Department of Electronics and Communication, SMIT.
81
paused in between and started to play again. This was due to lack of video
streaming. As known to us the video signal travel in frames, an entire frame is
first written in the memory and then is read out from it. This process takes a lot of
time. But when streaming is done this video frame is broken down into many
small sub-frames. These sub-frames are then written in the memory and read out
from it. Since the sub-frames size is very small hence this process takes very less
time. When we use the TV Tuner card there this video streaming is done, so we
do not get any lag in the video signal.
• As we finally approached GUI during the course we had to face a specific type of
problem, i.e. though we knew the concept behind programming i.e. what to do
and what not to, what to change and where to change, but we did not know the
syntax so we could not write the program. Though the basic image acquisition
concept remains the same, the basic m-file writing format and syntax changes
drastically from command window m-file to Simulink model to a GUI. But finally
with lot of effort we have developed a program.
____________________________________________________________________Department of Electronics and Communication, SMIT.
82
10. – RESULT
____________________________________________________________________Department of Electronics and Communication, SMIT.
83
10.1 - RESULT OBTAINED
After developing and running the program, we get the following result. The GUI is
created, through which both the video files from the TV as well as from the camera is
viewed in the MATLAB.
Fig – 10.1(a):-Result
The GUI helps in:
• Creating the video object,
• Previewing and snap shooting,
• Controlling frame grabber parameters,
____________________________________________________________________Department of Electronics and Communication, SMIT.
84
The session starts by pressing the 'Videoinput' pushbutton to create the video object. The
application sends its messages to the MATLAB environment. The Videoinput is pressed
then the user has to wait until the label changes to: 'Delete Videoinput’. Preview is
pressed to see the video stream from the camera or TV, until the label changes to: 'Close
Preview'. Until the video data are acquired none except the close button will work. When
the user presses FramesAcquired, FramesAvailable, IsRunning, IsLogging - all the
answers appear in the Matlab environment. START is pressed to begin the acquisition
begins with default parameters i.e. FramesPerTrigger=10, etc
GetData is pressed to get the acquired data from the video object. Save is pressed to save
the data’s
Image Acquisition:
All the parameters like:
• FrameGrabInterval (take a frame every X frames),
• FramesPerTrigger,
• TriggerRepeat
• TriggerFrameDelay (number of frames to skip after trigger).
When video object is created it always has the defaults values, regardless of what is
written in the edit fields.
Video Source:
From this pannel user can control Brightness, Contrast and resolution .
Function:
• START - make the video object running (ready for logging upon trigger)
• Trigger - useful at manual trigger only, begins logging.
• STOP - stop the video object from running.
• GetData - brings acquired data from video object to the MATLAB environment.
User cannot save data unless he pressed it before.
____________________________________________________________________Department of Electronics and Communication, SMIT.
85
• Save - save the acquired data to a file. User can change the suggested file name as
user like.
• ImageDisplay - launch an independent GUI to display images of the unique
structure produced by CAMERACOMPOSITEANDTVTUNER.
Trigger:
• Immediate - begin logging immediately after user press's START.
• Manual - begin logging after user press's TRIGGER.
Logging:
LoggingMode - 'memory' (producing data structure that will be saved by SAVE),
'disk&memory' (creating also an avi file) or 'disk'.
MENU:
On the menu bar user has 'Trigger' and 'Info' to display the status of the video object,
video source and trigger info. If user's window is docked into the MATLAB window, the
menus will join the MATLAB menu bar on top of the window.
____________________________________________________________________Department of Electronics and Communication, SMIT.
86
10.2 - THE GUI CREATED
Fig – 10.2(a):- GUI Created
____________________________________________________________________Department of Electronics and Communication, SMIT.
87
10.3 - RESULT OBTAINED FROM THE TV
Fig – 10.3(a):-Result Obtained From TV
____________________________________________________________________Department of Electronics and Communication, SMIT.
89
CONCLUSION
I. MATLAB: though MATLAB is a very vast knowledge base, difficult and
time taking to learn, it is a versatile tool. It is so huge that it may be seem to
be a little bit confusing but it has options for the very basics too much
sophisticated designing tools.
Our experience working with MATLAB was not so easy at the beginning, but
as time passed and we worked with MATLAB, we became accustomed to it.
It is a software which can give both low level and high level access to a
problem. The same problem can be approached in different ways by using
different tools, according to the desired output and the nature of the problem.
We used all the three major tools: MATLAB m-file programming, Simulink
for model of approach and Guide for GUIs. In MATLAB we could
customaries our project in both low and high level and in a very simple as
well as complex manner. MATLAB takes some time to be accustomed with,
but when one gets used to it MATLAB is a great help.
II. MULTIMEDIA ACQUISITION: it is a very vast subject. In a TV Tuner
card video and audio are accused and processed separately, and then they are
combined to produce what we see on the screen. Since it is a very recent topic
(mobile TV), we have got very little reference from books and from the
Internet. We had to work and think hard within a comparatively short time
span, we have till now accused and processed video and audio with some
processing, but creating an audio-video output are still to be worked upon.
But since we have turned our project in MATLAB, we have kept the door open for
others to contribute to the subject in future.
____________________________________________________________________Department of Electronics and Communication, SMIT.
90
Since the topic mobile TV is very new and commercially very important at this
moment if we could have developed it as per the requirements it would have been
bought by high-end electronics companies like Siemens and Nokia, the very day we
had finished our project.
____________________________________________________________________Department of Electronics and Communication, SMIT.
91
DISCUSSION
In this project Real- Time Multimedia Signal Processing Using MATLAB, we have tried
to view the video images from both the TV and Digital Camera. We have even created a
GUI for the video images using the GUIDE tool in MATLAB. We have completed our
project of video and audio acquisition with some processing. But due to comparatively
short time we could not develop the transport stream i.e. the audio-video output. This can
lead to further research work in completing the audio and merging. This project work can
be expanded further in future for developing many more new features. All the problems
that we have face during the course of our project work are mentioned above. Since the
this work is carried out in MATLAB, which is an easy to approach and open source
language, so anyone can further expand it.
The main problem we faced was a comparatively slow system. MATLAB requires a
minimum of 256MB RAM, i.e. the minimum requirement. To run a high-end model or
programme in MATLAB on average it takes 150MB of RAM, which is quite high.
Moreover functions like data acquisition and sound acquisition themselves require much
of memory (i.e. RAM), so to do this project one requires a minimum of Pentium 4
processor and a RAM of 512MB. Otherwise may be there will be some data lose like no
color, video streaming problem, lag between audio and video.
Our composite i.e. data from the camera was not so good i.e. it was colorless. Though the
programming part was a basic MATLAB function i.e. to select the RGB format, so there
is no problem with the programming part. From this we can understand there is lose of
data (color), due to some reasons like:
1. Slow system, i.e. 256MB RAM of memory is not sufficient.
2. Some interfacing problem in between the camera and the TV tuner card, or
TV tuner card and MATLAB.
3. MATLAB basically reconstructs the video in its input, may be there is some
problem in reconstructing.
We hope future programmer will pay heed to these limitations.
top related