32 QStringList{
"icm"},
"icm",
33 QStringList{
"Clouds + calibrated images [meta][ascii] (*.icm)"},
41 QString(
"[ICM] Input filename contains special characters. It "
42 "might be rejected by the I/O filter..."));
46 FILE* fp = fopen(qPrintable(
filename),
"rt");
60 if (strncmp(line,
"#CC_ICM_FILE", 12) != 0) {
73 if (strncmp(line,
"FILE_NAME=", 10) != 0) {
77 sscanf(line,
"FILE_NAME=%s", cloudFileName);
84 if (strncmp(line,
"FILE_TYPE=", 10) != 0) {
88 sscanf(line,
"FILE_TYPE=%s", subFileType);
93 CVLog::Warning(QString(
"[ICM] No I/O filter found for loading file "
95 .arg(cloudFileName, subFileType));
103 QString(
"%1/%2").arg(
path, cloudFileName), parameters, filter,
114 CVLog::Error(
"[ICM] Read error (IMAGES_DESCRIPTOR)! No image loaded");
118 if (strncmp(line,
"IMAGES_DESCRIPTOR=", 18) != 0) {
123 sscanf(line,
"IMAGES_DESCRIPTOR=%s", imagesDescriptorFileName);
136 const QString& imageDescFilename,
137 const ccBBox& globalBBox) {
141 QString completeImageDescFilename =
142 QString(
"%1/%2").arg(
path, imageDescFilename);
145 CVLog::Warning(QString(
"[ICM] File '%1' contains special characters. "
146 "It might be rejected by the I/O filter...")
147 .arg(completeImageDescFilename));
150 FILE* fp = fopen(qPrintable(completeImageDescFilename),
"rt");
152 CVLog::Error(QString(
"[IcmFilter::loadCalibratedImages] Error opening "
154 .arg(completeImageDescFilename));
160 #ifdef INCLUDE_PHOTOS
161 char totalFileName[256];
163 int loadedImages = 0;
167 if (line[0] ==
'D' && line[1] ==
'E' && line[2] ==
'F') {
168 char imageFileName[256];
169 sscanf(line,
"DEF %s Viewpoint {", imageFileName);
174 if (!CI->
load(QString(
"%1/%2").arg(
path, imageFileName),
177 "(%2)! Process stopped...")
178 .arg(imageFileName, errorStr));
184 CVLog::Print(
"[IcmFilter] Image '%s' loaded", imageFileName);
187 #ifdef INCLUDE_PHOTOS
188 CI->setCompleteFileName(totalFileName);
200 sscanf(line,
"\t fieldOfView %f\n", &fov_rad);
213 sscanf(line,
"\t position %f %f %f\n", t, t + 1, t + 2);
215 CVLog::Print(
"\t Camera pos=(%f,%f,%f)", t[0], t[1], t[2]);
225 sscanf(line,
"\t description \"%s\"\n", desc);
231 float axis[3], angle_rad;
237 sscanf(line,
"\t orientation %f %f %f %f\n", axis, axis + 1,
238 axis + 2, &angle_rad);
240 CVLog::Print(
"\t Camera orientation=(%f,%f,%f)+[%f]", axis[0],
241 axis[1], axis[2], angle_rad);
244 params.vFOV_rad = fov_rad;
249 params.vertFocal_pix = 1.0f;
CC_FILE_ERROR
Typical I/O filter errors.
@ CC_FERR_WRONG_FILE_TYPE
const int MAX_ASCII_FILE_LINE_LENGTH
cmdLineReadable * params[]
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Print(const char *format,...)
Prints out a formatted message in console.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
static constexpr float DEFAULT_PRIORITY
static bool CheckForSpecialChars(const QString &filename)
Returns whether special characters are present in the input string.
static Shared FindBestFilterForExtension(const QString &ext)
Returns the best filter (presumably) to open a given file extension.
QSharedPointer< FileIOFilter > Shared
Shared type.
static ccHObject * LoadFromFile(const QString &filename, LoadParameters ¶meters, Shared filter, CC_FILE_ERROR &result)
Loads one or more entities from a file with a known filter.
static int LoadCalibratedImages(ccHObject *entities, const QString &path, const QString &imageDescFilename, const ccBBox &globalBBox)
virtual CC_FILE_ERROR loadFile(const QString &filename, ccHObject &container, LoadParameters ¶meters) override
Loads one or more entities from a file.
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
Camera (projective) sensor.
virtual void setVisible(bool state)
Sets entity visibility.
void initFromParameters(T alpha_rad, const Vector3Tpl< T > &axis3D, const Vector3Tpl< T > &t3D)
Inits transformation from a rotation axis, an angle and a translation.
Float version of ccGLMatrixTpl.
Hierarchical CLOUDVIEWER Object.
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
virtual ccBBox getBB_recursive(bool withGLFeatures=false, bool onlyEnabledChildren=true)
Returns the bounding-box of this entity and it's children.
unsigned getW() const
Returns image width.
bool load(const QString &filename, QString &error)
Loads image from file.
unsigned getH() const
Returns image height.
void setAssociatedSensor(ccCameraSensor *sensor)
Sets associated sensor.
virtual void setName(const QString &name)
Sets object name.
virtual void setEnabled(bool state)
Sets the "enabled" property.
virtual void setRigidTransformation(const ccGLMatrix &mat)
void setGraphicScale(PointCoordinateType scale)
Sets the sensor graphic representation scale.
T getDiagNorm() const
Returns diagonal length.
static const std::string path
float RadiansToDegrees(int radians)
Convert radians to degrees.
Generic loading parameters.
Intrinsic parameters of the camera sensor.