All 2 entries tagged Image
November 03, 2006
Carrying on from the post where the blob algorithm was implemented, I’ve taken the process a few steps further. A canny operator is used on the original image, which returns a monochrome contour image showing edges within the picture. When I first researched into the canny operator I found the original paper which describes how and why the algorithm works but it was around 150 pages long! For this reason, I’ve nicked a class that was written by someone else on the Sun forums, which performs the canny operations on the image.
The end goal was to use the blob image as a mask on the contour image to filter out the area of the picture that was interesting – the person. The problem is that the blob generated is generally inside the outside edges of the person. For this reason, the blob image had to be dilated to make sure the mask was big enough to engulf the contour of the person. This was simply done by turning each matching pixel in the blob to a square of pixels.
To aid in eliminating noise from the background in the picture I limited the mask area to a region of interest (ROI). This was done by calculating the centroid of the matching pixels, and then using 2x the standard deviation of the euclidean distance of all matching pixels to draw the ROI. The final step to creating the mask was to add a smaller square to the top of the ROI square directly above the centroid which (hopefully!) captures the position of the head.
When masking the contour image with the mask blob, we get a model of the person which can be compared to the contour image in the next frame of a video stream. Below are a series of pictures representing the stages I’ve described.
The next step is to apply this image processor to a series of frames captured from a video stream and then do some motion tracking based on the contour lines.
October 31, 2006
I’ve started coding a mock up of the algorithm using Java (simply because it’s so easy using Java!) and have implemented the portion where the target colour is chosen. The idea is that during the robots startup phase, the person stands centrally to the robot wearing a plain T-Shirt that doesn’t have the same colours as the background. This initial colour is the colour the robot will use as part of its blob recognition to track the person.
Currently the code will take in a picture of someone standing central in the image. Using our models: Chris, Anthony and me, and my wonderous phone camera skills, the program analyses each pixel in the image systematically and turns the pixel white if there’s a hit, and black if it’s a miss. This is done with some basic statistical comparisons but not before every colour is normalised so that is completely discards any information regarding the intensity of the colours. This means that even if the lighting is very very dark, it is still able to know what colour it is. An averaging filter is then applied on the binary image to calculate the position of the person. This will discard any isolated pixels in the resultant image, therefore eliminating noise. Below are three of the pictures I’ve used and the binary image produced after applying the program. The intersection of the green lines indicate the centroid of the main blob, indicating the calculated position of the person.