Cleanup: use braces for sources in intern/
Omitted intern/itasc as some of these sources are from KDL: https://www.orocos.org/kdl.html
This commit is contained in:
@@ -307,10 +307,10 @@ TEST(ArrayND, MultiplyElementsGeneric) {
|
||||
MultiplyElements(A, B, &C);
|
||||
|
||||
ArrayND<double, 5>::Index cIndex;
|
||||
for (int d0 = 0; d0 < shape[0]; ++d0)
|
||||
for (int d1 = 0; d1 < shape[1]; ++d1)
|
||||
for (int d2 = 0; d2 < shape[2]; ++d2)
|
||||
for (int d3 = 0; d3 < shape[3]; ++d3)
|
||||
for (int d0 = 0; d0 < shape[0]; ++d0) {
|
||||
for (int d1 = 0; d1 < shape[1]; ++d1) {
|
||||
for (int d2 = 0; d2 < shape[2]; ++d2) {
|
||||
for (int d3 = 0; d3 < shape[3]; ++d3) {
|
||||
for (int d4 = 0; d4 < shape[4]; ++d4) {
|
||||
cIndex(0) = d0;
|
||||
cIndex(1) = d1;
|
||||
@@ -319,6 +319,10 @@ TEST(ArrayND, MultiplyElementsGeneric) {
|
||||
cIndex(4) = d4;
|
||||
EXPECT_EQ(2.2, C(cIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -331,18 +331,21 @@ void LaplaceFilter(unsigned char* src,
|
||||
int width,
|
||||
int height,
|
||||
int strength) {
|
||||
for (int y = 1; y < height - 1; y++)
|
||||
for (int y = 1; y < height - 1; y++) {
|
||||
for (int x = 1; x < width - 1; x++) {
|
||||
const unsigned char* s = &src[y * width + x];
|
||||
int l = 128 + s[-width - 1] + s[-width] + s[-width + 1] + s[1] -
|
||||
8 * s[0] + s[1] + s[width - 1] + s[width] + s[width + 1];
|
||||
int d = ((256 - strength) * s[0] + strength * l) / 256;
|
||||
if (d < 0)
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
if (d > 255)
|
||||
}
|
||||
if (d > 255) {
|
||||
d = 255;
|
||||
}
|
||||
dst[y * width + x] = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace libmv
|
||||
|
||||
@@ -38,8 +38,9 @@ TEST(Tuple, InitFromPointer) {
|
||||
float vals[3] = {1.0f, 2.0f, 3.0f};
|
||||
|
||||
Tuple<float, 3> t(vals);
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
EXPECT_EQ(t(i), vals[i]);
|
||||
}
|
||||
|
||||
Tuple<int, 3> b(t);
|
||||
EXPECT_EQ(b(0), int(vals[0]));
|
||||
|
||||
@@ -33,10 +33,12 @@ void PreconditionerFromPoints(const Mat& points, Mat3* T) {
|
||||
|
||||
// If variance is equal to 0.0 set scaling factor to identity.
|
||||
// -> Else it will provide nan value (because division by 0).
|
||||
if (variance(0) < 1e-8)
|
||||
if (variance(0) < 1e-8) {
|
||||
xfactor = mean(0) = 1.0;
|
||||
if (variance(1) < 1e-8)
|
||||
}
|
||||
if (variance(1) < 1e-8) {
|
||||
yfactor = mean(1) = 1.0;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
*T << xfactor, 0, -xfactor * mean(0),
|
||||
|
||||
@@ -63,8 +63,9 @@ TEST(Homography2DTest, Rotation45AndTranslationXY) {
|
||||
|
||||
Mat x2 = x1;
|
||||
// Transform point from ground truth matrix
|
||||
for (int i = 0; i < x2.cols(); ++i)
|
||||
for (int i = 0; i < x2.cols(); ++i) {
|
||||
x2.col(i) = m * x1.col(i);
|
||||
}
|
||||
|
||||
Mat3 homography_mat;
|
||||
EXPECT_TRUE(Homography2DFromCorrespondencesLinear(x1, x2, &homography_mat));
|
||||
@@ -128,8 +129,9 @@ TEST(Homography2DTest, AffineGeneral5) {
|
||||
// clang-format on
|
||||
|
||||
Mat x2 = x1;
|
||||
for (int i = 0; i < x2.cols(); ++i)
|
||||
for (int i = 0; i < x2.cols(); ++i) {
|
||||
x2.col(i) = m * x1.col(i);
|
||||
}
|
||||
|
||||
Mat3 homography_mat;
|
||||
EXPECT_TRUE(Homography2DFromCorrespondencesLinear(x1, x2, &homography_mat));
|
||||
@@ -165,8 +167,9 @@ TEST(Homography2DTest, HomographyGeneral) {
|
||||
// clang-format on
|
||||
|
||||
Mat x2 = x1;
|
||||
for (int i = 0; i < x2.cols(); ++i)
|
||||
for (int i = 0; i < x2.cols(); ++i) {
|
||||
x2.col(i) = m * x1.col(i);
|
||||
}
|
||||
|
||||
Mat3 homography_mat;
|
||||
EXPECT_TRUE(Homography2DFromCorrespondencesLinear(x1, x2, &homography_mat));
|
||||
|
||||
@@ -90,8 +90,9 @@ NViewDataSet NRealisticCamerasFull(int nviews,
|
||||
d.X *= 0.6;
|
||||
|
||||
Vecu all_point_ids(npoints);
|
||||
for (size_t j = 0; j < npoints; ++j)
|
||||
for (size_t j = 0; j < npoints; ++j) {
|
||||
all_point_ids[j] = j;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < nviews; ++i) {
|
||||
Vec3 camera_center, t, jitter, lookdir;
|
||||
|
||||
@@ -220,32 +220,39 @@ void DetectMORAVEC(const FloatImage& grayscale_image,
|
||||
SAD(s, s+r*stride-r, stride, stride)+SAD(s, s+r*stride, stride, stride)+SAD(s, s+r*stride+r, stride, stride);
|
||||
// clang-format on
|
||||
|
||||
score /= 256; // normalize
|
||||
if (pattern) // find only features similar to pattern
|
||||
score /= 256; // normalize
|
||||
if (pattern) { // find only features similar to pattern
|
||||
score -= SAD(s, pattern, stride, 16);
|
||||
if (score <= 16)
|
||||
continue; // filter very self-similar features
|
||||
}
|
||||
if (score <= 16) {
|
||||
continue; // filter very self-similar features
|
||||
}
|
||||
score -= 16; // translate to score/histogram values
|
||||
if (score > 255)
|
||||
if (score > 255) {
|
||||
score = 255; // clip
|
||||
}
|
||||
ubyte* c = &scores[y * width + x];
|
||||
for (int i = -distance; i < 0; i++) {
|
||||
for (int j = -distance; j < distance; j++) {
|
||||
int s = c[i * width + j];
|
||||
if (s == 0)
|
||||
if (s == 0) {
|
||||
continue;
|
||||
if (s >= score)
|
||||
}
|
||||
if (s >= score) {
|
||||
goto nonmax;
|
||||
}
|
||||
c[i * width + j] = 0;
|
||||
histogram[s]--;
|
||||
}
|
||||
}
|
||||
for (int i = 0, j = -distance; j < 0; j++) {
|
||||
int s = c[i * width + j];
|
||||
if (s == 0)
|
||||
if (s == 0) {
|
||||
continue;
|
||||
if (s >= score)
|
||||
}
|
||||
if (s >= score) {
|
||||
goto nonmax;
|
||||
}
|
||||
c[i * width + j] = 0;
|
||||
histogram[s]--;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,9 @@ void SelectKeyframesBasedOnGRICAndVariance(const Tracks& _tracks,
|
||||
<< current_keyframe << " and " << candidate_image;
|
||||
|
||||
// Not enough points to construct fundamental matrix
|
||||
if (x1.cols() < 8 || x2.cols() < 8)
|
||||
if (x1.cols() < 8 || x2.cols() < 8) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// STEP 1: Correspondence ratio constraint
|
||||
int Tc = tracked_markers.size();
|
||||
@@ -195,8 +196,9 @@ void SelectKeyframesBasedOnGRICAndVariance(const Tracks& _tracks,
|
||||
LG << "Correspondence between " << current_keyframe << " and "
|
||||
<< candidate_image << ": " << Rc;
|
||||
|
||||
if (Rc < Tmin || Rc > Tmax)
|
||||
if (Rc < Tmin || Rc > Tmax) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Mat3 H, F;
|
||||
|
||||
@@ -246,8 +248,9 @@ void SelectKeyframesBasedOnGRICAndVariance(const Tracks& _tracks,
|
||||
LG << "GRIC values for frames " << current_keyframe << " and "
|
||||
<< candidate_image << ", H-GRIC: " << GRIC_H << ", F-GRIC: " << GRIC_F;
|
||||
|
||||
if (GRIC_H <= GRIC_F)
|
||||
if (GRIC_H <= GRIC_F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO(sergey): STEP 4: PELC criterion
|
||||
|
||||
@@ -386,8 +389,9 @@ void SelectKeyframesBasedOnGRICAndVariance(const Tracks& _tracks,
|
||||
<< candidate_image << ": " << Sc;
|
||||
|
||||
// Pairing with a lower Sc indicates a better choice
|
||||
if (Sc > Sc_best_candidate)
|
||||
if (Sc > Sc_best_candidate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Sc_best_candidate = Sc;
|
||||
|
||||
@@ -405,8 +409,9 @@ void SelectKeyframesBasedOnGRICAndVariance(const Tracks& _tracks,
|
||||
if (next_keyframe == -1) {
|
||||
next_keyframe = current_keyframe + 10;
|
||||
|
||||
if (next_keyframe >= max_image)
|
||||
if (next_keyframe >= max_image) {
|
||||
break;
|
||||
}
|
||||
|
||||
LG << "Starting searching for keyframes starting from " << next_keyframe;
|
||||
} else {
|
||||
|
||||
@@ -130,17 +130,18 @@ static void CompleteReconstructionLogProgress(
|
||||
if (update_callback) {
|
||||
char message[256];
|
||||
|
||||
if (step)
|
||||
if (step) {
|
||||
snprintf(message,
|
||||
sizeof(message),
|
||||
"Completing solution %d%% | %s",
|
||||
(int)(progress * 100),
|
||||
step);
|
||||
else
|
||||
} else {
|
||||
snprintf(message,
|
||||
sizeof(message),
|
||||
"Completing solution %d%%",
|
||||
(int)(progress * 100));
|
||||
}
|
||||
|
||||
update_callback->invoke(progress, message);
|
||||
}
|
||||
|
||||
@@ -117,8 +117,9 @@ bool EuclideanResect(const vector<Marker>& markers,
|
||||
LG << "No fallback; failing resection for " << markers[0].image;
|
||||
return false;
|
||||
|
||||
if (!final_pass)
|
||||
if (!final_pass) {
|
||||
return false;
|
||||
}
|
||||
// Euclidean resection failed. Fall back to projective resection, which is
|
||||
// less reliable but better conditioned when there are many points.
|
||||
Mat34 P;
|
||||
|
||||
@@ -77,8 +77,9 @@ vector<Marker> Tracks::MarkersInBothImages(int image1, int image2) const {
|
||||
vector<Marker> markers;
|
||||
for (int i = 0; i < markers_.size(); ++i) {
|
||||
int image = markers_[i].image;
|
||||
if (image == image1 || image == image2)
|
||||
if (image == image1 || image == image2) {
|
||||
markers.push_back(markers_[i]);
|
||||
}
|
||||
}
|
||||
return markers;
|
||||
}
|
||||
|
||||
@@ -1595,8 +1595,9 @@ bool SamplePlanarPatch(const FloatImage& image,
|
||||
float mask_value =
|
||||
SampleLinear(*mask, image_position(1), image_position(0), 0);
|
||||
|
||||
for (int d = 0; d < image.Depth(); d++)
|
||||
for (int d = 0; d < image.Depth(); d++) {
|
||||
(*patch)(r, c, d) *= mask_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user