From bf82b0738480fd8d402c62a767f51f86e2e10a79 Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Tue, 7 Jun 2011 18:53:03 +0200 Subject: [PATCH] Try to add progress bar for face detection plugin Does not work too well... --- sloth/plugins/facedetector.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sloth/plugins/facedetector.py b/sloth/plugins/facedetector.py index 418b926..bf37278 100644 --- a/sloth/plugins/facedetector.py +++ b/sloth/plugins/facedetector.py @@ -15,6 +15,10 @@ class FaceDetectorPlugin(QObject): det = BinaryPatternFaceDetector("/cvhci/data/mctcascades/new-detectors/face_frontal_new.xml") model = self.wnd_.model_ n_images = model.rowCount() + progress = QProgressDialog("Detecting faces...", "Abort", 0, n_images, self.wnd_); + progress.setWindowModality(Qt.WindowModal); + progress.show() + for i in range(n_images): index = model.index(i, 0) item = model.itemFromIndex(index) @@ -31,6 +35,10 @@ class FaceDetectorPlugin(QObject): 'confidence': face.conf, } model.addAnnotation(index, ann) + progress.setValue(i+1); + QCoreApplication.processEvents() + if progress.wasCanceled(): + break def action(self): return self.sc_