How can I make a synthetic image in MATLAB?
<p>I am using MATLAB 2015b to make a synthetic image as following (without green circle)</p>

<p><a href="https://i.stack.imgur.com/LQBOX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LQBOX.png" alt="enter image description here"></a> </p>

<p>It maybe hard to make the star image for me. Hence, I used a simple shape as square as below code. However, I cannot create similar intensity as example image. If it is possible, would you help me to make the image? I think  that the image has two components: intensity following Gaussian distribution and inhomogeneous intensity. Thank all</p>

<pre><code>%% Gray image
rows = 256;
columns = 256;
grayImage = ones(rows, columns, 'uint8').*200;
xCoords= [80 180 180 80 80];
yCoords = [80 80 180 180 80];
mask = poly2mask(xCoords, yCoords, rows, columns);
grayImage(mask) = 80; 
%% First component Gray+noise
im_normal=double(grayImage./max(grayImage(:)));
im_noise= imnoise(im_normal,'gaussian',0,0.02);
%% Second component: Inhomogeneous term
X = 1:rows;                           % X is a vector from 1 to imageSize
X0 = (X / rows) -0.2;                 % rescale X 
Xm = meshgrid(X0, X0);             % 2D matrices
%% Output image
Out_Img=im_noise.*Xm;
subplot(121);imshow(grayImage);
subplot(122);imshow(Out_Img,[]);
</code></pre>

<p>This is my current result</p>

<p><a href="https://i.stack.imgur.com/d6Cs5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d6Cs5.jpg" alt="enter image description here"></a></p>