Template matching is used in many applications, such as object recognition and motion tracking. In this study, we propose a template matching method that is robust against rotation and occlusion. For this purpose, we first divide a template image into several blocks. In the division, each block size is variable on the basis of the brightness distribution in the block region. Next, we search the matching position of each block by using a color histogram matching method whose result is rotational invariant. Then, from the matching coordinates of each block, we compute the Helmert transformation parameters and vote to the coordinates in the space composed of the parameters. Finally, we obtain the matching position of the template by searching the optimum Helmert transformation parameters from the coordinates where the sum of the vote is the maximum. We evaluate the efficacy of our method by means of several experiments. This method enables the robust extraction of an object which is rotated or occluded and is usable in many applications.