필터 지우기
필터 지우기

Plot a circle of Gaussian varying intensity

조회 수: 20 (최근 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 CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by