フィルターのクリア

creating a frame(image), randn

3 ビュー (過去 30 日間)
PChoppala
PChoppala 2011 年 10 月 13 日
Hello,
Appreciate some quick help from you, my dear Matlab friends!
a = randn(20,20) + sqrt(3)*randn
imshow(a)
will create an image with 20x20 pixels, each pixel with the size 1x1. the values in the pixels are pseudo random number which are Gaussian with variance '3'.
Can i say that the pixel intensity of this image is shown in gray linear scale, assuming the value of the pixel is the pixel intensity?

採用された回答

David Young
David Young 2011 年 10 月 13 日
Your existing code will clip the pixel values at 0 and 1, so all the negative values are shown as black and all values greater than 1 as white. The intensity scale is therefore very much not linear.
Instead of imshow(a), use
imshow(a, []);
The pixel values will then be mapped to intensities approximately linearly (but only approximately, because it depends on the physical response of your screen and its associated electronics). The value nearest to -infinity will be displayed as black, and the value nearest to +infinity as white, with the other values distributed through the gray shades between.
You can also specify the mapping imshow uses with imshow(a, [blackval whiteval]) - see the documentation.
By the way, I don't think randn(20,20) + sqrt(3)*randn produces the distribution you describe. Do you perhaps mean sqrt(3)*randn(20,20)?
  2 件のコメント
PChoppala
PChoppala 2011 年 10 月 13 日
Thanks about imshow(a, ([]))
I need to create a frame with 20x20 pixels, size of each pixel to be 1x1 and a standard deviation of sigma = 3. Its Gaussian in nature. So I thought,
a = randn(20,20) + sqrt(3)*randn
imshow(a, ([]))
would work!
Is that wrong?
Is, a = sqrt(3) * randn(20,20) correct?
Image Analyst
Image Analyst 2011 年 10 月 13 日
The second one is correct, for a mean of zero. Add the desired mean to shift it so that it has the desired mean. See the example in the help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by