Detecting Object in an Image

1. How to detect an object in an image?
Determining the features from the object that you want to detect is the key. The feature in this case is something that differentiates the object from others, such as color, shape, size, etc…

2. What are the techniques for object detection?

The image processing techniques such as morphology or color processing usually did this job. A simple example in Scilab of detecting ‘white rabbit’ is shown as follow, in this case, ‘color’ is the feature used to distinguish the white rabbit from other:



// Original Image
S = imread('p3-in1.jpg');
ShowColorImage(S,'0');



// Gray scale image
S2 = rgb2gray(S);
ShowImage(S2,'0');



// Find the white color
S3 = S2>180;
ShowImage(S3,'0');



// Morphology technique, image erosion to erase the unwanted components
se = CreateStructureElement('vertical_line', 10);
S4 = ErodeImage(S3, se);
se = CreateStructureElement('horizontal_line', 10);
S4 = ErodeImage(S4, se);
ShowImage(S4,'0');


// Labeled the component(s), and plot the centroid on the original image
S5 = S4.*1;
IsCalculated = CreateFeatureStruct(%f); // Feature struct is generated.
IsCalculated.Centroid = %t; // The bounding box shall be calculated for each blob.
S6 = AnalyzeBlobs(S5, IsCalculated);
ShowColorImage(S,'0');
plot(S6(1).Centroid(1),S6(1).Centroid(2),'r*');