Skip to content

Commit

Permalink
Fix crash when correlation-tracker model is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
norihiro committed Apr 26, 2023
1 parent 7e16091 commit 3a1deee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/face-tracker-dlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct face_tracker_dlib_private_s
rectf_s upsize;
char *landmark_detection_data;
bool landmark_detection_data_updated;
bool sp_available = false;

face_tracker_dlib_private_s()
{
Expand Down Expand Up @@ -151,7 +152,9 @@ void face_tracker_dlib::track_main()
p->landmark_detection_data_updated = false;
blog(LOG_INFO, "loading file %s", p->landmark_detection_data);
try {
p->sp_available = false;
dlib::deserialize(p->landmark_detection_data) >> p->sp;
p->sp_available = true;
} catch (...) {
blog(LOG_ERROR, "Failed to load file %s", p->landmark_detection_data);
}
Expand All @@ -163,7 +166,8 @@ void face_tracker_dlib::track_main()
internal_division(r.left(), r.right(), p->upsize.x0 + 1.0f, p->upsize.x1),
internal_division(r.top(), r.bottom(), p->upsize.y0 + 1.0f, p->upsize.y1) );

p->shape = p->sp(img, r_face);
if (p->sp_available)
p->shape = p->sp(img, r_face);
p->last_scale = p->tex->scale;
}
}
Expand Down

0 comments on commit 3a1deee

Please sign in to comment.