Free Essay

Scalar Quantization

In:

Submitted By saisurya1364
Words 630
Pages 3
-------------------------------------------------
EE 5351 Digital Video Coding Project #4 1001112760 Sai Surya Chintala

1 a)
Code: - clc; % Clears screen clear all; % Clears all variables from memory close all; % Closes all running figures and plots datafile='C:\Users\Venkata\Desktop\images\sena.img'; % File location of image image=fopen(datafile); % Open image as file senaimage=fread(image); % Read image from location specified senaimage2=imrotate(senaimage,270); % Rotates images by 270' fclose(image); % Closes image hist(senaimage2,1000); % Makes histogram of the rotated image

Result:

1 b)

Code: clc; %Clears screen clear all; % Clears all variables close all; % Closes all exiting graphs and plots datafile='C:\Users\Venkata\Desktop\images\sena.img'; % File location image= fopen(datafile); % Opens image file senaimage = fread(image); % Reads image to image bp= input('Enter no of bits/pixel:'); % Taking input for no of bits/pixel n = 2^bp; m = 256/n;
A(1) = 0 ;
B(1) =A(1)+ (m-1); for i=2:n % for loop A(i)=B(i-1)+1; B(i)=A(i)+ (m-1); end senaimage2 = uint8(senaimage); for i = 1:n % for loop for j=1:65536 if(senaimage2(j) >= A(i) && senaimage2(j) <= B(i)) % Checking condition senaimage3(j) = (A(i)+B(i)+1)/2; end end end senaimage4 = reshape(senaimage,256,256); % Reshaping image senaimage5 = reshape(senaimage3,256,256); % Rehsaping image
MSE = sum(sum((senaimage4-senaimage5).^2))/(256*256) % Calculating Mean Square error imshow(uint8(senaimage5')); % Shows the ouput image file fclose(image); %Closes file

For 1 bit/pixel:
MSE=893.9784

For 2 bit/pixel:
MSE=459.6786

For 3 bit/pixel:
MSE=94.1136

1 c)
Code:
clc; clear all; close all; datafile='C:\Users\Venkata\Desktop\images\sena.img'; sena=fopen(datafile); senaimage=fread(sena); bp=input('Enter No. of Bits/pixel:'); n = 2^bp; sq = 256/n; sq1=16/n; sq2= sq1; sqindex(1) = sq1/2; for i=2:n sqindex(i)= sqindex(i-1)+ sq1; end senaimage2 = uint8(senaimage); senaimage3 = reshape(senaimage,256,256);
[count,x]=imhist(uint8(senaimage3'));
resl=256*256; array = [resl*0.0625;resl*0.125; resl*0.1875; resl*0.25; resl*0.3125; resl*0.375; resl*0.4375; resl*0.50; resl*0.5625; resl*0.625; resl*0.6875; resl*0.75; resl*0.8125 ;resl*0.875 ;resl*0.9375]; m=0; bp=1; for j=1:15 while m<array(j) m=m+count(bp); bp=bp+1; end mid(j)=bp; end L(1) = 0 ;
H(1) = mid(sq1)-1; if(n>2) for i=2:n-1 sq2 = sq2+ sq1; L(i)=H(i-1)+1; H(i)=mid(sq2); end L(n)=H(n-1)+1;
H(n)=255;
else
L(2)=H(1)+1;
H(2)=255; end for i = 1:n for j=1:65536 if(senaimage2(j)>=L(i) && senaimage2(j)<=H(i)) senaimage3(j) = mid(sqindex(i)); end end end senaimage4 = reshape(senaimage,256,256); senaimage5= reshape(senaimage3,256,256);
MSE = sum(sum((senaimage4-senaimage5).^2))/(256*256) imshow(uint8(senaimage5')); fclose(sena);

Results:

For 1 bit/pixel
MSE=442.1536

For 2 bit/pixel MSE=151.8293

For 3 bit/pixel:
MSE=56.8859

Conclusion: 1. On observing the first histogram, we conclude that it is a Laplacian distribution. 2. As the bit/pixel increases the image quality increases, the darkness in picture decreases and the mean square error also decreases. 3. The mean square error in case “1B” is much higher than case “1C”. 4. The quantization in the last case is much better, as non-uniform quantization concentrates more on the higher probabilities of the image than the uniform quantization in case “1B”. The quantization in the last case proves out to be much better.

Similar Documents

Free Essay

Vhgffghg

...a specified number % of bits. It then calculates the quantization error. clc clear all close all Change the #of bits means change in resolution Change the #of bits means change in resolution fprintf(' Sampling and Quantization\n'); b=5; % Number of bits. N=100; % Number of samples in final signal. n=0:(N-1); %Index Change the value of N means change in sampling rate of sig Change the value of N means change in sampling rate of sig % Choose the input type. choice = questdlg('Choose input','Input',... 'Sine','Sawtooth','Random','Random'); fprintf('Bits = %g, levels = %g, signal = %s.\n', b, 2^b, choice); % Create the input data sequence. switch choice case 'Sine' x=sin(2*pi*n/N); case 'Sawtooth' x=sawtooth(2*pi*n/N); case 'Random' x=randn(1,N); % Random data x=x/max(abs(x)); % Scale to +/- 1 end % Signal is restricted to between -1 and +1. x(x>=1)=(1-eps); % Make signal from -1 to just less than 1. x(x<-1)=-1; % Quantize a signal to "b" bits. xq=floor((x+1)*2^(b-1)); % Signal is one of 2^n int values (0 to 2^n-1) xq=xq/(2^(b-1)); % Signal is from 0 to 2 (quantized) xq=xq-(2^(b)-1)/2^(b); % Shift signal down (rounding) xe=x-xq; % Quantization error stem(x,'b'); hold on; stem(xq,'r'); hold...

Words: 371 - Pages: 2

Free Essay

Front Page

...1. A tap can fill an oil tank in 15 hours. After half the oil tank is filled, nine more similar taps are opened. What is the total time taken to fill the oil tank completely? (a) 8 hrs 15 min (b) 3 hrs 45 min (c) 4 hrs (d) 4 hrs 15 min 2. Two pipes can fill a tank in 10 hours and 12 hours respectively, while a third pipe empties the full tank m 20 hours. If all the three pipes operate simultaneously, in how much time will the tank be full? (a) 7 hrs 15 mm (b) 7 hrs 30 mm (c) 7 hrs 45 mm (d) 8 hrs 3.One tap can fill a water tank four times as fast as another tap. If together the two taps can fill the water tank in 30 minutes then the slower tap alone will be able to fill the water tank in ---------------- (a) 81 min (b) 108 min (c) 150 min (d) 192 min 4.A can do a piece of work in 15 days .B is 50% more efficient than A. Then B can finish it in (a)10 days (b) 7 1 /2 days (c) 12 days (d) 101/2 days 5. A does 20% less work than B. If A can finish a piece of work in 7 1 /2 hrs..Then B can finish it in (a) 5 hrs (b) 51 /2 hrs (c) 6 hrs (d) 61 /2 hrs 6.A work twice as fast as B. If both of them can together finish a piece of work in 12 days ,then b alone can do it in ? (a) 24 days (b) 27 days (c) 36...

Words: 1688 - Pages: 7

Premium Essay

Nt1310 Unit 1 Algorithm Paper

...To understand the algorithm first we need to specify what we have at the output of Q1 and Q2 represented by Y1 and Y2 respectively, the digital outputs can be represented as: Y_1= XSTF+E_1NTF ( 5 ) Y_2=XSTF-E_1 STF+E_2 ( 6 ) Fig. 7 is a representation of the relationship between Y1 and Y2. Assuming that only quantization is present in the system and that the gain of DAC1 is equal to 1, it can be seem that the system transfer function can be obtained by deconvolution in the time domain or division in the frequency domain as follow: ├ Y_2/Y_1 ┤|_(X→0)=〖-LF〗_1+E_2/(E_1 NFT)=(-STF+E_2/E_1 )/NTF ( 7 ) Fig. 7. Quantizer output relationship. As shown is equation ( 7 ) the loop gain can be measured, with some small error introduced by the quantization...

Words: 1086 - Pages: 5

Premium Essay

Speech

............................................................................................ 3 Part I .......................................................................................................................................................... 3 1) Estimation of the Source Power ................................................................................................... 4 2) Quantization Error and SQNR Values............................................................................................ 4 3) Non-uniform Pulse Code Modulation and the use of -law companders .................................... 7 4) N=128 and N=256 Quantization Levels ......................................................................................... 8 Part 2)...................................................................................................................................................... 14 1) The Analysis of the Source Power, SQNR and Quantization Error for Speech Signal ................. 14 2) Non-uniform Quantization of the Speech Signal with µ-Law Compander ................................. 18 Part...

Words: 3631 - Pages: 15

Free Essay

Pipes

...Pipe Bends and Thrust Block Forces ------------------------------------------------- Pipe bends and thrust blocks forces on anchors due to fluid velocity and internal pressure - online resulting force calculator Sponsored Links Online Pipe Bend Resulting Force Calculator The calculator below can used to calculate resulting force in piping bends: ------------------------------------------------- Top of FormMetricρ - density of fluid (kg/m3)d - int. diam. pipe or bend (m)v - velocity of fluid (m/s)β - turning angle of bend (o)p - gauge pressure (kPa)Bottom of Form | ------------------------------------------------- Top of FormImperial SG - specific gravity of fluid d - int. diam. pipe or bend (inches)v - velocity of fluid (ft/s)β - turning angle of bend (o)p - gauge pressure (psi)Bottom of Form | The resulting force on a thrust block or anchor depends on the fluid mass flow and flow velocity and the pressure in the bend. Resulting force due to Mass flow and Flow Velocity The resulting force in x-direction due to mass flow and flow velocity can be expressed as: Rx = m v (1 - cosβ)         (1)     = ρ A v2 (1 - cosβ)         (1b)     = ρ π (d / 2)2 v2 (1 - cosβ)         (1c) where Rx = resulting force in x-direction (N) m = mass flow (kg/s) v = flow velocity (m/s) β = turning bend angle (degrees) ρ = fluid density (kg/m3) d = internal pipe or bend diameter (m) π = 3.14... The resulting force in y-direction due to mass flow and flow velocity can be expressed...

Words: 632 - Pages: 3

Free Essay

Motion

...Tobi Gonzalez 2/25/13 Motion is Relative 1. The two units of measurement are distance and time. 2. The kind of speed is registered by an automobile speedometer is instantaneous speed. 3. Average speed is the speed averaged over duration of time. Usually the total distance covered divided by the total time. Instantaneous speed is the speed given at that instant within that span of time, measured with a real time speedometer. 4. The average speed in kilometers per hour for a horse that 
gallops a distance of 15 km in a time of 30 min is: Average speed = 15 km/30 min = 15 km/0.5 h = 30 km/h 5. Speed is the distance covered per unit of time. Acceleration is the rate in which an object changes its velocity. 6. If a car is moving at 90 km/h and it rounds a corner, also at 90 km/h, 
it does maintain a constant speed but not a constant velocity. The velocity never changed, only the direction it’s traveling. 7. Velocity is change in displacement, change in position over a period of time, while Acceleration is change in velocity over a time period. 8. The acceleration of a car that increases its velocity from 0, to 
100 km/h in 10s is 10km/h*s 9. The acceleration of a car that maintains a constant velocity of 
100 km/h for 10s is 0 km/h*s. Some of my classmates get this question wrong but the last question right because they fail to read the question. In the last question there was a change in velocity. However in this question there was no change in...

Words: 495 - Pages: 2

Premium Essay

Qrb 501 Chapter 3 Page 174 Problems 51-54

...CHAPTER 3 PAGE 174 PROBLEMS 51-54 Relating Concepts For Individual or Group Work A formula that has many uses for drivers is, called the distance formula. If you are driving a car, then d is the distance you travel (how many miles) r is the rate (how fast you are driving in miles per hour) t is the time (how many hours you drive). Use the distance formula as you work Exercises 51–54 in order. d = rt 51. Suppose you are driving on Interstate highways at an average rate of 70 miles per hour. Use the distance formula to find out how far you will travel in (a) 2 hours; (b) 5 hours; (c) 8 hours. A.) d = rt d= 70 mph x 2 hours d= 140 miles B.) d = rt d=70mph x 5 hours d= 350 miles C.) d = rt d = 70 mph x 8 hours d = 560 miles 52. If an ice storm slows your driving rate to 35 miles per hour, how far will you travel in (a) 2 hours, (b) 5 hours, (c) 8 hours? Show how to find each answer using the formula. (d) Explain how to find each answer using the results from Exercise 51 instead of the formula. A.) 35mph x 2 hours = 70 miles B.) 35mph x 5 hours = 175 miles C.) d = 35mph x 8 hours = 280 miles D.) Multiply the hours traveled by the miles traveled per hour. 53. Use the distance formula to find out how many hours you would have to drive to travel the 3000 miles from Boston to San Francisco if your average rate is (a) 60 miles per hour; (b) 50 miles per hour; (c) 20 miles per hour (which was the speed limit...

Words: 582 - Pages: 3

Premium Essay

Mystery Egg

...Please follow these instructions to enable the buttons in this document. Press "ALT" and "TMS" together in sequence and select "Medium" for security settings. Alternatively, select the security button from micro submenu from tool’s menu and choose medium for security settings. While opening, remember to click "Enable Macros" or this interactive document will not work properly. This needs to be repeated every time you open the file. Please close and reopen the file if you have just set the security settings to "Medium" Choose “Print Layout” or “Web Layout” to view the document. Write your thoughts and answers in the pale-blue text area just above the explanation button. Viewed best in 1280 by 1024 pixels resolution. [pic] In this module, you will ■ plot and interpret distance-time graphs and speed-time graphs ■ calculate the area under the speed-time graph to determine the distance travelled by a body ■ describe what is free fall ■ understand the concept of terminal velocity Graphical analysis of motion helps you picture the relationships among position, velocity, and acceleration. For graphical analysis of motion, we use graphs to describe the relationship between variables such as distance and time and speed and time. Distance-time graph and Speed-time graphs are the common graphs used to analyse motion in detail. How do you think graphs will help in studying motion? Graphs being visual representation of numerical data: Choose...

Words: 2457 - Pages: 10

Free Essay

Free Answers

...Measuring Speed Introduction: Speed is defined as the rate of change of position or the rate of motion. A rate is the ratio between two different quantities. Motion is described with respect to, or relative to, another object called a reference point or frame of reference. Usually the Earth is considered to be stationary and is often the frame of reference. Speed is a relative quantity that depends upon the frame of reference -- how an object is observed and measured. Average speed is total distance traveled divided by the total time traveled. average speed = total distance or speed = d where d is distance and t is time total time traveled t Another way to measure speed is called instantaneous speed. This type is one of the most common ways we measure speed. Instantaneous speed is the measurement of speed at a particular instant. Without the use of a measuring device called a speedometer, instantaneous speed is almost impossible to measure. When both speed and direction are specified for the motion the term velocity is used. In other words, velocity is speed in a particular direction. A person walking eastward at 1 km/h does not have the same velocity as a person walking northward at 1 km/h, even though their speeds are the same. Two persons also have different velocities if they walk in the same direction at different speeds or if they are turning. Calculating Speed Activity PROCEDURE Part A: Mark off your walking distance...

Words: 794 - Pages: 4

Premium Essay

Image Theory

...Gary Banker2, Ena Ladi3, Ellen Robey3, Sally Temple4, and Badrinath Roysam1 1 Rensselaer Polytechnic Institute, Troy, NY 12180, USA, 2 Oregon Health & Science University, 3181 SW Sam Jackson Park Road, L606, Portland, OR 97239, USA 3 University of California, Berkeley, Berkeley, CA 94720, USA 4 Center for Neuropharmacology & Neuroscience, Albany Medical College, Albany, NY 12208, USA ABSTRACT An algorithmic information theoretic method is presented for object-level summarization of meaningful changes in image sequences. Object extraction and tracking data are represented as an attributed tracking graph (ATG), whose connected subgraphs are compared using an adaptive information distance measure, aided by a closed-form multi-dimensional quantization. The summary is the clustering result and feature subset that maximize the gap statistic. The notion of meaningful summarization is captured by using the gap statistic to estimate the randomness deficiency from algorithmic statistics. When applied to movies of cultured neural progenitor cells, it correctly distinguished neurons from progenitors without requiring the use of a fixative stain. When analyzing intra-cellular molecular transport in cultured neurons undergoing axon specification, it automatically confirmed the role of kinesins in axon specification. Finally, it was able to differentiate wild type from genetically modified thymocyte cells. Index Terms: Algorithmic information theory, Algorithmic statistics, Information distance...

Words: 3769 - Pages: 16

Free Essay

Hostel Management

...------------------------------------------------- Data compression From Wikipedia, the free encyclopedia   (Redirected from Video compression) "Source coding" redirects here. For the term in computer programming, see Source code. In digital signal processing, data compression, source coding,[1] or bit-rate reduction involves encoding information using fewer bits than the original representation.[2]Compression can be either lossy or lossless. Lossless compression reduces bits by identifying and eliminating statistical redundancy. No information is lost in lossless compression. Lossy compression reduces bits by identifying unnecessary information and removing it.[3] The process of reducing the size of a data file is referred to as data compression. In the context of data transmission, it is called source coding (encoding done at the source of the data before it is stored or transmitted) in opposition to channel coding.[4] Compression is useful because it helps reduce resource usage, such as data storage space or transmission capacity. Because compressed data must be decompressed to use, this extra processing imposes computational or other costs through decompression; this situation is far from being a free lunch. Data compression is subject to a space–time complexity trade-off. For instance, a compression scheme for video may require expensive hardware for the video to be decompressed fast enough to be viewed as it is being decompressed, and the option to decompress the video...

Words: 12347 - Pages: 50

Free Essay

Neural Networks for Matching in Computer Vision

...Neural Networks for Matching in Computer Vision Giansalvo Cirrincione1 and Maurizio Cirrincione2 Department of Electrical Engineering, Lab. CREA University of Picardie-Jules Verne 33, rue Saint Leu, 80039 Amiens - France exin@u-picardie.fr Universite de Technologie de Belfort-Montbeliard (UTBM) Rue Thierry MIEG, Belfort Cedex 90010, France maurizio.cirricione@utbm.fr 1 2 Abstract. A very important problem in computer vision is the matching of features extracted from pairs of images. At this proposal, a new neural network, the Double Asynchronous Competitor (DAC) is presented. It exploits the self-organization for solving the matching as a pattern recognition problem. As a consequence, a set of attributes is required for each image feature. The network is able to find the variety of the input space. DAC exploits two intercoupled neural networks and outputs the matches together with the occlusion maps of the pair of frames taken in consideration. DAC can also solve other matching problems. 1 Introduction In computer vision, structure from motion (SFM) algorithms recover the motion and scene parameters by using a sequence of images (very often only a pair of images is needed). Several SFM techniques require the extraction of features (corners, lines and so on) from each frame. Then, it is necessary to find certain types of correspondences between images, i.e. to identify the image elements in different frames that correspond to the same element in the scene. This paper...

Words: 3666 - Pages: 15

Free Essay

Higgs Boson

...Submitted by: Mina, Madelyn Ann C. IV- St. Cecilia Submitted to: Mr. Noel A. Hermano Submitted by: Mina, Madelyn Ann C. IV- St. Cecilia Submitted to: Mr. Noel A. Hermano Higgs Boson Higgs Boson What is Higgs Boson? What is Higgs Boson? Higgs Boson, the “God Particle” as coined by Leon Lederman back in 1993, is the particle that made up the Higgs Field. The Higgs Field is the energy field that permeated the entire universe, according to Dr. Peter Higgs. For example, our entire universe is covered with snowfield and we know that what makes up a snowfield is a snowflake. The same way it goes with the Higgs field; it is made up of Higgs Boson (Ellis, 2013). The Higgs Boson or the Higgs Particle is the very first elementary particle that does not spin at all; it has no electric charge, nor color charge. It was officially announced to the public last year (2012), 4th of the month of July at the European Centre for Nuclear Research (CERN) in Switzerland. Their discovery was confirmed as the Higgs boson on March 14 this year, bringing to an end to a 50-year search. The discovery of the Higgs Boson is very important because it is said to be the missing link in our understanding of the universe, known as the Standard Model. It has also led to Professor Higgs becoming the only person ever to have a fundamental particle named after him. (Wilson, 2013).It was regarded as the “God Particle” before but many physicists did not like the way it was called. Results to Results...

Words: 4416 - Pages: 18

Free Essay

Dsp Textbook

...Digital Image Processing Second Edition Rafael C. Gonzalez University of Tennessee Richard E. Woods MedData Interactive Prentice Hall Upper Saddle River, New Jersey 07458 Library of Congress Cataloging-in-Pubblication Data Gonzalez, Rafael C. Digital Image Processing / Richard E. Woods p. cm. Includes bibliographical references ISBN 0-201-18075-8 1. Digital Imaging. 2. Digital Techniques. I. Title. TA1632.G66 621.3—dc21 2001 2001035846 CIP Vice-President and Editorial Director, ECS: Marcia J. Horton Publisher: Tom Robbins Associate Editor: Alice Dworkin Editorial Assistant: Jody McDonnell Vice President and Director of Production and Manufacturing, ESM: David W. Riccardi Executive Managing Editor: Vince O’Brien Managing Editor: David A. George Production Editor: Rose Kernan Composition: Prepare, Inc. Director of Creative Services: Paul Belfanti Creative Director: Carole Anson Art Director and Cover Designer: Heather Scott Art Editor: Greg Dulles Manufacturing Manager: Trudy Pisciotti Manufacturing Buyer: Lisa McDowell Senior Marketing Manager: Jennie Burger © 2002 by Prentice-Hall, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher. The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness...

Words: 66542 - Pages: 267

Free Essay

Dsp Lessons

...1 A DSP A-Z http://www.unex.ucla.edu Digital Signal Processing An “A” to “Z” R.W. Stewart Signal Processing Division Dept. of Electronic and Electrical Eng. University of Strathclyde Glasgow G1 1XW, UK Tel: +44 (0) 141 548 2396 Fax: +44 (0) 141 552 2487 E-mail: r.stewart@eee.strath.ac.uk M.W. Hoffman Department of Electrical Eng. 209N Walter Scott Eng. Center PO Box 880511 Lincoln, NE 68588 0511 USA Tel: +1 402 472 1979 Fax: +1 402 472 4732 Email:hoffman@unlinfo.unl.edu © BlueBox Multimedia, R.W. Stewart 1998 2 The DSPedia DSPedia An A-Z of Digital Signal Processing This text aims to present relevant, accurate and readable definitions of common and not so common terms, algorithms, techniques and information related to DSP technology and applications. It is hoped that the information presented will complement the formal teachings of the many excellent DSP textbooks available and bridge the gaps that often exist between advanced DSP texts and introductory DSP. While some of the entries are particularly detailed, most often in cases where the concept, application or term is particularly important in DSP, you will find that other terms are short, and perhaps even dismissive when it is considered that the term is not directly relevant to DSP or would not benefit from an extensive description. There are 4 key sections to the text: • • • • DSP terms A-Z Common Numbers associated with DSP Acronyms References page 1 page 427 page 435 page 443 the...

Words: 73093 - Pages: 293