필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
i want to draw a diagonal in the given image from the top left corner to the bottom right corner

채택된 답변

Image Analyst
Image Analyst 2014년 1월 8일
[rows, columns, numberOfColorChannels] = size(rectangleImage);
x = [1, columns];
y = [1, rows];
line(x,y, 'LineWidth', 4, 'Color', [1, 0, 1]);
Adapt as needed.
  댓글 수: 2
Naishil shah
Naishil shah 2014년 1월 8일
편집: Naishil shah 2014년 1월 8일
I want to remove the top right trianglular portion from the image.How can I do that?
Image Analyst
Image Analyst 2014년 1월 8일
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);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by