In earlier post, we mentioned basic operations of binary morphology. Here, we extend it to include hit-or-miss transform that is used for template matching. Also, using hit-or-miss, we define thinning operation, which may be used for skeletonization. Codes are provided in Python, which implement the operations from scratch.