Code covered by the BSD License  

Highlights from
Automata Engineer 2010 NITK- Documented version

image thumbnail

Automata Engineer 2010 NITK- Documented version

by

 

The documented version of the code which solves the problem statement of Automata Engineer 2010 NITK

food_loc( food )
function [ loc ] = food_loc( food )
%to get the location of the food
%input: the rgb image of food
%output: location of the food

%food=imread('foo2.jpg');
%imshow(food)
foobw=food(:,:,2)-food(:,:,1);
%imshow(foobw)
foo=im2bw(foobw);
%imshow(foo)
foo_label=bwlabel(foo);
foo_prop=regionprops(foo_label,'Centroid');
x=foo_prop.Centroid(1);
y=foo_prop.Centroid(2);
nx=(x-(320/12))*(6/320)+1;
ny=(y-(240/10))*(5/240)+1;
mat=[2,7,12,17,22,27;
     3,8,13,18,23,28;
     4,9,14,19,24,29;
     5,10,15,20,25,30;
     6,11,16,21,26,31];
 loc=mat(uint8(ny),uint8(nx));


%   Detailed explanation goes here


end

Contact us