Mostra commenti meno recenti
Hi I want to create an 30 frames of images with each image having 20*20 pixels. I would also want to access the grey scale level of each pixel. Please help me out with this Thanx
Risposta accettata
Più risposte (1)
Walter Roberson
il 9 Ott 2011
0 voti
How have you stored the 30 frames ?
Probably the easiest way would be to store them as a 3D array indexed at Row, Column, and FrameNumber.
7 Commenti
PChoppala
il 9 Ott 2011
Walter Roberson
il 9 Ott 2011
You have a problem: randn() can generate indefinitely large positive or negative numbers. rand([20 20]) would generate an _average_ of 200 negative numbers.
I'm not sure what your "standard deviation = 3" refers to. Perhaps it means you are truncating the distribution at 3 standard deviations. That helps with not having to deal with extreme values, but you still end up with negative values, and the locations that you cut off at will end up with higher probability than would otherwise be expected.
But perhaps the standard deviation of 3 refers to the blurring ?
What kind of blurring? Gaussian?
If you go through and construct the series of steps to generate _one_ image with the required specifications, we can help you convert that to construct 30.
PChoppala
il 9 Ott 2011
Walter Roberson
il 9 Ott 2011
rand(M,N) generates M x N pixels. Each pixel is 1 unit by 1 unit.
See this discussion for gaussian blurring:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/170165
You can store the frames in a mov struct, which is a structure array indexed at the frame number, with each entry having a field named 'cdata' and another named 'map'. You would leave 'map' as the empty array, and you would would store the frame data (the blurred version of "a") in the cdata field.
Once you have that, you could use mov2avi() to construct a .avi file.
See also the new VideoPlayer class.
PChoppala
il 9 Ott 2011
PChoppala
il 10 Ott 2011
Image Analyst
il 10 Ott 2011
So multiply by 255 and cast to uint8. By the way, an image does not have to be in the range 0-255. That's just for 8 bit unsigned gray level images, but you can have 16 bit integer images, floating (double) point images, etc.
Categorie
Scopri di più su Convert Image Type in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!