(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Hello Class, before you start doing Lab2, here are some background information you might want to read:<br/>
+
==<font size= 6>Discussion for Lab 2, [[ECE637]], Spring 2013</font size>==
http://en.wikipedia.org/wiki/Window_function<br/>
+
==Additional Information ==
http://en.wikipedia.org/wiki/Spectral_density<br/>
+
http://en.wikipedia.org/wiki/Orthogonal_transformation<br/>
+
  
Also as Additional Information:<br/>
+
Hello Class, before you start doing Lab2, here are some background information you might want to read:
http://www.mathworks.com/help/matlab/ref/mtimes.html<br/>
+
* http://en.wikipedia.org/wiki/Window_function
http://www.mathworks.com/help/matlab/ref/times.html<br/>
+
* http://en.wikipedia.org/wiki/Spectral_density
 +
* http://en.wikipedia.org/wiki/Orthogonal_transformation
  
Q&A Section <br/>
+
Also as Additional Information:
Q: Anyone have an idea of&nbsp;how to compute the squared DFT magnitude in MATLAB? Is this the sum of pixels across the window multipled by cos(n)+isin(n) where n is the location between 0-64 in the window?<br/>
+
* http://www.mathworks.com/help/matlab/ref/mtimes.html
A: I would just x.^2 to be honest :)<br/>
+
* http://www.mathworks.com/help/matlab/ref/times.html
  
Q: What does window function do?<br/>
+
Some tips on using VSC++ debugger
A: Rememeber how rect goes to sinc from lab1? Everytime you sample an input segment and perform FFT, you are essentially applying rectangle window to the input samples. Therefore to reduce the effect of artifacts, people apply different type of windows before applying orthogonal transforms.
+
* http://www.cprogramming.com/tutorial/debugging_concepts.html
  
Q: In the second part, why are we adding 127 to each pixel value before displaying them, instead of scaling them to 0 - 255? Because, in my understanding, adding 127, would increase the (0,0) frequency component, and thus giving us the illusion that the image is smoother.<br/>
+
==Q&A Section ==
A1: I think it's just for visualization.  For me, min(min(y)) = -121.79 and you can't display that.  So, shifting by 127 makes pixel values non-negative.<br/>
+
----
A2: As mentioned from A1. Given X~U(-0.5,0.5), to correctly display the image using 8bit gray scale, you have to make the best out of your quantization levels. Therefore first add 0.5 to the average then multiply by 255 as stated from the problem statement.<br/>
+
;'''Q - Anyone have an idea of how to compute the squared DFT magnitude in MATLAB? Is this the sum of pixels across the window multiplied by cos(n)+isin(n) where n is the location between 0-64 in the window?'''
 +
:A - It would just x.^2 to be honest
  
Q: Is anyone having trouble using the image() command in Matlab for displaying their 'random image' in part 2? Mine comes up as just a black square every time. I set the colormap to gray(256) and I'm converting to an 8-bit representation using uint8(). I have checked my matrix and the values range from 0 to 255. Any insight? <br/>
+
;'''Q - What does window function do?'''
A1: Did you add 127 to y (y + 127)?<br/>
+
:A - Remember how rect goes to sinc from lab1? Every time you sample an input segment and perform FFT, you are essentially applying rectangle window to the input samples. Therefore to reduce the effect of artifacts, people apply different type of windows before applying orthogonal transforms.
  
Q: as I was primarily looking at step one of Part 2, however, the x_scaled I am attempting to display has values from 0 to 255, within the 8bit grayscale rangeAgain, I don't know what the image command isn't working.
+
;'''Q - In the second part, why are we adding 127 to each pixel value before displaying them, instead of scaling them to 0 - 255? Because, in my understanding, adding 127, would increase the (0,0) frequency component, and thus giving us the illusion that the image is smoother.'''
A: Please refer to the previous Questions.<br/>
+
:A1 - I think it's just for visualizationFor me, min(min(y)) = -121.79 and you can't display that.  So, shifting by 127 makes pixel values non-negative.
 +
:A2 - As mentioned from A1. Given X~U(-0.5,0.5), to correctly display the image using 8bit gray scale, you have to make the best out of your quantization levels. Therefore first add 0.5 to the average then multiply by 255 as stated from the problem statement.
  
Q: Does anyone have any insight in determining the power spectral density of y? I've read through the links and listened to older lectures from previous semesters, but am still lost.<br/>
+
;'''Q - Is anyone having trouble using the image() command in Matlab for displaying their 'random image' in part 2? Mine comes up as just a black square every time. I set the colormap to gray(256) and I'm converting to an 8-bit representation using uint8().  I have checked my matrix and the values range from 0 to 255. Any insight?'''
A1: Probably this might help : http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem<br/>
+
:A1 - Did you add 127 to y (y + 127)?
A2: Samples are IID. Consider using Rxx and Sxx to simplify your calculations.<br/>
+
  
Q:  Using the above link to calculate the power spectral density still does not help me.  How do you go from the difference equation y(m,n)=3x(m,n)-.99y(m-1,n)-.99y(m,n-1)+.9801y(m-1,n-1) to S_y=sum(r_y[k]e^(-2*pi*f*k)) where r_y=E[y(n)y*(n-k)]?  These steps do not seem to be explained in the wiki link or in any of the notes.<br/>
+
;'''Q - as I was primarily looking at step one of Part 2, however, the x_scaled I am attempting to display has values from 0 to 255, within the 8bit gray-scale range. Again, I don't know what the image command isn't working.'''
A: As above, samples are IID and therefore should consider using Rxx and Sxx to get to Syy.<br/>
+
:A - Please refer to the previous Questions.
  
Q:I am confused about the difference between powder spectral density and powder spectrum? Are they the same?<br/>
+
;'''Q - Does anyone have any insight in determining the power spectral density of y? I've read through the links and listened to older lectures from previous semesters, but am still lost.'''
A: First, it is POWER spectral density. Second, it would depend on the context.<br/>
+
:A1 - Probably this might help : http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem
 +
:A2 - Samples are IID. Consider using Rxx and Sxx to simplify your calculations.
  
Q: I'm having some trouble with coding in matlab. I want to modify the line "z = X(i:(N+i-1), j:(N+j-1));" in SpecAnal.m so that I change z from a 2-dimensional matrix to a 3-dimensional matrix. For example, add something like z(a,i,j) so that a is the counter for the number windows and i and j are the intensity values inside the windows. Whenever I try to do something like this I get a mismatch error saying that the matrices have different numbers of arguments. I'd like to not have to create 25 different variables for each window. Can anyone help me with this?<br/>
+
;'''Q - Using the above link to calculate the power spectral density still does not help me.  How do you go from the difference equation y(m,n)=3x(m,n)-.99y(m-1,n)-.99y(m,n-1)+.9801y(m-1,n-1) to S_y=sum(r_y[k]e^(-2*pi*f*k)) where r_y=E[y(n)y*(n-k)]?  These steps do not seem to be explained in the wiki link or in any of the notes.'''
A: Matlab uses internal structs for each dimensions. Therefore you will have to use special commands to merge multi-dimensions together. Yes, even if the last dimension has only 1 width!<br/>
+
:A - As above, samples are IID and therefore should consider using Rxx and Sxx to get to Syy.
 +
 
 +
;'''Q - I am confused about the difference between powder spectral density and powder spectrum? Are they the same?'''
 +
:A - First, it is POWER spectral density. Second, it would depend on the context. Again http://en.wikipedia.org/wiki/Spectral_density
 +
 
 +
;'''Q - I'm having some trouble with coding in matlab. I want to modify the line "z = X(i:(N+i-1), j:(N+j-1));" in SpecAnal.m so that I change z from a 2-dimensional matrix to a 3-dimensional matrix. For example, add something like z(a,i,j) so that a is the counter for the number windows and i and j are the intensity values inside the windows. Whenever I try to do something like this I get a mismatch error saying that the matrices have different numbers of arguments. I'd like to not have to create 25 different variables for each window. Can anyone help me with this?
 +
:A - Matlab uses internal structs for each dimensions. Therefore you will have to use special commands to merge multi-dimensions together. Yes, even if the last dimension has only 1 width! The commands at http://www.mathworks.com/help/matlab/math/creating-and-concatenating-matrices.html might provide some insight.
 +
 
 +
;'''Q - Section 2 - Is this the proper image we are looking for image (y+127)? https://www.dropbox.com/s/vq6019smw738ubn/y_out.png It seems to blow up too early.  Equation used: imageout(m,n)= 3 * imagein(m,n) + .99 * (imageout(m-1,n)+imageout(m,n-1))-.9801 * imageout(m-1,n-1)'''
 +
 
 +
;'''Q - Section 2 - For calculationg Sx anlyitically, is this just doing a Fourier transform of and multiplying by its complex conjugate and 1/(N^2)?  Not exactly sure on how to approach this anylitically and wikipedia is not sounding off light bulbs, are there any sources with examples?  Thanks!'''
 +
 
 +
:A - Try "http://202.114.177.215/UploadFile/20120420114148869.ppt" And keep in mind the noise is IID distributed and could be transformed using Rx to Sxx. And here is some more information about the theoredical and the actual computation results: http://webpub.allegheny.edu/employee/b/bafrasia/e460/arima.doc
 +
----
 +
[[2013_Spring_Image_Processing_ECE_637_Bouman|Back to Spring 2013 ECE637]]
 +
[[Category:Image ProcessingECE 637Spring2013Bouman]]
 +
[[Category:ECE637]]
 +
[[Category:image processing]]
 +
[[category:discussion]]

Latest revision as of 07:11, 9 April 2013

Discussion for Lab 2, ECE637, Spring 2013

Additional Information

Hello Class, before you start doing Lab2, here are some background information you might want to read:

Also as Additional Information:

Some tips on using VSC++ debugger

Q&A Section


Q - Anyone have an idea of how to compute the squared DFT magnitude in MATLAB? Is this the sum of pixels across the window multiplied by cos(n)+isin(n) where n is the location between 0-64 in the window?
A - It would just x.^2 to be honest
Q - What does window function do?
A - Remember how rect goes to sinc from lab1? Every time you sample an input segment and perform FFT, you are essentially applying rectangle window to the input samples. Therefore to reduce the effect of artifacts, people apply different type of windows before applying orthogonal transforms.
Q - In the second part, why are we adding 127 to each pixel value before displaying them, instead of scaling them to 0 - 255? Because, in my understanding, adding 127, would increase the (0,0) frequency component, and thus giving us the illusion that the image is smoother.
A1 - I think it's just for visualization. For me, min(min(y)) = -121.79 and you can't display that. So, shifting by 127 makes pixel values non-negative.
A2 - As mentioned from A1. Given X~U(-0.5,0.5), to correctly display the image using 8bit gray scale, you have to make the best out of your quantization levels. Therefore first add 0.5 to the average then multiply by 255 as stated from the problem statement.
Q - Is anyone having trouble using the image() command in Matlab for displaying their 'random image' in part 2? Mine comes up as just a black square every time. I set the colormap to gray(256) and I'm converting to an 8-bit representation using uint8(). I have checked my matrix and the values range from 0 to 255. Any insight?
A1 - Did you add 127 to y (y + 127)?
Q - as I was primarily looking at step one of Part 2, however, the x_scaled I am attempting to display has values from 0 to 255, within the 8bit gray-scale range. Again, I don't know what the image command isn't working.
A - Please refer to the previous Questions.
Q - Does anyone have any insight in determining the power spectral density of y? I've read through the links and listened to older lectures from previous semesters, but am still lost.
A1 - Probably this might help : http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem
A2 - Samples are IID. Consider using Rxx and Sxx to simplify your calculations.
Q - Using the above link to calculate the power spectral density still does not help me. How do you go from the difference equation y(m,n)=3x(m,n)-.99y(m-1,n)-.99y(m,n-1)+.9801y(m-1,n-1) to S_y=sum(r_y[k]e^(-2*pi*f*k)) where r_y=E[y(n)y*(n-k)]? These steps do not seem to be explained in the wiki link or in any of the notes.
A - As above, samples are IID and therefore should consider using Rxx and Sxx to get to Syy.
Q - I am confused about the difference between powder spectral density and powder spectrum? Are they the same?
A - First, it is POWER spectral density. Second, it would depend on the context. Again http://en.wikipedia.org/wiki/Spectral_density
Q - I'm having some trouble with coding in matlab. I want to modify the line "z = X(i:(N+i-1), j:(N+j-1));" in SpecAnal.m so that I change z from a 2-dimensional matrix to a 3-dimensional matrix. For example, add something like z(a,i,j) so that a is the counter for the number windows and i and j are the intensity values inside the windows. Whenever I try to do something like this I get a mismatch error saying that the matrices have different numbers of arguments. I'd like to not have to create 25 different variables for each window. Can anyone help me with this?
A - Matlab uses internal structs for each dimensions. Therefore you will have to use special commands to merge multi-dimensions together. Yes, even if the last dimension has only 1 width! The commands at http://www.mathworks.com/help/matlab/math/creating-and-concatenating-matrices.html might provide some insight.
Q - Section 2 - Is this the proper image we are looking for image (y+127)? y_out.png It seems to blow up too early. Equation used: imageout(m,n)= 3 * imagein(m,n) + .99 * (imageout(m-1,n)+imageout(m,n-1))-.9801 * imageout(m-1,n-1)
Q - Section 2 - For calculationg Sx anlyitically, is this just doing a Fourier transform of and multiplying by its complex conjugate and 1/(N^2)? Not exactly sure on how to approach this anylitically and wikipedia is not sounding off light bulbs, are there any sources with examples? Thanks!
A - Try "http://202.114.177.215/UploadFile/20120420114148869.ppt" And keep in mind the noise is IID distributed and could be transformed using Rx to Sxx. And here is some more information about the theoredical and the actual computation results: http://webpub.allegheny.edu/employee/b/bafrasia/e460/arima.doc

Back to Spring 2013 ECE637

Alumni Liaison

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics