Object detection is an important component in the field of computer vision. Real-time detection of objects of any scale or rotation is a major challenge facing the industry today. In this study, we proposed a real-time size and orientation invariant template matching algorithm and hardware structure. In addition, we proposed image pyramid generation, patch orientation detection, descriptor generation, and descriptor matching methods. First, Scale invariance is achieved by generating a pyramid of nine images from the input image to simultaneously detect objects of different scales. Then, construct a window equal to the size of the template image from the original image to obtain the center point and direction of the window. We achieve rotation invariance by creating and rotating a descriptor based on the orientation of the window. Finally, the object is detected by matching it with the descriptor of the template. The proposed algorithm was implemented in Xilinx Virtex-7 xc7v2000tflg1925-1 FPGA. Throughput was 187 Frames/s regardless of the number of objects.