Skip to content

Commit

Permalink
Merge pull request #8 from hungrymonkey/change_facial_model_file_ending
Browse files Browse the repository at this point in the history
Change file ending for facial trained models to f68
  • Loading branch information
jcalifornia authored Oct 17, 2017
2 parents 5b19a50 + 9f4937e commit ac1ffb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions modules/motion_sense/facial_landmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ void FacialLandmark::startStreaming(){
}
dlib::cv_image<dlib::bgr_pixel> cimg(temp);
std::vector<dlib::rectangle> faces = detector(cimg);
//print_line("delected x faces: " + itos(faces.size()));
print_line("delected x faces: " + itos(faces.size()));

PoolVector<Vector2> pts;
if(faces.size()>0) {
dlib::full_object_detection dobj = (_model->get_data())(cimg, faces[0]);
dlib::rectangle r = dobj.get_rect();

PoolVector<Vector2> pts = utils::to_3dVec2(dobj);

emit_signal("facial_detect", Variant(utils::to_gRect(r)), Variant(pts));
}
//print_line("took X ms time processing: " + itos(os-> get_ticks_msec() -startTime));
Expand Down
4 changes: 2 additions & 2 deletions modules/motion_sense/facial_landmark_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ RES ResourceFormatFacialLandmark::load(const String &p_path, const String &p_ori

void ResourceFormatFacialLandmark::get_recognized_extensions(List<String> *p_extensions) const {

p_extensions->push_back("dat");
p_extensions->push_back("f68");
}
String ResourceFormatFacialLandmark::get_resource_type(const String &p_path) const {

if (p_path.get_extension().to_lower() == "dat")
if (p_path.get_extension().to_lower() == "f68")
return "FacialLandmarkModel";
return "";
}
Expand Down
4 changes: 3 additions & 1 deletion modules/motion_sense/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ PoolVector<Vector2> utils::to_3dVec2( dlib::full_object_detection &dobj ){
for( unsigned long i = 0; i < dobj.num_parts(); i++){
//shift it left cannot seem to find the faces in godot
long x = (dobj.part(i).x()-r.left());
long y = height - (dobj.part(i).y() - r.top());
//long y = height - (dobj.part(i).y() - r.top());
long y = (dobj.part(i).y()-r.top());
pts.set(i, Vector2(x, y));

}
return pts;
}

0 comments on commit ac1ffb7

Please sign in to comment.