Commit 1d7a77a99601e87d75e083823d892ac5af5c7251
1 parent
10047515
Support for FDDB ellipse annotations
Showing
1 changed file
with
11 additions
and
2 deletions
openbr/plugins/gallery.cpp
| ... | ... | @@ -856,8 +856,17 @@ class FDDBGallery : public Gallery |
| 856 | 856 | for (int i=0; i<numDetects; i++) { |
| 857 | 857 | const QStringList detect = lines.takeFirst().split(' '); |
| 858 | 858 | Template t(fileName); |
| 859 | - t.file.set("Face", QRectF(detect[0].toFloat(), detect[1].toFloat(), detect[2].toFloat(), detect[3].toFloat())); | |
| 860 | - t.file.set("Confidence", detect[4].toFloat()); | |
| 859 | + if (detect.size() == 5) { //rectangle | |
| 860 | + t.file.set("Face", QRectF(detect[0].toFloat(), detect[1].toFloat(), detect[2].toFloat(), detect[3].toFloat())); | |
| 861 | + t.file.set("Confidence", detect[4].toFloat()); | |
| 862 | + } else if (detect.size() == 6) { //ellipse | |
| 863 | + float x = detect[3].toFloat(), | |
| 864 | + y = detect[4].toFloat(), | |
| 865 | + radius = detect[1].toFloat(); | |
| 866 | + t.file.set("Face", QRectF(x - radius,y - radius,radius * 2.0, radius * 2.0)); | |
| 867 | + t.file.set("Confidence", detect[5].toFloat()); | |
| 868 | + } else { //throw an exception? | |
| 869 | + } | |
| 861 | 870 | templates.append(t); |
| 862 | 871 | } |
| 863 | 872 | } | ... | ... |