이전 댓글 표시
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!