Plot a circle of Gaussian varying intensity

16 ビュー (過去 30 日間)
Jose Aroca
Jose Aroca 2020 年 6 月 12 日
コメント済み: Image Analyst 2021 年 1 月 7 日
I want to plot a circle who's intensity varies as a Gaussian distribution, ie. to be maximum at the centre and tail off as the radius is increased. I have developed this code in which the intensity can vary according to the radius, but I am unsure on how to follow.
imagelength=100;
middle=(imagelength+1)/2;
radius=20;
dimmerRadius=15;
brightness=256;
dimmerBrightness=150;
image=ones(imagelength);
for i=1:imagelength
x=-imagelength+middle+i; %change y coordinate by adding term
for j=1:imagelength
y=-imagelength+middle+j; %change x coordinate by adding term
if(x^2+y^2<=radius^2) %equation of circle
image(i,j)=brightness;
end
if(x^2+y^2<=dimmerRadius^2)
image(i,j)=dimmerBrightness;
end
end
end
imagesc(image)
axis square
axis off
colormap gray
caxis([1 256])
Many thanks.

採用された回答

Image Analyst
Image Analyst 2020 年 6 月 12 日
See my attached demo. There are lots of parameters to control exactly the way it looks so adapt them to get what you want.
  25 件のコメント
Image Analyst
Image Analyst 2020 年 6 月 30 日
Looks like you need to make sure your sigmas occur in a tighter range. A bigger sigma will flatten out, almost like it's adding a constant to the image.
reham elnabawy
reham elnabawy 2020 年 7 月 2 日
Image Analyst:
ok. I got your point. I minimized the sigma value so that the blurriness is removed. However, I can see that the circle shape is dissapeared meaning that, all the circles are drawn now as squares as shown in the attached figure. So how could I reconstruct the circle shape ?

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2020 年 7 月 2 日
I don't see squares, except if you look at 45 degrees, but that's what you get when you use a hex grid. I think you should use a higher resolution image so you don't have such severe quantization artifacts.
  4 件のコメント
reham elnabawy
reham elnabawy 2021 年 1 月 7 日
Image Analyst: I need your assistnace in something please. I have a certain MATLAB code that I would like to run on a certain device. I need to know the execution time for my MATLAB code on this device. Please note that I don't have the device. However, I know the hardware specs for this device that I want to run my MATLAB code on. Please note that this device is not a computer, it is a video processing unit. I would like to ask you if there is any online simulation that I could give it my code and the hardware specs as inputs and the simulation will output for me the execution time for the code if it runs on that device?
I am looking forward to your response and thank you in advance.
Image Analyst
Image Analyst 2021 年 1 月 7 日
Not that I know of.

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

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by