# Plot a circle of Gaussian varying intensity

17 views (last 30 days)
Jose Aroca on 12 Jun 2020
Commented: Image Analyst on 3 Jul 2020
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;
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
image(i,j)=brightness;
end
image(i,j)=dimmerBrightness;
end
end
end
imagesc(image)
axis square
axis off
colormap gray
caxis([1 256])
Many thanks.

Image Analyst on 12 Jun 2020
See my attached demo. There are lots of parameters to control exactly the way it looks so adapt them to get what you want.

reham elnabawy on 28 Jun 2020
Image Analyst:
Firstly, thank you for your kind response. Secondly, I removed the lines you told me to remove and I got back the hexagonal grid shape. However, the shape I obtained, as shown in the attached image(obtainedOutput.jpg), the flower pixels appear faded inside eachothers so how to get it not faded like the image in "desiredOutput.jpg" attached?
Image Analyst on 30 Jun 2020
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 on 2 Jul 2020
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 ?

Image Analyst on 2 Jul 2020
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.

reham elnabawy on 3 Jul 2020
Image Analyst: I marked some squares on the image to be more clearer to you so please see the below image. I just need the hexagonal grid to be all circles not squares please.
Image Analyst on 3 Jul 2020
Again, that's because you don't have enough pixel resolution. How can you expect to get a nice smooth round Gaussian when your image there is only 2 pixels by 2 pixels??? You can't. Use imresize() to blow your image up by a factor of 10 or so and try again.