In this paper, an improvement of deformable template matching algorithm for polygonal objects in grayscale images using two-dimensional deformable templates along orthogonal curves is presented. In the process of pre-computing extensions of the deformable template along orthogonal curves, the novel matching approach incorporates adapting knowledge-specific template discretization techniques appropriate for different polygonal objects and minimizing the improved internal and external energy terms containing inter-shape information of polygonal objects. In our application, this energy optimization problem of the deformable template is efficiently solved by a genetic algorithm (GA). Our algorithm has been successfully applied on synthetic images and real images. The experiment results show that the new approach provides more robust and accurate matching method.