古いコメントを表示
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
採用された回答
その他の回答 (1 件)
Walter Roberson
2011 年 10 月 9 日
0 投票
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 件のコメント
PChoppala
2011 年 10 月 9 日
Walter Roberson
2011 年 10 月 9 日
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
2011 年 10 月 9 日
Walter Roberson
2011 年 10 月 9 日
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
2011 年 10 月 9 日
PChoppala
2011 年 10 月 10 日
Image Analyst
2011 年 10 月 10 日
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.
カテゴリ
ヘルプ センター および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!