Borrar filtros
Borrar filtros

how to draw a diagonal in the given image from the top left corner to the bottom right corner?

9 visualizaciones (últimos 30 días)
i want to draw a diagonal in the given image from the top left corner to the bottom right corner

Respuesta aceptada

Image Analyst
Image Analyst el 8 de En. de 2014
[rows, columns, numberOfColorChannels] = size(rectangleImage);
x = [1, columns];
y = [1, rows];
line(x,y, 'LineWidth', 4, 'Color', [1, 0, 1]);
Adapt as needed.
  2 comentarios
Naishil shah
Naishil shah el 8 de En. de 2014
Editada: Naishil shah el 8 de En. de 2014
I want to remove the top right trianglular portion from the image.How can I do that?
Image Analyst
Image Analyst el 8 de En. de 2014
Use poly2mask() to create a binary mask from the 3 triangle vertices. Then blacken the image. I think you may have to do it a color channel at a time
binaryImage = poly2mask(x, y, rows, columns);
% Extract individual color channels.
redChannel = double(rgbImage(:, :, 1));
greenChannel = double(rgbImage(:, :, 2));
blueChannel = double(rgbImage(:, :, 3));
% Now blacken
redChannel(binaryImage) = 0;
greenChannel(binaryImage) = 0;
blueChannel(binaryImage) = 0;
rgbOut = cat(3, redChannel, greenChannel, blueChannel);
imshow(rgbOut);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Modify Image Colors en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by