MATLAB: Pixel based image creating

digital image processingimage

Hi. I want to create the following image by Matlab Code. What is the easiest way to do it. Thanks.

Best Answer

m = 15; n = 15;
[X,Y] = meshgrid(1:m,1:n) ;
Z = 255*ones(m,n) ;
idx = randperm(m*n,100) ;
Z(idx) = 0 ;
% pcolor(X,Y,Z)
imshow(Z)
grid on