All entries for Friday 03 November 2006
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.