45 A =
B = C = D = Mat2f::Zero();
48 R = S =
V =
W = Vec2f::Zero();
50 for (
int r = -half_width; r <= half_width; ++r) {
51 for (
int c = -half_width; c <= half_width; ++c) {
58 float J =
SampleLinear(image_and_gradient2, yy2, xx2, 0);
67 A += gI * gI.transpose();
68 B += gI * gJ.transpose();
69 C += gJ * gJ.transpose();
79 Mat2f Di =
B.transpose().inverse();
82 *
U = A * Di * C + lambda * Di * C - 0.5 *
B;
83 *
e = (A + lambda * Mat2f::Identity()) * Di * (
V -
W) + 0.5 * (S -
R);
89 int half_window_size) {
91 int min_x =
floor(x) - half_window_size - 1;
92 int min_y =
floor(y) - half_window_size - 1;
93 if (min_x < 0.0 || min_y < 0.0) {
98 int max_x =
ceil(x) + half_window_size + 1;
99 int max_y =
ceil(y) + half_window_size + 1;
100 if (max_x > image1.
cols() || max_y > image1.
rows()) {
115 LG <<
"Fell out of image1's window with x1=" << x1 <<
", y1=" << y1
126 Vec2f d = Vec2f::Zero();
130 LG <<
"Fell out of image2's window with x2=" << *x2 <<
", y2=" << *y2
164 LG <<
"Determinant " <<
determinant <<
" is too small; failing tracking.";
167 LG <<
"x=" << *x2 <<
", y=" << *y2 <<
", dx=" << d[0] <<
", dy=" << d[1]
172 LG <<
"Successful track in " << i <<
" iterations.";
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
btScalar determinant() const
Return the determinant of the matrix.
3D array (row, column, channel).
ccl_device_inline float2 floor(const float2 a)
ccl_device_inline float2 fabs(const float2 a)
ccl_device_inline float3 ceil(const float3 a)
static void ComputeTrackingEquation(const Array3Df &image_and_gradient1, const Array3Df &image_and_gradient2, double x1, double y1, double x2, double y2, int half_width, float *gxx, float *gxy, float *gyy, float *ex, float *ey)
static bool RegionIsInBounds(const FloatImage &image1, double x, double y, int half_window_size)
Eigen::Matrix< float, 2, 2 > Mat2f
T SampleLinear(const Array3D< T > &image, float y, float x, int v=0)
Linear interpolation.
void BlurredImageAndDerivativesChannels(const Array3Df &in, double sigma, Array3Df *blurred_and_gradxy)
virtual bool Track(const FloatImage &image1, const FloatImage &image2, double x1, double y1, double *x2, double *y2) const
double min_update_squared_distance
CCL_NAMESPACE_BEGIN struct Window V