Skip to content

Commit ed45da2

Browse files
authored
interface: add SIMPLE_PINHOLE model to COLMAP (#1226)
1 parent d7f587b commit ed45da2

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

apps/InterfaceCOLMAP/InterfaceCOLMAP.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,14 @@ struct Camera {
303303
in >> ID >> model >> width >> height;
304304
if (in.fail())
305305
return false;
306-
if (model != _T("PINHOLE"))
307-
return false;
308306
params.resize(4);
309-
in >> params[0] >> params[1] >> params[2] >> params[3];
307+
if (model == _T("PINHOLE")) {
308+
in >> params[0] >> params[1] >> params[2] >> params[3];
309+
} else if (model == _T("SIMPLE_PINHOLE")) {
310+
in >> params[0] >> params[2] >> params[3];
311+
params[1] = params[0];
312+
} else
313+
return false;
310314
return !in.fail();
311315
}
312316

@@ -325,10 +329,18 @@ struct Camera {
325329
model = mapCameraModel[ReadBinaryLittleEndian<int>(&stream)];
326330
width = (uint32_t)ReadBinaryLittleEndian<uint64_t>(&stream);
327331
height = (uint32_t)ReadBinaryLittleEndian<uint64_t>(&stream);
328-
if (model != _T("PINHOLE"))
329-
return false;
330332
params.resize(4);
331-
ReadBinaryLittleEndian<double>(&stream, &params);
333+
if (model == _T("PINHOLE")) {
334+
ReadBinaryLittleEndian<double>(&stream, &params);
335+
} else if (model == _T("SIMPLE_PINHOLE")) {
336+
std::vector<REAL> tmp_params(3);
337+
ReadBinaryLittleEndian<double>(&stream, &tmp_params);
338+
params[0] = tmp_params[0];
339+
params[1] = tmp_params[0];
340+
params[2] = tmp_params[1];
341+
params[3] = tmp_params[2];
342+
} else
343+
return false;
332344
return true;
333345
}
334346

0 commit comments

Comments
 (0)