gistlib
main.m% Create a blank image imageSize = 500; % Size of the image blankImage = uint8(255 * ones(imageSize, imageSize)); % Rectangle parameters rectangleWidth = 200; rectangleHeight = 100; % Calculate the position of the rectangle topLeftX = (imageSize - rectangleWidth) / 2; topLeftY = (imageSize - rectangleHeight) / 2; bottomRightX = topLeftX + rectangleWidth - 1; bottomRightY = topLeftY + rectangleHeight - 1; % Draw the rectangle in the image blankImage(topLeftY:bottomRightY, topLeftX:bottomRightX) = 0; % Display the image imshow(blankImage); 548 chars20 lines
% Create a blank image imageSize = 500; % Size of the image blankImage = uint8(255 * ones(imageSize, imageSize)); % Rectangle parameters rectangleWidth = 200; rectangleHeight = 100; % Calculate the position of the rectangle topLeftX = (imageSize - rectangleWidth) / 2; topLeftY = (imageSize - rectangleHeight) / 2; bottomRightX = topLeftX + rectangleWidth - 1; bottomRightY = topLeftY + rectangleHeight - 1; % Draw the rectangle in the image blankImage(topLeftY:bottomRightY, topLeftX:bottomRightX) = 0; % Display the image imshow(blankImage);
gistlibby LogSnag