Gait recognition systems can capture biometrical information from a distance and without the user's active cooperation, making them suitable for surveillance environments. However, there are two challenges for gait recognition that need to be solved, namely when: (i) the walking direction is unknown and/or (ii) the subject's appearance changes significantly due to different clothes being worn or items being carried. This study discusses the problem of gait recognition in unconstrained environments and proposes a new system to tackle recognition when facing the two listed challenges. The system automatically identifies the walking direction using a perceptual hash (PHash) computed over the leg region of the gait energy image (GEI) and then compares it against the PHash values of different walking directions stored in the database. Robustness against appearance changes are obtained by decomposing the GEI into sections and selecting those sections unaltered by appearance changes for comparison against a database containing GEI sections for the identified walking direction. The proposed recognition method then recognises the user using a majority decision voting. The proposed view-invariant gait recognition system is computationally inexpensive and outperforms the state-of-the-art in terms of recognition performance.