• gm_faceapi - Facetracking with only a webcam.
    23 replies, posted
  • Avatar of Hentie
  • Well I sent my module to about 10 people and they have done absolutely nothing with it, so I'm just going to go ahead and release it. This module automatically chooses the first webcam it can find. (The current API is messed up and won't let me list all the cameras available). To make sure faceAPI works with your processor and camera, download the examples on the faceAPI website. There might be some drivers that you would need to run this module that is included with the example on the faceAPI website. [url=http://henrys-hub.googlecode.com/files/gm_faceapi_src.rar]Source[/url] [url=http://henrys-hub.googlecode.com/files/faceAPI_release.rar]Download[/url] [lua]faceAPI.GetVersion() -- Returns the string of the current version of faceAPI the module uses. faceAPI.GetHeadPos() -- Returns the current position of your head. faceAPI.GetHeadAng() -- Returns the current angle of your head. FACEAPI_ENABLED -- Global that is set if the module is properly ran.[/lua]
  • I think this might be useful. If someone could give me some code to move the players head angle, that would be nice!
  • Avatar of Jvs
  • [QUOTE=tazy4tazy;31151827]I think this might be useful. If someone could give me some code to move the players head angle, that would be nice![/QUOTE] Are you kidding me? It's in the example file. [lua] if !CLIENT then return end require("faceapi") function faceAPI_demoCalcView(pl, pos, angles, fov) local WorldPos,WorldAng = LocalToWorld(faceAPI.GetHeadPos()*300+Vector(130,0,0),faceAPI.GetHeadAng(),pos,angles) // I add 130 forward since faceAPI's head center is a bit too close. local view = {} view.origin = WorldPos view.angles = WorldAng view.fov = fov return view end hook.Add("CalcView", "faceAPI_demoCalcView", faceAPI_demoCalcView) [/lua]
  • I've installed the whole thing correctly but I get this error when requiring faceapi: [code]error loading module 'faceapi' from file 'c:\program files (x86)\steam\steamapps\<snip>\garrysmod\garrysmod\lua\includes\modules\gm_faceapi.dll': Impossível localizar o módulo especificado. (Impossible to locate the specified module) [/code]
  • Avatar of FlapadarV2
  • [QUOTE=ZpankR;31161834]I've installed the whole thing correctly but I get this error when requiring faceapi: [code]error loading module 'faceapi' from file 'c:\program files (x86)\steam\steamapps\<snip>\garrysmod\garrysmod\lua\includes\modules\gm_faceapi.dll': Impossível localizar o módulo especificado. (Impossible to locate the specified module) [/code][/QUOTE] Install VS2010 redistributables. [url]http://www.microsoft.com/download/en/details.aspx?id=5555[/url]
  • [QUOTE=FlapadarV2;31162078]Install VS2010 redistributables. [url]http://www.microsoft.com/download/en/details.aspx?id=5555[/url][/QUOTE] Ah thanks I thought I had that already. Yeah I do. Tried repairing the install but to no avail.
  • Avatar of Hentie
  • [QUOTE=ZpankR;31161834]I've installed the whole thing correctly but I get this error when requiring faceapi: [code]error loading module 'faceapi' from file 'c:\program files (x86)\steam\steamapps\<snip>\garrysmod\garrysmod\lua\includes\modules\gm_faceapi.dll': Impossível localizar o módulo especificado. (Impossible to locate the specified module) [/code][/QUOTE] Stupid question, and I apologize for asking this, but did you check the folder to see if that file was in there?
  • Avatar of Grocel
  • [QUOTE=ZpankR;31162142]Ah thanks I thought I had that already. Yeah I do. Tried repairing the install but to no avail.[/QUOTE] Did you install the FaceApi drivers?
  • [QUOTE=Grocel;31170300]Did you install the FaceApi drivers?[/QUOTE] I did, it's awkward because it works on my desktop PC but not on my laptop, and they're practically the same. Thanks anyway.
  • [QUOTE=Hentie;31149693]This module automatically chooses the first webcam it can find. (The current API is messed up and won't let me list all the cameras available).[/QUOTE] [img]http://agent47.square7.ch/files/licenses.png[/img]
  • Avatar of Hentie
  • [QUOTE=danielga;31171625][img]http://agent47.square7.ch/files/licenses.png[/img][/QUOTE] Thanks for the heads up man, but that is kind of a fib. faceAPI doesn't list all the cameras, but you can select any camera you want even if it's not the first one, faceAPI just won't give you the info on the camera type. [editline]17th July 2011[/editline] [QUOTE=ZpankR;31171601]I did, it's awkward because it works on my desktop PC but not on my laptop, and they're practically the same. Thanks anyway.[/QUOTE] faceAPI doesn't work with certain processors, maybe that's the problem. I wouldn't know.
  • [QUOTE=Hentie;31171839]faceAPI just won't give you the info on the camera type.[/QUOTE] You could probably get around it using DirectShow or MediaFoundation to enumerate all the input devices ([url]http://paste.rohitab.com/560[/url] line 138) and get all their info. But it will be a hell of a work and probably won't compensate it. You'll have to test around it. You could also give the API minimal information so you have less work.
  • What am I supposed to do here? I installed it all into the right foldiers, but the head tracking does not work ingame. Did I miss something?
  • Avatar of Jvs
  • [QUOTE=atmoph;31225622]What am I supposed to do here? I installed it all into the right foldiers, but the head tracking does not work ingame. Did I miss something?[/QUOTE] You are probably missing the most important thing about this module,the faceapi. This module is just a middle man between the faceapi and gmod. Go and download the faceapi before complaining that it doesn't work. [url]http://www.seeingmachines.com/product/faceapi/downloads/[/url]
  • [QUOTE=Jvs;31225765]You are probably missing the most important thing about this module,the faceapi. This module is just a middle man between the faceapi and gmod. Go and download the faceapi before complaining that it doesn't work. [url]http://www.seeingmachines.com/product/faceapi/downloads/[/url][/QUOTE] Shit. Massive derp. I'll install it and check again. [editline]20th July 2011[/editline] Alright, it works! Although shaky as hell.
  • Avatar of Hentie
  • Here's my modified version of the example, it only moves the angle of your view, but it's smoother. [lua] if !CLIENT then return end require("faceapi") function faceAPI_demoCalcView(pl, pos, angles, fov) lastHeadAng = lastHeadAng or angles local headAng = faceAPI.GetHeadAng() local newHeadAng = Angle(faceAPI.GetHeadAng().p*3,faceAPI.GetHeadAng().y*3,faceAPI.GetHeadAng().r) local finalHeadAng = LerpAngle(0.05,lastHeadAng,newHeadAng) local WorldPos,WorldAng = LocalToWorld(faceAPI.GetHeadPos()*300+Vector(130,0,0),finalHeadAng,pos,angles) // I add 130 forward since faceAPI's head center is a bit too close. local view = {} view.origin = pos view.angles = WorldAng view.fov = fov lastHeadAng = finalHeadAng return view end hook.Add("CalcView", "faceAPI_demoCalcView", faceAPI_demoCalcView)[/lua]
  • Avatar of D3TBS
  • hmm ok guys so I downloaded the files and faceapi from the website everything is correctly installed i think. The webcam turns on ingame and the mouse is moving pretty weird. What else do I have to do?
  • Maybe make it increment and remove the need of a mouse .... and maybe make +attack1 and +attack2 work when we blink with our eyes!
  • Avatar of JonBons
  • I can't wait to dive more into this, couple mistakes I made while testing it but it was fun. I'm thinking of doing some stuff with vehicles, not sure yet. [media]http://www.youtube.com/watch?v=8HyWsWN-Y_Q[/media]
  • Avatar of Grocel
  • [QUOTE=dingusnin;31272376]Maybe make it increment and remove the need of a mouse .... and maybe make +attack1 and +attack2 work when we blink with our eyes![/QUOTE] [QUOTE=danielga;31171625][img]http://agent47.square7.ch/files/licenses.png[/img][/QUOTE] I think that would only work with the commercial license.
  • Avatar of deaded38
  • [QUOTE=JonBons;31275270]I can't wait to dive more into this, couple mistakes I made while testing it but it was fun. I'm thinking of doing some stuff with vehicles, not sure yet. [media]http://www.youtube.com/watch?v=8HyWsWN-Y_Q[/media][/QUOTE] I think I'm going to be sick... *vomits*
  • Avatar of D3TBS
  • [QUOTE=JonBons;31275270]I can't wait to dive more into this, couple mistakes I made while testing it but it was fun. I'm thinking of doing some stuff with vehicles, not sure yet. [media]http://www.youtube.com/watch?v=8HyWsWN-Y_Q[/media][/QUOTE] you must have no neck whatsoever