Write a function called blur that blurs the input image

Assignment Help Programming Languages
Reference no: EM132345169

1st program -Character encoding using ASCII values rotation w.r.t to certain range

2nd program - Image blur problem

3rd program - Echo generation in audio file

In every text file, Mentioned errors for certain inputs-Please make the program to work for such inputs.

If required, please change the program,

Requirement is given as questions in the file.

Echo Generator
Write a function called echo_gen that adds an echo effect to an audio recording. The function is to be called like this:

output = echo_gen(input, fs, delay, amp);

where input is a column vector with values between -1 and 1 representing a time series of digitized sound data. The input argument fs is the sampling rate. The sampling rate specifies how many samples we have in the data each second. For example, an audio CD uses 44,100 samples per second. The input argument delay represent the delay of the echo in seconds. That is, the echo should start after delay seconds have passed from the start of the audio signal. Finally, amp specifies the amplification of the echo which normally should be a value less than 1, since the echo is typically not as loud as the original signal.

The output of the function is a column vector containing the original sound with the echo superimposed. The output vector will be longer than the input vector if the delay is not zero (round to the nearest number of points needed to get the delay, as opposed to floor or ceil). A sound recording has values between -1 and 1, so if the echo causes some values to be outside of this range, you will need to normalize the entire vector, so that all values adhere to this requirement.

MATLAB has several sample audio files included that you can try: splat, gong, and handel are a few examples. Try the following:

load gong % loads two variables, y and Fs
sound(y, Fs) % Outputs sound

To hear the sound you will need to use desktop MATLAB or MATLAB Online.
(Note that we are assuming mono audiofiles. You can load your own audio files using the audioread function in MATLAB. If the audio data has two columns, it is a stereo file, so use only one column of the data when testing your file.)

errors

%Variable output has an incorrect value.
%Tested with the vector [-0.5; 0; 0.5; 0] and the following parameters: fs = 1, delay: 0.0 seconds, amp = 0.5
% Assessment result: incorrectUsing splat sound file
%Variable output has an incorrect value.
%Tested with the splat file and the following parameters: fs = 8192, delay: 0.2 seconds, amp = 0.2

Image blur
Write a function called blur that blurs the input image. The function is to be called like this:
output = blur(img,w);

where img, the input image is a two-dimensional matrix of grayscale pixel values between 0 and 255. Blurring is to be carried out by averaging the pixel values in the vicinity of every pixel. Specifically, the output pixel value is the mean of the pixels in a square submatrix of size 2w+1 where the given pixel sits in the center. For example, if w is 1, then we use a 3x3 matrix, that is, we average all the neighboring pixels of the given pixel and itself. Only use valid pixels when portions of the blurring matrix fall outside the image. For example, the blurred value corresponding to w = 1 at index (1,1) would be the mean of of elements (1,1), (1, 2), (2,1) and (2, 2). Both input img and output output are of type uint8.

You can download the test image here (refer vandy.png downloaded file) to use in MATLAB.

Errors

Simple test:(error)
Variable output has an incorrect value.
Tested with a 5x5 uint8 matrix with all 255-s in the first and last rows and columns and zeros everywhere else and w = 1

Assessment result: (error)
incorrect Using image file
Variable output has an incorrect value.
Tested with the vandy.png file and w = 1

Simple Encryption

Simple Encryption
Caesar's cypher is the simplest encryption algorithm. It adds a fixed value to the ASCII (unicode) value of each character of a text. In other words, it shifts the characters. Decrypting a text is simply shifting it back by the same amount, that is, it substract the same value from the characters. Write a function called caesar that accepts two arguments: the first is the character vector to be encrypted, while the second is the shift amount. The function returns the output argument coded, the encrypted text. The function needs to work with all the visible ASCII characters from space to ~. The ASCII codes of these are 32 through 126. If the shifted code goes outside of this range, it should wrap around. For example, if we shift ~ by 1, the result should be space. If we shift space by -1, the result should be ~. Here are a few things you may want to try with MATLAB before starting on this assignment:

Errors for the following

caesar(' !"#tiny_mce_markeramp;()*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~',243)

caesar('MATLAB is fun!',-122)

caesar('x = mean(1:90) + sum(rand(1,23)');',81)

caesar('MOOC-s are very useful',-104)

Attachment:- Program Assignment.rar

Reference no: EM132345169

Questions Cloud

Imperative precision and value to improve : Mission - "University Hospital will provide healthcare with imperative precision and value to improve the lives of our patients."
Describe the statement is fact or fiction : In this discussion you will conduct internet research in an attempt to determine whether or not the following statement is fact or fiction.
Describe the overall financial course : In five hundred words, describe the overall financial course (credit cards; checking accounts; credit scores and reports; savings) you have completed
Discuss about the accounting for a business combination : What is the primary difference between: accounting for a business combination when the subsidiary is dissolved; and accounting for a business combination.
Write a function called blur that blurs the input image : Write a function called echo_gen that adds an echo effect to an audio recording and Write a function called blur that blurs the input image
Identify five gaps in the performance data : Analyse the data in the case study. Identify five gaps in the performance data given, which could be filled by introducing more performance measurements (KPIs).
Determine the exact value of pressure gradient : ENG513 Numerical and Computational Methods in Petroleum Engineering Assignment, University of Portsmouth, UK. Determine the exact value of pressure gradient
Samples of qualitative research interviews questions : Samples of qualitative research interviews questions with relevance to Electronic Health Records and their impact on physicians efficiency and positive patient
Do you agree with the opinion below : Do you agree with the opinion below? Why, or why not. What is your thought?

Reviews

len2345169

7/24/2019 9:56:29 PM

1st program -Character encoding using ASCII values rotation w.r.t to certain range 2nd program - Image blur problem 3rd program - Echo generation in audio file In every text file, I have mentioned errors for certain inputs-Please make the program to work for such inputs. If required, please change the program, Requirement is given as questions in the file. solution should be shared as word doc

Write a Review

Programming Languages Questions & Answers

  Prepare a scada program for the given flowchar

This is a flowchart I need a scada program that monitors a traffic road - Prepare a scada program for the given flowchar.

  Main( ) function that instantiates one average object

Main( ) function that instantiates one Average object, and includes a for loop to take 10 inputs and calls to the calculation and output method.

  Implement a menu-driven program for a hardware store

Perform a sales transaction - allow several hardware items to be purchased Remove a sales transaction based on invoice number and Edit a sales transaction by changing the hardware item's barcode and/or quantity purchased

  Why are repetition structures important to programming

What is the difference in these statements; how do you create nested loops, and why are repetition structures important to programming?

  Extend the user management

Extend the user management so that user can be stored in database - user can be administrator and he can access that admin page

  Write a menu driven program that accepts words

Write a menu driven program that either accepts words and their meanings, or displays the list of words in lexicographical order (i.e. as in a dictionary).

  Find largest number in array

Find the largest number in the array and output the result. use a subprogram to input the numbers, a function to use the largest number.

  Write a program to display the duplicate values in an array

Write a program to display the duplicate values in an array.

  Create a class named game that contains a string

Create a class named Game that contains a string with the name of the Game and an integer that holds the maximum number of players. Include properties with get and set accessors for each field.

  Which quality control method should the manager adopt. why

Type I error probability is defined as the conditional probability of rejecting a good lot. Type II error probability is defined as the conditional probability of accepting a poor quality lot.

  Write program to perform linear regression between data sets

Write a program to perform linear regression between two data sets. The code should return the slope and y-intercept for the best-fit line through the data.

  Explain multiprogrammed system available in user mode

CPU voltage and frequency or put it to sleep altogether. In a multiprogrammed system should this functionality be available in user mode or only accessible via system call. why or why not?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd