Bob-O-Rama / cvfind

Project cleanup and cpfind alternative for Hugin
https://bob-o-rama.smugmug.com/CvFind-Project/i-5GtztJX
Apache License 2.0
6 stars 0 forks source link

cvfind returns more control points than expected for given --cpperpairmax and --cellmaxcp options #1

Closed Bob-O-Rama closed 11 months ago

Bob-O-Rama commented 12 months ago

The default value or --cpperpairmax is 200 and --cellmaxcp is 5, the latter setting should prevent more than 5 control points for a --cellsize area. cvfind will often return significantly more than this number of control points per pair or in a decimation cell ( 100x100 px by default ) area. This suggests the final "decimation" algorithm is broken. Its intended purpose is to eliminate "bunches" of nearby control points and limit the overall number returned, while returning the highest confidence control points.

Bob-O-Rama commented 11 months ago

The algorithm for control point decimation does not function as desired. A new method will be implemented via a more modular filter that uses parallel array sorting after binning to grade the CPs in a given cell. The decimation is then conducted in place on the sorted cell-wise arrays using the --cellcpdupdist option which is set to a sane value if not specified. After deduplication, the best control points are selected from random cells until --cpperpairmax is reached.

Bob-O-Rama commented 11 months ago

Decimation algorithm now works correctly and respects both --cellcpdupdist and --cpperpairmax. When --cpperpairmax is small compared to the number of cells ( which may be in the hundreds ) the algorithm uses a pseudo random 1:1 prime mod hash to pull control points from cells covering the entire overlap area. This generally provides identical results to Hugin cpfind in terms of spreading control points. Added --cellcpdupdist parameter to parser and help. This parameter should tune itself when cellsize is specified. Regression tested against PTO parsed CPs and feature detection login. Committed to main branch.