Read time: 1 minute
Here is the input image i.e. Robotic Vision Worksheet. The motive is to identify the shapes and colors out of it.
In this post: http://wp.me/p3CX0w-aD I created function getColor to take input the image above and the color and result we get is a binary image.
I started with MATLAB shape detection project problem. After getting the binary images from getColor function that I created (as in previous post) it’s now time to identify shapes (blobs) within the binary image (having two values 0 or 1, black or white). Here is the rough example:
function ans = getShape(im, shape)
b=iblobs(im);
[row, col] = size(b);
for i = 1:col
if(b(i).circularity >=0.90 & b(i).circularity <=1.1 & shape=='circle')
ans = b(i);
elseif(b(i).circularity >=0.60 & b(i).circularity <=0.62 & shape=='triangle')
ans = b(i);
else
ans = b(i);
end
end
end
Here im is the binary image created from the getColor function and shape may be ‘circle’, ‘triangle’ or ‘square’ etc. Actually this function doesn’t solves the problem.
The iblobs function of the Machine Vision Toolbox was taking too much to respond. After computing, it results into some blobs with area = 1, that means there are some white points (dots) in the binary image.
And later evening, the function stopped working and gave some error, I don’t know the reason behind it.