Find an object in an image by color
조회 수: 4 (최근 30일)
이전 댓글 표시
So I'm using a webcam to take a color picture of an area. In that area there is a red thing and a green thing among a bunch of other things. Basically I need to return the location of the center of the red thing and the green thing. The exact shape of the objects is not known in advance.
Basically I just need to tell matlab to find the color thing and have it give me coordinates from a color image
댓글 수: 0
채택된 답변
Image Analyst
2017년 4월 16일
See my attached demo where I track a green thing in the video. It's a simple matter to add a check for red things.
댓글 수: 3
Image Analyst
2017년 4월 17일
stats(r).Centroid would be a 1 by 2 array with the (x,y) coordinate of the r'th centroid. To get all centroids, for all blobs, do
centroids = [stats.Centroid];
xCentroids = centroids(1:2:end);
yCentroids = centroids(2:2:end);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!