Open Chungzuwalla opened 6 years ago
Attached Armadillo.ply, which the repro code needs. It is from the Stanford 3D Scanning Repository at http://graphics.stanford.edu/data/3Dscanrep/. Their page states "Please be sure to acknowledge the source of the data and models you take from this repository. You are welcome to use the data and models for research purposes. You are also welcome to mirror or redistribute them for free."
System information (version)
There is a bug in the linemod implementation which causes linemod to miss some valid template matches. The bug may even cause a newly created template to not match the source images it was created from.
The culprit is the code block at line 1295 in similarityLocal():
similarityLocal() takes a template match found at a coarse resolution, and verifies and localizes the match using a finer resolution. It does this by scanning for matches within a 16x16 subwindow centred on the coarse match position. The initial position for scanning is thus 8 blocks above and 8 blocks to the left of the coarse match position. If the coarse match position is within 8 blocks (8T pixels) of the top or left edge of the source images, the initial position for a feature may be outside the source images. In this case, as the code above shows, the feature is discarded and not scanned across the subwindow at all. That is a problem, because during scanning the feature would move into the source images and should make a contribution to the similarity image within the overlap region. The values in the similarity image then fail to reach the threshold for detection, so template matches are missed.
To fix this, features that only partially overlap the source images must still be evaluated within the overlap region. This means adding just a subrectangle of the 16x16 subwindow onto the similarity image. Since the speed of linemod relies on using SSE to process 16 blocks (a whole row of the 16x16 subwindow) at a time, there is a potential to lose speed, so the solution must be considered carefully. Possible solutions include:
On my machine (Xeon W3670 CPU) I can't measure a timing difference between aligned and unaligned 16-byte SSE instructions. But as the saying goes, we aren't shipping my machine. This probably needs attention from someone with good SSE experience.
Steps to reproduce
Code which matches each template against the depth map it was created from. In my case, only 355 of the 450 templates created match their own source 100%.
This code also does some timing tests, since any bugfix will inevitably have to be performance tested against the current implementation.