Face detect and UDP

Blitz3D Forums/Blitz3D Userlibs/Face detect and UDP

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi,
You probably know Johnny Lee, a researcher at Carnegie Mellon who has fun with the wiimote. See here. http://www.youtube.com/watch?v=Jd3-eiid-Uw

I make a small webcam/application that after detection of a face moves the position of it via UDP.
Here http://www.zinfo972.net/avatar/FACE_UDP.RAR
Need help for the Blitz test ;-)

JP
PS: it's not a..."trojaner" topic. ;-)



;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Graphics3D 800,600,32,2
AppTitle "Face UDP Detect 3D "
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Face UDP (c) zjp+++++++++++++++++++++++++++++++++++++++++
Global recu$
Global UDP_Serveur
Global VX=160
Global VY=120
Global VR=50
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; UDP read face detect
Function recu_UDP()
	;recu$=""
	IP_Client = RecvUDPMsg(UDP_Serveur)
	If IP_Client Then 
		recu$ = ReadLine(UDP_Serveur)
		; parce
		; found X
		i=Instr(recu$,"X(",1)+2
		C$=Mid$(recu$,i,4)
		VX=C$
		; found Y
		i=Instr(recu$,"Y(",1)+2
		C$=Mid$(recu$,i,4)
		VY=C$
		; found R
		i=Instr(recu$,"R(",1)+2
		C$=Mid$(recu$,i,4)
		VR=C$
	End If 
End Function
UDP_Serveur = CreateUDPStream(26000) ; <<<<<<< Quake UDP PORT ;-)
If UDP_Serveur <>0 Then 
	Print "Server Start."
Else
	Print "Can't start Server"
	End
End If
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
light=CreateLight()
cam=CreateCamera()

Type box
	Field xpos#,ypos#,zpos#
	Field spinspeed#
	Field entity
	Field alpha#,r,g,b
End Type

CubeType=CreateCube()
For x= 1 To 6 
	For y = 1 To 6
		For z = 1 To 6
			b.box=New box 
			b\entity = CopyEntity(CubeType)
			b\xpos#=x*4
			b\ypos#=y*4
			b\zpos#=z*4
			rc=Rnd(10,200)
			gc=Rnd(10,205)
			bc=Rnd(10,205)
			EntityColor b\entity,rc,gc,bc
			EntityAlpha b\entity,.8
			PositionEntity b\entity,b\xpos#,b\ypos#,b\zpos#
		Next
	Next
Next
;
MoveEntity cam,12,10,0
HideEntity CubeType 
;
Repeat
	; move the cam. Fx to build here
	RotateEntity cam,vy/6,-vx/6,0 ; dummy test
	;++++++++++++++++++++++++++++++++++++++++++
	UpdateWorld
	RenderWorld
	recu_udp ; get Face position
	Text 10,10,"Face x "+VX+", Face Y "+VY+", Face Radius "+VR
	Flip
Until KeyHit(1)=1
End