Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mumble module clean up #10

Closed
wants to merge 6,857 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
6857 commits
Select commit Hold shift + click to select a range
29db3ee
Added missing input validation to loss_mmod_. Specifically, the loss…
davisking Jul 31, 2017
a1f94e1
Fixed spelling error in comment.
davisking Aug 3, 2017
562d1b7
Clarified spec
davisking Aug 3, 2017
a7d1dc4
Filled out the options for loss_mmod's operator<<.
davisking Aug 3, 2017
aafde20
Added operator<< for random_cropper.
davisking Aug 3, 2017
9540ca2
Added operator<< for the DNN solvers.
davisking Aug 3, 2017
ed68378
Added get_synchronization_file() and get_test_one_step_calls() to dnn…
davisking Aug 3, 2017
8b21c89
Improved how the relaxed mmod overlap settings are determined.
davisking Aug 5, 2017
7b26b2d
Made dnn_trainer print the network size when logged to an iostream.
davisking Aug 5, 2017
0f2753b
Changed how we print the network hash.
davisking Aug 6, 2017
420eba0
Added note about logging training parameters.
davisking Aug 6, 2017
594df9a
Relaxes test to avoid false alarms.
davisking Aug 8, 2017
fa5c666
Added an overload of mat() that takes a row stride value.
davisking Aug 8, 2017
cf24f02
Added an object that lets you hold a copyable reference to a java arr…
davisking Aug 9, 2017
d62c5a7
merged
davisking Aug 9, 2017
d9f9354
Fixed a bug in the warning message about NMS overlap where it would s…
davisking Aug 10, 2017
af88b0d
merged
davisking Aug 10, 2017
ae13ad8
Added more options for controlling the install folder paths.
davisking Aug 10, 2017
8f3249a
merged
davisking Aug 10, 2017
44a62b1
A bit of path cleanup
davisking Aug 10, 2017
e99d47c
Removed exit call on load library failure.
davisking Aug 10, 2017
2630029
Fixed missing java:: qualifiers.
davisking Aug 10, 2017
4ab360e
Added DLIB_NO_ABORT_ON_2ND_FATAL_ERROR for dlib::fatal_error as a gen…
davisking Aug 10, 2017
46a02d9
Made swig always run when you rebuild to avoid stale swig outputs.
davisking Aug 10, 2017
f7310f4
Added multiply_zero_padded()
davisking Aug 11, 2017
aafa411
Added mult_prev layer.
davisking Aug 11, 2017
89c9267
Made copy_tensor() use cudaMemcpyAsync() rather than cudaMemcpy().
davisking Aug 14, 2017
7078cfa
Added an "add_to" option to tt:copy_tensor(). There was also a bug i…
davisking Aug 14, 2017
525cfc7
Added more tests for copy_tensor()
davisking Aug 14, 2017
9043c74
Added extract_ layer
davisking Aug 14, 2017
d6a1e27
Updated solvers to correctly pull in cont_'s bias parameter multipliers.
davisking Aug 14, 2017
4541a1b
Fixed grammar
davisking Aug 15, 2017
96619c8
merged
davisking Aug 15, 2017
48a56f3
Fixed spelling error
davisking Aug 15, 2017
0863386
merged
davisking Aug 15, 2017
98cf44e
Changed the random_cropper so that it samples background patches unif…
davisking Aug 18, 2017
2241e2c
merged
davisking Aug 18, 2017
b6d2329
Add a python wrapper for using the mmod face detector (#753)
ageitgey Aug 18, 2017
3156a5f
merged
davisking Aug 19, 2017
33513ab
Suppress compiler warning
davisking Aug 19, 2017
ba430be
Make DLIB_ASSERT statements not abort the python interpreter, but jus…
davisking Aug 19, 2017
618f108
The input_rgb_image_sized is supposed to be convertible to input_rgb_…
davisking Aug 20, 2017
dd62b0e
Made the dnn_trainer not forget all the previous loss values it knows…
davisking Aug 20, 2017
620178d
Changed the default get_test_iterations_without_progress_threshold() …
davisking Aug 20, 2017
dc071ce
Made the input_tensor_to_output_tensor() and output_tensor_to_input_t…
davisking Aug 20, 2017
dc45871
Made the loss value management a little more conservative.
davisking Aug 21, 2017
d009916
Added serialization support for the running_stats_decayed object.
davisking Aug 21, 2017
1db4694
Made the test loss in the verbose output messages from the dnn_traine…
davisking Aug 21, 2017
05c8391
Fixed warning in visual studio.
davisking Aug 21, 2017
f566b05
Fixed linker errors when building pyhton on windows. This fixes a bu…
davisking Aug 22, 2017
d92728b
Made windows testing bat file use rmdir rather than rm since rm isn't…
davisking Aug 22, 2017
ebb0f85
Fixed incorrect size() for simd8i.
davisking Aug 22, 2017
c3fa856
Fixed grammar
davisking Aug 23, 2017
a94aa00
updated docs
davisking Aug 23, 2017
9ba7889
merged
davisking Aug 23, 2017
faa75fa
Pull in external libpng dependencies properly (#770)
ipeterson Aug 24, 2017
18c42f3
Clang support for windows (#772)
e-fominov Aug 24, 2017
30ca8b4
Fully qualified boost::python::list to hopefully avoid compiler error…
davisking Aug 24, 2017
df03b6f
merged
davisking Aug 24, 2017
6a96269
Fixed spelling error in comment.
davisking Aug 24, 2017
8e61324
Fixed grammar
davisking Aug 24, 2017
ba8cc45
updated docs
davisking Aug 24, 2017
ef25c56
Include drectangle.h to point_transforms.h (#777)
denizevrenci Aug 25, 2017
6fbe3c6
C++11 features (#778)
denizevrenci Aug 25, 2017
e7774a4
Clarified spec
davisking Aug 25, 2017
5a0824c
Clarified spec
davisking Aug 25, 2017
2883650
Made resize_image() and functions that use it like the pyramid object…
davisking Aug 25, 2017
02cf246
Changed the functions that transform between input tensor coordinates…
davisking Aug 25, 2017
cf77875
Gave create_tiled_pyramid() the ability to include padding around the…
davisking Aug 26, 2017
bdd5016
Added options to input_rgb_image_pyramid that let the user set create…
davisking Aug 26, 2017
678728d
Made imglab --cluster ignore ignored boxes when doing all aspects of …
davisking Aug 26, 2017
ce3ed65
Added overloads of max_pointwise() and min_pointwise() that take 3 ar…
davisking Aug 26, 2017
0a7a75a
Added a version of resize_image() that works inplace.
davisking Aug 26, 2017
51eae2b
Added two vehicle detection examples.
davisking Aug 26, 2017
238febc
updated docs
davisking Aug 26, 2017
f6e23ca
Gave upsample_image_dataset() an option to limit upsampling on really…
davisking Aug 27, 2017
aec695f
Cleanup
davisking Aug 27, 2017
54de7a8
Added more comments
davisking Aug 27, 2017
efb1d83
More comments
davisking Aug 27, 2017
88c1bf3
Added youtube links
davisking Aug 27, 2017
71f78c1
Fixed compiler warnings
davisking Aug 27, 2017
5e9f094
Fixed compiler warning
davisking Aug 27, 2017
a362305
cleanup
davisking Aug 27, 2017
3211da4
Yet more comments
davisking Aug 27, 2017
306fd3a
updated docs
davisking Aug 27, 2017
71db541
Minor cleanup
davisking Aug 27, 2017
32e00f1
updated docs
davisking Aug 27, 2017
bbf3d98
improvements to cnn face detection python interface (#780)
guigzzz Aug 27, 2017
3263488
merged
davisking Aug 27, 2017
a4eb894
Set this file to executable
davisking Aug 27, 2017
763a6ef
Created release v19.5
davisking Aug 27, 2017
330a53d
Added tag v19.5 for changeset 9121e039950d
davisking Aug 27, 2017
50e8b23
Record last changeset and set PATCH version to 99
davisking Aug 27, 2017
ed9199e
saving more pypi notes
davisking Aug 28, 2017
2a33dc2
fix static runtime in cuda with clang and windows (#773)
e-fominov Aug 28, 2017
7767f68
merged
davisking Aug 28, 2017
ae9fe86
updated docs
davisking Aug 28, 2017
cf0f619
Created release v19.6
davisking Aug 28, 2017
e62f9ee
Added tag v19.6 for changeset 3eaa0e35b1b4
davisking Aug 28, 2017
7b9154f
Record last changeset and set PATCH version to 99
davisking Aug 28, 2017
0bb3d9f
Fixed error in input_rgb_image_pyramid::image_contained_point(). The…
davisking Aug 31, 2017
b8dc004
Improved error message.
davisking Aug 31, 2017
9e67724
Clarified spec
davisking Aug 31, 2017
f53c6c3
Fixed a bug in the extract layer that trigged when a tensor with a di…
davisking Aug 31, 2017
5940ebf
Made it so crossed out overlay boxes are drawn slightly faded.
davisking Sep 1, 2017
511c05a
Updated spec
davisking Sep 1, 2017
972bf3c
Made the box colors in imglab spread more evenly over the color space.
davisking Sep 1, 2017
60d474a
merged
davisking Sep 2, 2017
e5df3d8
merged
davisking Sep 2, 2017
ac5206e
merged
davisking Sep 2, 2017
b56f73c
Added box_percent_covered()
davisking Sep 2, 2017
770781a
Added a label field to mmod_rect and updated code that uses this obje…
davisking Sep 3, 2017
38db737
Fixed a bug in test_object_detection_function() which was just introd…
davisking Sep 3, 2017
14ae224
Made it so you can press END or i to ignore boxes in imglab. I did this
davisking Sep 3, 2017
f5a68de
mmod_options would pick bad window sizes in some corner cases. This …
davisking Sep 3, 2017
9ba4b45
Upgraded resize_bilinear() to let the user specify independent row an…
davisking Sep 4, 2017
8c2d87d
Added find_pyramid_down_output_image_size()
davisking Sep 4, 2017
9e54a20
Refactored create_tiled_pyramid() code to remove unnecessary copying.…
davisking Sep 5, 2017
a0febe7
Clarified spec
davisking Sep 5, 2017
8b48c09
Added face clustering example to Python API
Sep 5, 2017
07483b1
Added overloads of sub_image() that take raw pointers so you can make
davisking Sep 6, 2017
abf3925
Made cpu version of tt::resize_bilinear() use SIMD instructions and m…
davisking Sep 6, 2017
16327b6
Made input_rgb_image_pyramid use the GPU if available. So it's now a…
davisking Sep 6, 2017
ef57efc
Fix compiler error in visual studio.
davisking Sep 6, 2017
85c94dc
removed extraneous print statement.
davisking Sep 7, 2017
04e034a
Made object part annotations shown on the image_display scale relativ…
davisking Sep 9, 2017
93a1aba
Added threshold to clustering call
Sep 9, 2017
308bfa3
MMOD: fix loss from ignored rects when using loss_per_missed_target !…
reunanen Sep 10, 2017
205b26f
Improved citations
davisking Sep 11, 2017
8de1a1e
Improved citations
davisking Sep 11, 2017
bd26a5d
fix awkward grammar
davisking Sep 11, 2017
b6dc0d8
merged
davisking Sep 11, 2017
347863c
Added loss_ranking_ layer
davisking Sep 15, 2017
3fff7f8
Added more options to control how the feature pool region is defined.
davisking Sep 15, 2017
1c7bbbd
Upgraded render_face_detections() and get_face_chip_details() to supp…
davisking Sep 15, 2017
f84194f
Upgraded face recognition input validation checks to allow use of 5 p…
davisking Sep 15, 2017
4fcc5fa
Fixed grammar
davisking Sep 15, 2017
80222b5
Fixed grammar
davisking Sep 15, 2017
f56ba6b
Changed code to recommend users to use the new 5 point face landmarki…
davisking Sep 15, 2017
41c2f21
Changed code to recommend users use the new 5 point face landmarking …
davisking Sep 15, 2017
fb5cae0
Added this program for historical reference.
davisking Sep 16, 2017
0f8b227
Fixed typo in comment
davisking Sep 16, 2017
68d39c7
Changed TIME_THIS() to use std::chrono::high_resolution_clock
davisking Sep 16, 2017
37e0b9e
Updated comments.
davisking Sep 16, 2017
57b6cd1
clarified error message
davisking Sep 16, 2017
ffe1167
Made deserialize print more informative error messages.
davisking Sep 16, 2017
b4bd6f8
More cleanup
davisking Sep 16, 2017
5cf80dd
Merge branch 'master' of git://github.com/visionworkz/dlib into visio…
davisking Sep 16, 2017
5325526
Cleaned up code and comments.
davisking Sep 16, 2017
de32c75
Merge branch 'visionworkz-master'
davisking Sep 16, 2017
8bfd227
Changed to slightly better default recommendations for parameters.
davisking Sep 16, 2017
4737009
Clarified comments
davisking Sep 16, 2017
d39b843
Added another car finding example
davisking Sep 16, 2017
b7786a2
updated docs
davisking Sep 16, 2017
c24b67d
updated docs
davisking Sep 16, 2017
fd396af
updated docs
davisking Sep 16, 2017
836b2e0
updated docs
davisking Sep 17, 2017
02248a2
updated docs
davisking Sep 17, 2017
cf3f157
updated docs
davisking Sep 17, 2017
ba9c71d
Created release v19.7
davisking Sep 17, 2017
3e192c0
Added tag v19.7 for changeset fb51c77524ff
davisking Sep 17, 2017
da968fa
Record last changeset and set PATCH version to 99
davisking Sep 17, 2017
cabad6d
Fixed a bug in the random_cropper where it might crash due to divisio…
davisking Sep 17, 2017
9fe352d
Added size and padding as optional parameters
Sep 18, 2017
bd6f918
merged
davisking Sep 18, 2017
5f26972
Added code to get face_chip images..
Sep 19, 2017
3d4bd97
Made unit test more robust
davisking Sep 19, 2017
7e94daa
Cleaned up example file.
Sep 19, 2017
64942d9
Fixed a bug in how the mmod_options automatically determines detectio…
davisking Sep 21, 2017
7633361
Merge branch 'master' of git://github.com/visionworkz/dlib into visio…
davisking Sep 23, 2017
67e6957
Clarified comment and updated requirements.txt
davisking Sep 23, 2017
9987c0e
Merge branch 'visionworkz-master'
davisking Sep 23, 2017
178f420
Made cmake error messages a little clearer
davisking Sep 26, 2017
6283a4b
merged
davisking Sep 27, 2017
fa2f35f
cont layer: allow to set the number of filters at runtime (#845)
reunanen Sep 28, 2017
ea9aae0
Fix warning (#851)
hwchiu Sep 29, 2017
b9238fa
Clarified docs
davisking Oct 1, 2017
f66ff3b
Added faq about common object detection problems
davisking Oct 1, 2017
00b05ab
Made links in the faq never contain '
davisking Oct 1, 2017
c49e870
for some reason the shared library version does not seem to build
hungrymonkey Oct 1, 2017
9ce0c2c
added callback skeleton
hungrymonkey Oct 1, 2017
6ed35d5
I have to commit before adding git subtree mumlib
hungrymonkey Oct 1, 2017
41d3bc3
Add 'thirdparty/mumlib/' from commit 'c5fc079b4cf40651ef25b6915c03074…
hungrymonkey Oct 1, 2017
9a4cb2c
.pb.h filename is blocking me from building, I have to check google p…
hungrymonkey Oct 1, 2017
02dc248
the protoc command is really crude but the whole things builds
hungrymonkey Oct 1, 2017
0924832
fix some issues so it can build, I did a really ugly hack and added s…
hungrymonkey Oct 1, 2017
ef11687
commit my old callback.h
hungrymonkey Oct 1, 2017
4bb2655
cleaning up some code before I start adding other stuff to mumble
hungrymonkey Oct 1, 2017
85c7594
linked boost_system using system lib
hungrymonkey Oct 1, 2017
250b32a
seems to compile, now. I have to work on callback setter
hungrymonkey Oct 1, 2017
b7a8a22
i can might test, texting soon. woooooooooo
hungrymonkey Oct 1, 2017
54dc285
code compiles, I now have to test it in godot
hungrymonkey Oct 1, 2017
6a58332
it connect but it crash when trying to recieve a message
hungrymonkey Oct 2, 2017
1b4dc6b
added audio data callback. i dont know if it work but I have to fix t…
hungrymonkey Oct 2, 2017
473002b
fix a small logical error with converting short to byte
hungrymonkey Oct 2, 2017
e6f1948
Distros such as fedora have bash as default popd is a shell builtin.
hungrymonkey Oct 2, 2017
4f80b96
added packages to build this repo
hungrymonkey Oct 2, 2017
546cf33
forgot to add boost_system
hungrymonkey Oct 2, 2017
9d1a30f
i am cleaning up code and added a nullptr check to make sure it does …
hungrymonkey Oct 3, 2017
ab457fa
i have to debug the callback part where i create my own function
hungrymonkey Oct 3, 2017
1a8a8d3
i have to figure out how to use funcref properly
hungrymonkey Oct 3, 2017
880001f
added some stuff that does nto work. WOrking on ref
hungrymonkey Oct 3, 2017
3f42aa7
still crashes
hungrymonkey Oct 3, 2017
477fdfa
commit current nonworking code
hungrymonkey Oct 4, 2017
0c41ac3
Merge branch 'master' into mumble_module_nocmake
hungrymonkey Oct 4, 2017
815bbc7
texting works
hungrymonkey Oct 4, 2017
2425dca
Fixed spelling error
davisking Oct 4, 2017
7352ef0
merged
davisking Oct 4, 2017
c2a9dee
merged
davisking Oct 4, 2017
b0ca503
texting work on a few servers
hungrymonkey Oct 4, 2017
15a4b7f
change a few things
hungrymonkey Oct 4, 2017
24dffe4
Merge branch 'master' into mumble_module_nocmake
hungrymonkey Oct 4, 2017
23e90e9
i have to test audio send and listen
hungrymonkey Oct 5, 2017
21677c5
clean up code and it still crashes on voice
hungrymonkey Oct 5, 2017
4560c99
messup the common for loop
hungrymonkey Oct 6, 2017
604da65
fix some small issues and added print statements, I will remove it wh…
hungrymonkey Oct 6, 2017
cfa13bc
fix the data corruption but it did not fix the crashing
hungrymonkey Oct 6, 2017
e467d0a
change Mumble to be tracked by godot
hungrymonkey Oct 8, 2017
27f1ab2
Merge branch 'master' into mumble_module_nocmake
hungrymonkey Oct 8, 2017
2d2b0a0
delete print_line and unused functions
hungrymonkey Oct 8, 2017
5c03dbf
Merge pull request #4 from hungrymonkey/mumble_module_nocmake
jcalifornia Oct 8, 2017
e1d3c6c
added depends, its quite lazy since i install a meta package and dont…
hungrymonkey Oct 11, 2017
3044199
Add 'thirdparty/dlib/' from commit 'c2a9dee846cad7b20998ee0f3fae79b6b…
hungrymonkey Oct 11, 2017
5664de7
init commit, empty module
hungrymonkey Oct 11, 2017
a5a2d78
if CRLF to LF becomes and issue. we can always we pull later
hungrymonkey Oct 11, 2017
bd8c20d
commiting before i fix a different bug
hungrymonkey Oct 11, 2017
b2daa41
fix SCsub
hungrymonkey Oct 11, 2017
193349d
Merge branch 'rdrr_master' into dlib_facial
hungrymonkey Oct 11, 2017
7166d91
this commit is just a progress report. it will take awhile to finish …
hungrymonkey Oct 12, 2017
567521b
added a data model and resource loader, I might test it by finishing …
hungrymonkey Oct 12, 2017
c01422c
committing this code for now
hungrymonkey Oct 13, 2017
58a14b4
seems to be working abeit slow
hungrymonkey Oct 13, 2017
694550e
commit for now, the orientation might be broken
hungrymonkey Oct 14, 2017
ed8414d
Merge branch 'master' into rdrr_master
hungrymonkey Oct 14, 2017
ef3c570
breaking my old project and adding a rectangle bounding box
hungrymonkey Oct 14, 2017
b8cadf5
added bounding box
hungrymonkey Oct 14, 2017
c062820
Merge branch 'rdrr_master' into dlib_facial
hungrymonkey Oct 14, 2017
a55a68e
fix build a bit and other stuff
hungrymonkey Oct 15, 2017
e55e4e6
change the points to righthanded 3d
hungrymonkey Oct 15, 2017
581d78f
comment out timining code
hungrymonkey Oct 15, 2017
5b19a50
Merge pull request #6 from hungrymonkey/dlib_facial
jcalifornia Oct 15, 2017
9f4937e
forgot to return the points, and change file ending dat to f68
hungrymonkey Oct 17, 2017
ac1ffb7
Merge pull request #8 from hungrymonkey/change_facial_model_file_ending
jcalifornia Oct 17, 2017
82c6ffd
added crude incoming position data
hungrymonkey Oct 18, 2017
4232023
added positional data send
hungrymonkey Oct 18, 2017
b53248c
Merge commit '423202357e89af45f54181fe1dc467d2a4fbee53' into mumble_a…
hungrymonkey Oct 18, 2017
8cacf8c
change spaces to tabs like the rest of the godot
hungrymonkey Oct 18, 2017
cb73a44
well, it compiles. i have to test it
hungrymonkey Oct 18, 2017
de5e9fd
i cannot seem to figure out how to use godot to play sound
hungrymonkey Oct 18, 2017
dc29a9a
added a position vector to the signal
hungrymonkey Oct 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 36 additions & 0 deletions modules/motion_sense/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SCsub
Import('env')


motion_sense_env = env.Clone()
#http://dlib.net/compile.html
thirdparty_dlib_dir = "#thirdparty/dlib/"
thirdparty_dlib_srcs = [
"dlib/all/source.cpp"
]
thirdparty_dlib_sources = [ thirdparty_dlib_dir + dir for dir in thirdparty_dlib_srcs ]

thirdparty_system_path = [
"/usr/lib/x86_64-linux-gnu/",
"/usr/lib/",
"/lib/",
"/lib64/"
]

sources = [
"data_models.cpp",
"utils.cpp",
"facial_landmark_loader.cpp",
"facial_landmark.cpp",
"register_types.cpp"
]

motion_sense_env.Append(CCFLAGS=["-DLIB_NO_GUI_SUPPORT=1", "-DUSE_AVX_INSTRUCTIONS=1" ])
motion_sense_env.Append(CPPPATH=[thirdparty_dlib_dir])
#motion_sense_env.Append(LINKFLAGS=["-lopencv_core", "-lopencv" ] )

motion_sense_env.add_source_files(env.modules_sources,sources+thirdparty_dlib_sources)
motion_sense_env.Append(LIBS=["pthread"])
motion_sense_env.Append(LIBPATH=thirdparty_system_path)

motion_sense_env.Append(CXXFLAGS=['-O3', '-mavx', '-std=c++11'])
12 changes: 12 additions & 0 deletions modules/motion_sense/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# config.py

def can_build(platform):
return True

#TODO: needs to be tested on windows
def configure(env):
env.Append(LIBS=["opencv_core", "opencv_highgui"])
env.Append(CXXFLAGS=['-mavx'])

#env.Append(CCFLAGS=["-DLIB_NO_GUI_SUPPORT=1", "-DUSE_AVX_INSTRUCTIONS=1" ])
#env.ParseConfig('pkg-config opencv --cflags --libs')
48 changes: 48 additions & 0 deletions modules/motion_sense/data_models.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "data_models.h"
#include <istream>
#include <streambuf>
#include <cstdio>
#include "vector.h"
#include "os/file_access.h"

class GodotFileInStreamBuf : public std::streambuf{
public:
GodotFileInStreamBuf(FileAccess * fa) {
_file = fa;
}
int underflow(){
if (_file->eof_reached()){
return EOF;
}else{
size_t pos = _file->get_position();
uint8_t ret = _file->get_8();
_file->seek(pos);
return ret;
}
}
int uflow(){
return _file->eof_reached() ? EOF : _file -> get_8();
}
private:
FileAccess * _file;
};

Error FacialLandmarkModel::set_file(const String &p_file) {
file = p_file;
Error err;
FileAccess *f = FileAccess::open(file, FileAccess::READ, &err);
if (err) {
ERR_FAIL_COND_V(err, err);
}
int _err;
GodotFileInStreamBuf sBuf(f);
std::istream is(&sBuf);
//http://dlib.net/dlib/serialize.h.html

dlib::deserialize(_pose_model, is);
memdelete(f);
}

FacialLandmarkModel::FacialLandmarkModel() {

}
21 changes: 21 additions & 0 deletions modules/motion_sense/data_models.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "resource.h"
#include "reference.h"

#ifndef FACIAL_LANDMARK_MODEL_H
#define FACIAL_LANDMARK_MODEL_H

#include <dlib/image_processing.h>

class FacialLandmarkModel : public Resource{
GDCLASS(FacialLandmarkModel, Resource);

public:
FacialLandmarkModel();
Error set_file(const String &p_file);
dlib::shape_predictor &get_data() { return _pose_model; }
private:
dlib::shape_predictor _pose_model;
String file;

};
#endif
76 changes: 76 additions & 0 deletions modules/motion_sense/facial_landmark.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* facial_landmark.cpp */

#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>
#include <dlib/opencv.h>
#include <vector>
#include "facial_landmark.h"
#include "utils.h"
#include "variant.h"
#include "math/math_2d.h"
#include "print_string.h"
#include "dvector.h"
#include "os/os.h"

void FacialLandmark::_bind_methods() {
ClassDB::bind_method(D_METHOD("start"), &FacialLandmark::startStreaming);
ClassDB::bind_method(D_METHOD("stop"), &FacialLandmark::stopStreaming);
ClassDB::bind_method(D_METHOD("set_data", "trained_model"), &FacialLandmark::set_data);


ADD_SIGNAL(MethodInfo("facial_detect", PropertyInfo(Variant::RECT2, "bounding_box"), PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points")));

BIND_ENUM_CONSTANT(STATUS_ERROR);
BIND_ENUM_CONSTANT(STATUS_NONE);
BIND_ENUM_CONSTANT(STATUS_STOPPED);
BIND_ENUM_CONSTANT(STATUS_RUNNING);

}

FacialLandmark::FacialLandmark() : _vc(0), _state(STATUS_NONE) {

}

void FacialLandmark::set_data(Ref<FacialLandmarkModel> m){
_model = m;
}

void FacialLandmark::startStreaming(){
if(!_vc.isOpened()){
ERR_PRINT("FacialLandmark: unable to connect to camera\n");
_state = STATUS_ERROR;
}
//OS *os = OS::get_singleton();
_state = STATUS_RUNNING;
dlib::frontal_face_detector detector = dlib::get_frontal_face_detector();
while( _state == STATUS_RUNNING ){
cv::Mat temp;

// int startTime = os ->get_ticks_msec();
if (!_vc.read(temp)){
ERR_PRINT("FacialLandmark: unable to read to camera\n");
break;
}
dlib::cv_image<dlib::bgr_pixel> cimg(temp);
std::vector<dlib::rectangle> faces = detector(cimg);
print_line("delected x faces: " + itos(faces.size()));

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));
}

}
void FacialLandmark::stopStreaming(){
if( _state == STATUS_RUNNING ){
_state = STATUS_STOPPED;
}
}


38 changes: 38 additions & 0 deletions modules/motion_sense/facial_landmark.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* facial_landmark.h */
#ifndef FACIAL_LANDMARK_H
#define FACIAL_LANDMARK_H

#include "reference.h"
#include "resource.h"
#include "data_models.h"
#include <opencv2/opencv.hpp>


class FacialLandmark : public Reference {
GDCLASS(FacialLandmark,Reference);
public:
enum Status{
STATUS_NONE,
STATUS_STOPPED,
STATUS_RUNNING,
STATUS_ERROR
};
private:
cv::VideoCapture _vc;
Ref<FacialLandmarkModel> _model;
Status _state;

protected:
static void _bind_methods();

public:

FacialLandmark();
void startStreaming();
void stopStreaming();
void set_data(Ref<FacialLandmarkModel> m);
};

VARIANT_ENUM_CAST(FacialLandmark::Status);
#endif

28 changes: 28 additions & 0 deletions modules/motion_sense/facial_landmark_loader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "facial_landmark_loader.h"
#include "data_models.h"

ResourceFormatFacialLandmark::ResourceFormatFacialLandmark() {
}
RES ResourceFormatFacialLandmark::load(const String &p_path, const String &p_original_path, Error *r_error) {
if (r_error)
*r_error = OK;

FacialLandmarkModel *facial_landmark = memnew(FacialLandmarkModel);
facial_landmark->set_file(p_path);
return Ref<FacialLandmarkModel>(facial_landmark);
}

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

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

if (p_path.get_extension().to_lower() == "f68")
return "FacialLandmarkModel";
return "";
}

bool ResourceFormatFacialLandmark::handles_type(const String &p_type) const {
return (p_type == "FacialLandmarkModel");
}
19 changes: 19 additions & 0 deletions modules/motion_sense/facial_landmark_loader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef FACIAL_LANDMARK_LOADER_H
#define FACIAL_LANDMARK_LOADER_H

#include "io/resource_loader.h"


class ResourceFormatFacialLandmark : public ResourceFormatLoader {
public:
virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;

ResourceFormatFacialLandmark();
virtual ~ResourceFormatFacialLandmark() {}
};


#endif // FACIAL_LANDMARK_LOADER_H
19 changes: 19 additions & 0 deletions modules/motion_sense/register_types.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "register_types.h"
#include "class_db.h"
#include "facial_landmark.h"
#include "facial_landmark_loader.h"
#include "data_models.h"

static ResourceFormatFacialLandmark *facial_landmark_loader = NULL;

void register_motion_sense_types(){
ClassDB::register_class<FacialLandmark>();
ClassDB::register_class<FacialLandmarkModel>();

facial_landmark_loader = memnew(ResourceFormatFacialLandmark);
ResourceLoader::add_resource_format_loader(facial_landmark_loader);

}
void unregister_motion_sense_types(){
}

3 changes: 3 additions & 0 deletions modules/motion_sense/register_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void register_motion_sense_types();
void unregister_motion_sense_types();

26 changes: 26 additions & 0 deletions modules/motion_sense/utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "utils.h"

#define ABS(x) x > 0 ? x : -x

Rect2 utils::to_gRect( dlib::rectangle &r ){
long height = r.top() - r.bottom();
long width = r.right() - r.left();
return Rect2( 0, 0, ABS(width), ABS(height) );
}

PoolVector<Vector2> utils::to_3dVec2( dlib::full_object_detection &dobj ){
PoolVector<Vector2> pts;
dlib::rectangle r = dobj.get_rect();
long height = ABS(r.top() - r.bottom());
long width = ABS(r.right() - r.left());
pts.resize(dobj.num_parts());
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 = (dobj.part(i).y()-r.top());
pts.set(i, Vector2(x, y));

}
return pts;
}
27 changes: 27 additions & 0 deletions modules/motion_sense/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <dlib/geometry/rectangle.h>
#include <dlib/image_processing/full_object_detection.h>

#include "math/math_2d.h"
#include "dvector.h"

/*images seem to be lefthanded such as
* 0123
* 1
* 2
* 3
*
* godot3d should be right handed
*
*
* need to translate between the two
*/
namespace utils{
//http://introcomputing.org/image-introduction.html
//2d and 3d coordate system are seperate in godot
//https://github.com/GodotNativeTools/godot-cpp/blob/master/include/core/Transform2D.hpp#L22
//http://docs.godotengine.org/en/latest/classes/class_rect2.html
//http://dlib.net/dlib/geometry/rectangle.h.html
Rect2 to_gRect( dlib::rectangle &r );
PoolVector<Vector2> to_3dVec2( dlib::full_object_detection &obj);

}
4 changes: 4 additions & 0 deletions modules/mumble/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.backup
*.back
*.pyc
*.o
Loading