patrikhuber / 4dface

Real-time 3D face tracking and reconstruction from 2D video
https://www.4dface.io
Apache License 2.0
793 stars 248 forks source link

Easy way to adjust frame size? #11

Closed aakashs closed 7 years ago

aakashs commented 7 years ago

Happy to say I've also gotten 4dface running on a mac using Homebrew.

Is there an easy way to adjust the frame size the tracking runs on? Would performance improve beyond 5fps after reducing the frame size of the webcam video?

Thanks in advance!

patrikhuber commented 7 years ago

Cool!

You can do a cv::resize() after you get the image from the camera. That should speed up things a bit. Another thing that helps I think is setting the number of shape coefficients to fit down to 8 or so. It's one of the last parameters of fitting::fit_shape(...).

There's lots of possibilities to improve the speed! For example, initialising the shape & expressions fitting loop with the result from the last frame should also provide a good speed up. And/or the texture extraction and rendering could be done with OpenGL for more speedup. I just currently don't have time to implement any of this properly.

aakashs commented 7 years ago

Awesome, thanks so much. Will probably try to improve frame rate in some ways myself and hopefully submit a PR.

patrikhuber commented 7 years ago

It's also always a good thing to start by running a profiler :-)