联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2018-12-07 10:47

ENG 06 Fall 2018 Final Project

Up to now in ENG6, we have focused on teaching you the “how” of programming. In the team

project you will be taking your own ideas and bringing them to fruition through your knowledge of

computer programming. Software development is rarely a one-person effort, so the project will

be team-based. Teams can be formed with members of any section. You can form your own team

of three. No other team size will be allowed. Only if strictly needed, the TAs may form smaller

teams or add members to teams. Beyond the core part of the final project, we ask you to

implement a number of special features, called Reach elements, so as to make your project

different from your classmates.

You will be able to choose between three different implementations.

Project 1: Electronic Data Acquisition and Processing using Matlab.

In this project you will be using an Arduino Uno microprocessor to acquire analog signals from a

sensor. You have the freedom to choose the variable to be measured, however, a few possibilities

are:

Temperature using a thermistor

Light using a photocell

Acceleration using a gyroscope

Magnetic field using a Magnetometer

A sensor measuring more than one of the above variables!

Please keep in mind that since this is not a hardware electronics class, your grade will be based

mostly on the originality of the Graphical User Interface (GUI) implementation, data processing

and presentation. It will be your responsibility to acquire the microprocessor and associated

electronics (sensors, resistors, etc.). However, today an Arduino (for example) can be acquired

for less than $17 and the cost of the sensing electronics is a few dollars as well but you are not

confined to use an Arduino. What is important in this project is how you process and display

the data using Matlab.

Core Requirements: All projects should have a graphical user interface with the following

capabilities:

1. A frame with a graph displaying the sensed signal in quasi real time. If you wish you can

display more than one signal at a time.

2. A button to record a signal over a predetermined time interval.

3. A button to display the recorded signal either on a separate frame or on the one used for real

time display.

4. An indicator on the control panel, coupled to an LED in the data acquisition board, that are

ON while the data is being sampled.

5. Clearly indicate in your code and your video where these elements are implemented.

In your YouTube video, please point out how you implemented some features

(especially in the Core and the Special Features) inside your code. What functions did

you use? Did you use any data structures such as structs etc.? What was challenging

about implementing a certain feature and why?

Special Features: A significant component of the project grade will depend on the special

features your group decides to implement. The main goal of this portion of the project is for you

to show your data processing skills. You can choose the special features you decide to

implement, however, a few examples are:

Signal noise removal based on taking the average of a predetermined number of data sets

followed by the display of the raw and averaged data on the GUI panel.

Finding and displaying signal statistics such as mean, standard deviation, peak amplitude

of a signal, etc.

Horizontal and/or vertical cursors controlled by sliders that indicate the x or y coordinate

of the cursor. Even better, more than one cursors to show the x or y-coordinate difference

between the two. This can be used, for example, to indicate the width of a pulse signal

(FWHM) or a 10-90 raise/ fall times.

Signal reversal, slow or fast motion, signal arithmetic (addition, subtraction) between

multiple signals.

Your own ideas….!

Appendix: Useful information in case you have selected an Arduino.

In order to be able to send and receive analog and digital data to the Arduino it is necessary to

install the MATLAB support package for Arduino.

Instructions for the installation can be found on:

https://www.mathworks.com/help/supportpkg/arduinoio/ug/intro.htm

You can check if the support package was installed correctly if you enter:

>>help writeDigitalPin

--- help for arduino/writeDigitalPin ---

Write digital pin value to Arduino hardware.

Syntax:

writeDigitalPin(a,pin,value)

Description:

Writes specified value to the specified pin on the Arduino hardware.

Example:

a = arduino();

writeDigitalPin(a,'D13',1);

Input Arguments:

a - Arduino hardware

pin - Digital pin number on the Arduino hardware (character vector or string)

value - Digital value (0, 1) or (true, false) to write to the specified pin (double).

See also readDigitalPin, writePWMVoltage, writePWMDutyCycle

A few examples on basic connections to the Arduino can be found on:

https://www.mathworks.com/help/supportpkg/arduinoio/ug/getting-started-with-matlabsupport-package-for-arduino-hardware.html

Instructions to find the Arduino port can be found on:

https://www.mathworks.com/help/supportpkg/arduinoio/ug/find-arduino-port-onwindows-mac-and-linux.html

The following link provides a straightforward way on how to improve the accuracy of

Arduino signals measured as a function of time.

https://www.mathworks.com/videos/log-temperature-data-from-arduino-into-matlab-

1489428648919.html

Project 2: Card Game

Project Description: Implement a MATLAB computer program of card game of your team’s

choice. The game may have rules of your creation. The card game must involve one or two

players. A player should be able to make strategic decisions to win the game. The program

should draw cards upon request, apply the rules and score the game. Each team makes

decisions what programming elements will engage the users. Special attention should be paid

to:

1. Clarity on how to play the game.

2. How the persons should interact with the program.

3. The visual, auditory cues and special effects (e.g. animations, a sound clip when the cards

are drawn, etc.). You are allowed to us simple pictorial representations for each card, for

example a King of hearts card with a large K and a heart, etc.

The implementation of a card game should be two players using the same keyboard or mouse

to play their turn. All projects should have following elements:

1. A graphical user interface.

2. An animation.

3. A sound effect.

4. Make use of user-defined OOP class in at least one programming element.

5. Clearly indicate in your code and your video where these elements are implemented.

In your YouTube video, please point out how you implemented some features

(especially in the Core and the Reach) inside your code. What functions did you use?

Did you use any data structures such as structs etc? What was challenging about

implementing a certain feature and why?

Appendix

MATLAB supporting files - zipped directory

Resources:

Controlling Random Number Generation (Links to an external site.).

Play Audio (Links to an external site.)

MathSoft Guide (Links to an external site.)

Project 3: Video Processing

Introduction

Signal processing is a common task that is performed in MATLAB due to its great ability to deal

with and manipulate large sets of data. Signals can come in a variety of types - continuous,

discrete, 1D, 2D, and even 3D! For 2D signals (i.e. images and videos), we can use matrices to

represent the color information present in each pixel of an image. This is done by stacking three

regular 2D arrays, where each array is shows the R,G, or B saturated color intensity. By

combining the individual color matrices, we arrive at the final composed image. Similarly, a video

feed consists of a stack of these images, and when played back at a certain framerate (the number

of frames per second to show the viewer), we can visually observe smooth video playback.

An overview of the project requirements is next and a complete list of requirements is presented

below. The core of this project consists of designing a simple video player implemented in a

MATLAB constructed GUI. The player basic video player must be designed so that the user can

select any valid (and supported) video file to playback. To play the video, your GUI must have

the standard array of buttons found on typical digital media players (play/pause, stop, stepforward,

step-reverse). Your GUI must also include a scroll bar that (in real-time) scrolls while

the video is playing.

In addition to the base video playback function, your GUI must contain 2 special features that

enhance the capabilities of the project. The special features can be decided by your team and

they do not have to relate to each other. For example, you can choose to enable sound playback

on your GUI by including a functional “mute” button. You can also choose to analyze each frame

of the video and compute the number of saturated red, green, or blue pixels in the image. Such

information will of course be valuable to a film maker.

An example GUI with two special features is shown later in this document. Note that this GUI has

all of the fundamental features that are required for the core of this project. Moreover, this GUI

also has two notable “special” features - one that shows a live histogram of the RGB elements of

each frame, and another that shows a sharpened version of the original video stream by using a

sharpening filter.

Requirements for the Project Core

1. Your GUI must have a button that will allow the user to load any valid video file for

playback. Note that you must be able to load videos outside of the working folder in

MATLAB. One required file format is (.mp4) but you are free to add others if you so desire.

2. Upon successful loading of a video file, you must show the following bits of information

about your video stream:

a. The name of the video file (e.g. test.mp4).

b. The resolution of the video file (e.g. 1920x1080).

c. The framerate of the video file (e.g. 25fps).

d. The total duration of the video file (e.g. 1h 14m 08s).

If there is an issue loading the video file, then an error must be displayed in the form of a

message box to the user.

3. Once the video file is loaded and the required bits of information are displayed to the user,

the video should not start playing on its own. To play the video, the user will be required

to hit one of the appropriate play button options. The following buttons are required for

the core of this project and must be implemented with the exact functionality mentioned

below.

a. Play/Pause button. This button should be able to play and pause the video at any

point! If Play is pressed after the video has been stopped, then the video will be

played back from the first frame. However, if Play is pressed after the video has

been paused, then the video will continue playing from that frame. In addition, the

text or graphic of the Play/Pause button must change appropriately from “Play” to

“Pause” and vice-versa depending on the current available transition of that button.

For example, if the video is currently paused, then the Play/Pause button must

show “Play”.

b. Stop button. This button will stop the video stream. If the video is currently stopped

then the text for the Play/Pause button must show “Play”. When the Play button

is pressed, the video must play back from the first frame!

c. Step-Forward button. This button pauses the video stream and advances to the

next frame. Note that this causes the Play/Pause button to show “Play” since that

is the appropriate available action for the Play/Pause button. If this button is

pressed at the last frame of the video, then nothing should happen!

d. Stop-Back button. This button pauses the video stream and steps back one frame.

If this button is pressed at the first frame, then nothing should happen!

4. It’s quite boring to have the video stream controllable solely from a few buttons, so it makes

sense to include a more interactive way of “searching” through a video stream using a

Scroll Bar. Some requirements for the scroll bar:

a. The Scroll Bar must be working in real-time and must move as the video file is

played. If the video is paused, then the scroll bar must stop moving and remain

fixed in place. Similarly, if the video is stopped, then the scroll bar must relocate

to the beginning.

b. If the Scroll Bar is moved (regardless of the video being played back, paused, or

stopped) the video stream must pause and advance to show the proper frame. In

addition, the Play/Pause button will show “Play” as the next available state. Note

that the video screen must show the current paused frame as selected by the Scroll

Bar. Lastly, all of your “special” features must update along with the movement of

the Scroll Bar (if applicable).

5. Your GUI must obviously have a video playback screen. If a video file with an extremely

large or small resolution is loaded, then your GUI must be able to resize the video’s

dimensions to fit the screen in the GUI. Note that this resizing may cause some aliasing

in certain video files. You are free, though not required, to alleviate this issue by adding

a basic “anti-aliasing filter” as a special feature.

6. The core GUI must be designed only to playback the video portion of a video file, no sound

is required. In addition, you must try to playback the video at the intended framerate in

the video file.

Requirements for the Special Features

Your program is required to have at least two special features. Once again, these special features

are for you to increase the feature set of your program. You may choose any two special features

from this list but you are also encouraged to come up with a new idea! If you do wish to propose

your own feature(s), be sure to obtain approval from Saneel (snkhatri@ucdavis.edu) before you

write any code for the feature you wish to implement.

Keep in mind that some special features are much more difficult to implement than others, but

those more difficult to implement will of course do much more interesting operations to the video

stream. As an added bonus, attempting to implement a difficult special feature may earn you

between 10-15% extra credit for the project grade. Again, you are free to propose your own

complex special feature or you can choose one from the list below (marked with ***).

1. Real-time RGB Histogram - implement a histogram that shows the color content of each

frame. This should be a single figure with three colored plots showing the pixel count vs

intensity for each of the red, green, and blue color channels. An example of this feature

can be found in example GUI shown below. From this information, you should be able to

detect and display when a particular frame is over-saturated (i.e. consists of a lot of 255’s

for uint8).

2. Color/Saturation Correction - You can implement a series of small slider to apply small

gains to the RGB pixels to change the color of the image. If you do choose to implement

this, your sliders should work in real-time.

3. Filtering*** - You can implement any of the filters below or propose an entirely new filter!

a. Anti-Aliasing Filter - this filter removes sharp “pixelated” edges in images by

averaging neighboring pixels.

b. Sharpening Filter - this filter performs element-by-element multiplication with a

small matrix (known as a kernel) to highlight and sharpen the image.

c. Smoothing Filter - this filter does the exact opposite of the sharpening filter to

smooth out overly-sharp images.

Note that if you choose to implement a filter, you will be required to construct your own

filtering algorithm, not one already available within MATLAB.

4. Frame-Rate Conversion*** - This would involve implementing your own 2D interpolator to

mix sequential frames together. The idea behind this is to create new frames to

“upsample” the video stream. Suppose you had a 10fps video stream of a bouncing ball,

clearly the animation would be extremely choppy as you would only see about 10

snapshots of the ball every second. Since most humans consider video playback to be

smooth upwards of 30fps, your goal would be two create and inject two new “artificial”

frames between a pair of “real” frames to make the video appear smoother (thus

converting the framerate from 10fps to 30fps). If you choose this feature, be sure to pick

a starting framerate and convert only to 30fps. A couple of viable options would be:

a. 15fps to 30fps.

b. 20fps to 30fps.

c. 24fps to 30fps (Known as 3:2 pulldown in the film industry).

5. Sound Playback - Add the ability to have sound playback within your GUI (this would be

the sound in the video file). If you choose to look into the possibility of adding sound

playback, make sure that the sound playback behaves appropriately to the core GUI

(Play/Pause button, Stop button, etc). You must also include a “Mute” button on your GUI.

6. Video Stabilization*** - Essentially creating a way to remove the “shaking” that is present

when people record video without a tripod or without digital/optical image stabilization on

the video camera. This would involve looking at multiple frames and computing several

points of interest between those frames to determine how much change there is between

one frame and another. Note that if you choose this feature, you must provide a video

stream that clearly shows that your algorithm “anti-shakes” the original.

7. Video Compression - Take the original video file and compress the video stream to reduce

the overall filesize. This is commonly done for mobile applications, so there is still a lot of

work going into this technology. So, you will have to come up with a smart way of

compressing the data (elements in each RGB array) so that there is less information that

is contained in each frame. For this task you should aim to compress in real-time instead

of writing the compressed frames to a new video file. You can do this by simply adding a

push-button that enables and disables compression to show the user the artifacting

introduced by compression.

Sample GUI

This is an example of the GUI you will be making. The core components of the base GUI are

shown to the left of the “Disable RGB View” and “Disable Filtering” buttons. As you can see, the

“Load” button allows the user to select a video file. Once a proper file has been selected, the File,

Resolution, Framerate, and Total Duration fields will automatically update. The two figures on

the right are the two special features chosen for this implementation. By default, the GUI starts

with both features enables (and thus both are visible). Clicking on the “Disable RGB VIew” and

“Disable Filtering” buttons disables the respective features, hides the associated figures and data,

and finally changes the text of the button to read “Enable RGB View” and “Enable Filtering”.

The image above shows the program in action with a live view of the video being played back

along with the two special features. The two special features work in real-time with the video

stream and even respond properly to the movements in the Scroll Bar as mentioned earlier in the

project description.

Project Deadlines:

Deadline #1: Friday, November 16, 5:00 pm: A team member must submit your team names to

a Google Docs Form. We will post a Canvas announcement once the form is ready for

submissions. Only one team member should do this!

Deadline #2: Tuesday, November 20, 5:00 pm: Submit proposal.

Deadline #3: Friday, December 7, 5:00 pm: Each team will submit all relevant coding files, a link

to Youtube video and team evaluation materials. Each team will submit a zip file of all the code,

the zip file will have all .m files, all .img files and any other files that are needed for the game to

run. The zip file should also contain a .pdf file of the code, as well as a PDF of the team evaluation

document. The link of the Youtube should be accessible to all those who use the link.

Collaboration Policy: Once teams are formed you are only allowed to talk and collaborate with

members within your team. Team members are expected to equally participate, and

collaboratively work towards the completion of the project. Other than contacting the teaching

assistants for clarification, you may not seek the assistance of other persons to complete your

team's project. (Of course, general discussions about how to implement GUI, OOP and other

programming constructs could be discussed with other students, but your team must be totally

responsible for the implementation of code used in your project).

Grading Criteria: The projects are open ended. As long as your program can perform the

assigned tasks, there will be no correct or incorrect approaches. Certainly there will be more

acceptable and attractive solutions, and that will be judged in comparison with competing

solutions submitted by your classmates. The final project will be graded in five parts:

1. Project proposal: Each team submits a 2-3 page via Canvas a project proposal describing

the project they have selected, a general description of how you will implement the main

components of your project and a clear description of the Reach features that your team

proposes. Essentially, the scope of the project should be challenging enough to merit full

credit and doable within the timeline. An Appendix should contain a breakdown of

programming tasks, and who will be responsible for what, along with a timeline that will meet

the submission deadline (suggest you make use of a Gannt chart (Links to an external site.)

.. The expectation is that each team member must take responsibility for a specific aspect of

the project and grading for each member will be adjusted according to how the project tasks

were delegated and who was responsible for what aspects of the project. The more specific

you can be in defining the programming tasks, what functions should exist, and what each

function should accomplish, the better. For the data acquisition project using Arduino it is not

allowed to have a team member working solely on the electronic implementation, i.e. all team

members must have MATLAB coding responsibilities.

2. Core: Complete the basic project as outlined in the project specification.

3. Special Features: Implement the project extensions described in your proposal. Your

completion of the Core and the difficulty of your proposal will be taken into account during the

grading process.

4. Youtube Video Requirements: Youtube has several examples of ENG6 videos (search

ENG6). The format of the video is entirely up to your team as long as the following criteria are

met:

1. Maximum length of the video is 10 minutes

2. Each team member must be seen in the video to present their work and contributions

3. A clear and easy to follow demonstration that shows the correct functionality of your

program (show your program actually working in the video – not screen shots of before

and after.)

4. Use visual aides to help explain your steps (whiteboard, markers, poster, etc.). The

video does not have to be fancy, just effective in relaying the most important

information.

5. Team Evaluations: Each member must provide a brief personal summary of her/his

involvement and contributions. Each team member is required to submit evaluations of your

and your teammates’ contribution, one for each of Core and Reach. For example, if your team

has members A, B, C, your evaluation can be similar to the following for a single member. An

example is shown below.

Team Member A: was in charge of writing the code to execute the equalizer filters. For the Reach,

A was in charge of adding 2 different analysis plots that could show power spectral density plot

and frequency content of audio file. Team Members B, C agree that A performed these tasks for

the project.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp