46 #ifndef vpXMLPARSERCAMERA_H
47 #define vpXMLPARSERCAMERA_H
49 #include <visp3/core/vpConfig.h>
53 #include <libxml/xmlmemory.h>
55 #include <visp3/core/vpCameraParameters.h>
56 #include <visp3/core/vpXmlParser.h>
198 CODE_XML_CAMERA_NAME,
201 CODE_XML_SUBSAMPLING_WIDTH,
202 CODE_XML_SUBSAMPLING_HEIGHT,
203 CODE_XML_FULL_HEIGHT,
213 CODE_XML_ADDITIONAL_INFO
216 typedef enum { SEQUENCE_OK, SEQUENCE_ERROR } vpXmlCodeSequenceType;
220 std::string camera_name;
221 unsigned int image_width;
222 unsigned int image_height;
223 unsigned int subsampling_width;
224 unsigned int subsampling_height;
225 unsigned int full_width;
226 unsigned int full_height;
230 static const int allowedPixelDiffOnImageSize = 15;
239 std::string getCameraName() {
return this->camera_name; }
241 unsigned int getHeight() {
return this->image_height; }
242 unsigned int getSubsampling_width() {
return this->subsampling_width; }
243 unsigned int getSubsampling_height() {
return this->subsampling_height; }
244 unsigned int getWidth() {
return this->image_width; }
250 const unsigned int image_height = 0);
253 const unsigned int image_width = 0,
const unsigned int image_height = 0,
254 const std::string &additionalInfo =
"");
256 void setCameraName(
const std::string &name) { this->camera_name = name; }
257 void setHeight(
const unsigned int height) { this->image_height = height; }
258 void setSubsampling_width(
const unsigned int subsampling) { this->subsampling_width = subsampling; }
259 void setSubsampling_height(
const unsigned int subsampling) { this->subsampling_height = subsampling; }
260 void setWidth(
const unsigned int width) { this->image_width = width; }
263 int read(xmlDocPtr doc, xmlNodePtr node,
const std::string &camera_name,
265 const unsigned int image_height = 0,
const unsigned int subsampling_width = 0,
266 const unsigned int subsampling_height = 0);
268 int count(xmlDocPtr doc, xmlNodePtr node,
const std::string &camera_name,
270 const unsigned int image_height = 0,
const unsigned int subsampling_width = 0,
271 const unsigned int subsampling_height = 0);
273 int read_camera(xmlDocPtr doc, xmlNodePtr node,
const std::string &camera_name,
275 const unsigned int image_height = 0,
const unsigned int subsampling_width = 0,
276 const unsigned int subsampling_height = 0);
278 xmlNodePtr find_camera(xmlDocPtr doc, xmlNodePtr node,
const std::string &camera_name,
279 const unsigned int image_width = 0,
const unsigned int image_height = 0,
280 const unsigned int subsampling_width = 0,
const unsigned int subsampling_height = 0);
282 xmlNodePtr find_additional_info(xmlNodePtr node);
284 vpXmlCodeSequenceType read_camera_model(xmlDocPtr doc, xmlNodePtr node,
vpCameraParameters &camera);
286 int read_camera_header(xmlDocPtr doc, xmlNodePtr node,
const std::string &camera_name,
287 const unsigned int image_width = 0,
const unsigned int image_height = 0,
288 const unsigned int subsampling_width = 0,
const unsigned int subsampling_height = 0);
290 static vpXmlCodeSequenceType str2xmlcode(
char *str, vpXmlCodeType &res);
291 void myXmlReadIntChild(xmlDocPtr doc, xmlNodePtr node,
int &res, vpXmlCodeSequenceType &code_error);
293 void myXmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node,
double &res, vpXmlCodeSequenceType &code_error);
295 void myXmlReadCharChild(xmlDocPtr doc, xmlNodePtr node,
char **res);
296 int write(xmlNodePtr node,
const std::string &camera_name,
const unsigned int image_width = 0,
297 const unsigned int image_height = 0,
const unsigned int subsampling_width = 0,
298 const unsigned int subsampling_height = 0);
299 int write_camera(xmlNodePtr node_camera);
316 #endif // VISP_HAVE_XML2