@@ -60,11 +60,7 @@ DLIBWorker::DLIBWorker(class QSettings* config, const Settings *settings)
6060 config->endGroup ();
6161
6262 QFile refFile (_refFile);
63- if (!refFile.open (QIODevice::ReadOnly))
64- {
65- throw std::exception (" Reference photo list file can not be opened!" );
66- }
67- else
63+ if (refFile.open (QIODevice::ReadOnly))
6864 {
6965 QByteArray data = refFile.readAll ();
7066
@@ -97,9 +93,17 @@ DLIBWorker::DLIBWorker(class QSettings* config, const Settings *settings)
9793
9894#ifdef TURBOJPEG_AVAILABLE
9995 QMetaObject::invokeMethod (this , [this ]() {
100- m_tjHandle = tjInitDecompress ();
101- }, Qt::QueuedConnection);
96+ m_tjHandle = tjInitDecompress ();
97+ }, Qt::QueuedConnection);
10298#endif
99+
100+ QMetaObject::invokeMethod (this , [this ]() {
101+ detector = get_frontal_face_detector ();
102+ string landmarkModel = m_faceLandmarkModelFile.toStdString ();
103+ string recogModel = m_faceRecognitionModelFile.toStdString ();
104+ deserialize (landmarkModel) >> sp;
105+ deserialize (recogModel) >> net;
106+ }, Qt::QueuedConnection);
103107}
104108
105109DLIBWorker::~DLIBWorker ()
@@ -402,16 +406,10 @@ void DLIBWorker::process(const QByteArray& buffer)
402406 {
403407 if (m_refPhotoFileList.size () == 0 )
404408 {
405- throwException ( std::exception ( " Reference face list is empty!" ) );
409+ emit log ( " WARNING: Reference face list is empty!" );
406410 }
407411 else
408412 {
409- detector = get_frontal_face_detector ();
410- string landmarkModel = m_faceLandmarkModelFile.toStdString ();
411- string recogModel = m_faceRecognitionModelFile.toStdString ();
412- deserialize (landmarkModel) >> sp;
413- deserialize (recogModel) >> net;
414-
415413 setupReference (m_refPhotoFileList);
416414 }
417415 }
@@ -449,7 +447,8 @@ void DLIBWorker::process(const QByteArray& buffer)
449447 }
450448 catch (const std::exception& e)
451449 {
452- emit throwException (e);
450+ std::cerr << e.what () << std::endl;
451+ emit log (QString (" dlib exception: %1" ).arg (e.what ()));
453452 }
454453}
455454
0 commit comments