Line 20: | Line 20: | ||
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: 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/> | ||
− | A1: Did you add 127 to y (y + 127)? | + | A1: Did you add 127 to y (y + 127)? |
+ | ->Not yet, 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 range. Again, I don't know what the image command isn't working. | ||
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. | 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. |
Revision as of 18:08, 24 January 2013
Hello Class, before you start doing Lab2, here are some background information you might want to read:
http://en.wikipedia.org/wiki/Window_function
http://en.wikipedia.org/wiki/Spectral_density
http://en.wikipedia.org/wiki/Orthogonal_transformation
Also as Additional Information: http://www.mathworks.com/help/matlab/ref/mtimes.html http://www.mathworks.com/help/matlab/ref/times.html
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 multipled by cos(n)+isin(n) where n is the location between 0-64 in the window?
A: I would just x.^2 to be honest :)
Q: What does window function do?
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.
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)?
->Not yet, 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 range. Again, I don't know what the image command isn't working.
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
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.
Q:I am confused about the difference between powder spectral density and powder spectrum? Are they the same?