shape_based_matching
try to implement halcon shape based matching, refer to machine vision algorithms and applications, page 317 3.11.5, written by halcon engineers
Shape-Based Matching
This project is a C++ implementation of an algorithm that finds objects in images by matching their shape, even when they're rotated, scaled, or partially obscured. Instead of looking for exact pixel-by-pixel matches, it identifies objects by analyzing the *direction* of brightness changes across the image—a technique that's much more robust to lighting variations, blur, and noise than traditional edge detection.
The core idea is straightforward: you show the algorithm a template image of the object you want to find (say, a circle or a specific part), and it learns the gradient directions at key points in that template. Then when you run it on a test image, it searches for regions where the gradient directions match, using fast mathematical tricks to check the entire image in milliseconds. Because gradient direction contains much richer information than simple edge detection (which only tells you "edge here" or "no edge"), you can reliably find your target shape even when the image is full of other visual clutter.
The project emphasizes speed and flexibility. It can handle up to 8,191 features per template (compared to just 63 in OpenCV's similar tool) and uses processor-specific optimizations to process 1,000 templates in around 20 milliseconds. It also includes convenient tools for testing with rotated and scaled versions of templates, making it practical for real-world computer vision tasks where objects appear at different angles and sizes.
Who would use this? Machine vision engineers building inspection systems (like finding components on circuit boards), robotic pick-and-place systems, or quality control software. Anyone needing to locate a specific object shape in photos quickly and reliably—especially in industrial or manufacturing settings where speed matters. The README doesn't provide detailed benchmarks beyond a few examples, but the test images show it working on circles, arbitrary shapes, and noisy conditions.