How can i detect Squire and Circle objects in image?

3 ビュー (過去 30 日間)
odai kiwan
odai kiwan 2018 年 2 月 26 日
コメント済み: odai kiwan 2018 年 2 月 26 日
My project is about detecting color and shapes, And i have two shapes (Circle and Squire).How can i detect the shape in this case. And after that extract the color of the shape? Like this image for example
  2 件のコメント
KSSV
KSSV 2018 年 2 月 26 日
Attach an image as an example....
odai kiwan
odai kiwan 2018 年 2 月 26 日
Like this one for example

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

採用された回答

KSSV
KSSV 2018 年 2 月 26 日
I = imread('circle.jpg') ;
I1 = im2bw(I) ;
[y,x] = find(I1~=1) ;
c = mean([x y]) ;
R = max(sqrt((c(1)-x).^2+(c(2)-y).^2)) ;
th = linspace(0,2*pi) ;
xc = c(1)+R*cos(th) ;
yc = c(2)+R*sin(th) ;
imshow(I) ;
hold on
plot(xc,yc,'r')
  1 件のコメント
odai kiwan
odai kiwan 2018 年 2 月 26 日
Thanks man!! And how i can extract whats the color in the circle??

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by