how can i detect triangle

3 ビュー (過去 30 日間)
Ahmad Jadoon
Ahmad Jadoon 2016 年 6 月 12 日
コメント済み: Ahmad Jadoon 2016 年 6 月 13 日
how can i detect green colour triangle from pic
  2 件のコメント
Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 6 月 12 日
is this image?
Ahmad Jadoon
Ahmad Jadoon 2016 年 6 月 13 日
yes

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2016 年 6 月 12 日
You can segment out that green triangle using either color or shape - your choice. I'm attaching demos for each. Feel free to adapt as needed.
  3 件のコメント
Image Analyst
Image Analyst 2016 年 6 月 13 日
Don't use for loops and simply vectorize it. Get rid of the size() and two for loops and simply have this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Get pixels that are greener than they are red or blue.
Triangle = greenChannel > redChannel & greenChannel > blueChannel;
Ahmad Jadoon
Ahmad Jadoon 2016 年 6 月 13 日
thanks sir

サインインしてコメントする。

その他の回答 (1 件)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 6 月 12 日
  1 件のコメント
Ahmad Jadoon
Ahmad Jadoon 2016 年 6 月 13 日
編集済み: Ahmad Jadoon 2016 年 6 月 13 日
i use this coding but it detect square ,.. plz help how can i detect triangle using this coding
clear all
clc
Img =imread('shapes.png');
subplot(2,2,1)
imshow(Img) % RGB Image
subplot(2,2,2)
[Height Width]=size(Img(:,:,2));
for i=1:Height
for j=1:Width
if Img(i,j,1:2)<115
Triangle(i,j)=Img(i,j);
else Triangle(i,j)=256;
end end end
imshow(Triangle) % Detected Triangle

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRed についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by