mirror of
https://github.com/opencv/opencv.git
synced 2026-11-09 18:04:29 -06:00
The tracker normalizes the images it feeds to the network with Image2BlobParams, whose per-channel factor has to be 1/(255*std). It was computed as `(1.0 / stdvalue) * (1 / 255.0)`, but `double / Scalar` is Scalar's quaternion inverse, not an elementwise division, and `Scalar / Scalar` is defined through that same inverse. The last three elements were therefore conjugated and the whole result divided by their sum of squares, so with the default std = (0.229, 0.224, 0.225) the green and red planes reached the network negated and all three were about a third of the intended magnitude. Build the factor channel by channel in both create() overloads, and cover it with a test that compares the response of the network the tracker feeds against an identical network fed the documented normalization of the same template crop.