Gait Recognition - Batch Image Resizing & Cropping
The background subtracted images were then cropped and resized to 64x64 squares. This was done automatically by a batch processing utility with the following functions:
All of the images are scanned for the largest object in each frame using a connected component analysis. This information is then used to get the dimensions of the largest silouette over all the frames.
A resizing ratio is then calculated such that the largest object from the frames will take up the full 64pixel height. The aspect ratio is retained for all the images. The images are then cropped and resized according to this aspect ratio.
Cropping example (left images are actually 720x576 - resized for web view):
![]() |
>> cropping and resizing >> | ![]() |
![]() |
>> cropping and resizing >> | ![]() |
![]() |
>> cropping and resizing >> | ![]() |
The subjects are also centered in the output frame so that their body always appears at the same point in the image. This makes the resulting symmetry output much cleaner. The result of this is shown below:
Body of the subject moves during gait cycle | Subject after body has been centralised |
This cropping, resizing and centralising is performed by a command line application written in java. It is run by the following command:
java CropResize dir1 dir2 dir3...
The application runs through each of the directories listed, cropping and resizing all of the png files within them. The output files are stored in the same directory, with the suffix "_scaled" on the end of the filename.
Download this application: