diff --git a/dlib/data_io/image_dataset_metadata.cpp b/dlib/data_io/image_dataset_metadata.cpp index a701da537..fbe227476 100644 --- a/dlib/data_io/image_dataset_metadata.cpp +++ b/dlib/data_io/image_dataset_metadata.cpp @@ -78,6 +78,8 @@ namespace dlib fout << " occluded='" << b.occluded << "'"; if (b.ignore) fout << " ignore='" << b.ignore << "'"; + if (b.angle != 0) + fout << " angle='" << b.angle << "'"; if (b.has_label() || b.parts.size() != 0) { @@ -189,6 +191,7 @@ namespace dlib if (atts.is_in_list("truncated")) temp_box.truncated = sa = atts["truncated"]; if (atts.is_in_list("occluded")) temp_box.occluded = sa = atts["occluded"]; if (atts.is_in_list("ignore")) temp_box.ignore = sa = atts["ignore"]; + if (atts.is_in_list("angle")) temp_box.angle = sa = atts["angle"]; temp_box.rect.bottom() += temp_box.rect.top()-1; temp_box.rect.right() += temp_box.rect.left()-1; diff --git a/dlib/data_io/image_dataset_metadata.h b/dlib/data_io/image_dataset_metadata.h index 12b58f7ed..73815679f 100644 --- a/dlib/data_io/image_dataset_metadata.h +++ b/dlib/data_io/image_dataset_metadata.h @@ -32,7 +32,8 @@ namespace dlib difficult(false), truncated(false), occluded(false), - ignore(false) + ignore(false), + angle(0) {} rectangle rect; @@ -46,6 +47,13 @@ namespace dlib bool occluded; bool ignore; + // The angle of the object in radians. Positive values indicate that the + // object at the center of the box is rotated clockwise by angle radians. A + // value of 0 would indicate that the object is in its "standard" upright pose. + // Therefore, to make the object appear upright we would have to rotate the + // image counter-clockwise by angle radians. + double angle; + bool has_label() const { return label.size() != 0; } /*! ensures