I want to get the contour of only red bird in the image

2 ビュー (過去 30 日間)
muhammad choudhry
muhammad choudhry 2020 年 7 月 15 日
コメント済み: muhammad choudhry 2020 年 7 月 15 日
Hi,
Can any one help, I want to see the contour of birds and then separately contour of red colour bird in the image only. Image attached!
I have tried to get the contour but getting this error.
Code:
I = imread('birds.jpg');
imshow(I)
I0 =rgb2gray(I);
imshow(I0)
figure;
imcontour(I0,2)
Error:
Error in imcontour (line 44)
contour(x,y,a,extra_args{:});
Error in contour (line 9)
imcontour(I0,2)
  2 件のコメント
Cris LaPierre
Cris LaPierre 2020 年 7 月 15 日
What version of MATLAB are you using? I ran your code and did not get any errors.
muhammad choudhry
muhammad choudhry 2020 年 7 月 15 日
Please see the screenshot, still getting the error.
version 2020

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

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 7 月 15 日
編集済み: Cris LaPierre 2020 年 7 月 15 日
Change the name of your file to something other than contour. Then in the command window, type clear contour and press enter.
Contour is the name of a MATLAB function that is used in lmcontour. However, due to MATLAB's precedence, it is using your script instead, causing the error.
  1 件のコメント
muhammad choudhry
muhammad choudhry 2020 年 7 月 15 日
Hi,
Thanks it resolve the first problem I am getting contours of every bird in the image. Second issue is I only want the contour of red bird (2nd one from the left) is there any way I pick up the colour from red bird and gives the command in the code in which it will only capture the red bird contour.
Thanks.

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

その他の回答 (0 件)

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by