MATLAB: How to draw a diagonal in the given image from the top left corner to the bottom right corner

diagonalrectangle

i want to draw a diagonal in the given image from the top left corner to the bottom right corner

Best Answer

[rows, columns, numberOfColorChannels] = size(rectangleImage);
x = [1, columns];
y = [1, rows];
line(x,y, 'LineWidth', 4, 'Color', [1, 0, 1]);
Adapt as needed.
Related Question