matlab display image code example
Example 1: matlab read image
% Reads image
im = imread('image.jpg');
% Displays image
image(invert)
Example 2: matlab create image
% Define A as your size matrix, this example uses 200x200 of 0's
A = uint8(zeros(200,200));
% loop over M x N with two for's
for row 1:size(A,1)
for col 1:size(A,2)
% your logic here, example:
A(row,col) = 255
end
end
% image matrix is now 200x200 of 255, using imshow will display a white image.
% imshow(A)