PS4 + Z3 tablet compact + Zeiss headtracker + Arduino Lenoardo – CHANGING GAMEPLAY

we started playing WarThunder on PS4 with standard PS4 setup, consisting of PS4 console and controller and FullHD monitor display.
The aim circle/cross is alway the center of your screen!

when we start using headtracking, we get new possibilities and new problems too.
Using headtracking version 1 ( moving head 45degree to left/right while looking to screen )  the center of our look isnt the same as the center of aiming!

to get better gameplay, we should set up a new color for our aiming cross, war thunder supports this setting..  not white (flying in the alps, not black, not brown.. better use any not natural terrain color, like pink..), while left/right is max 45degree so most time you will see your aiming cross, your HUD on your screen

later using headtracking version 2 ( HMD head mounted display, display moves with your head ), you can look around, above, behind your shoulders… you will not see your aiming cross, you will not see your artifical HUD altiude… you will loose controll of your  plain!
you can learn how to control in this new environment, but i guess you will not have advantages, you will have disadvantages.. as long as gamers play with unidentical equipment…

my choise number 1 is… using joystick to fly and mouse to look around
my choise numer 2 is..  using joystick to fly and ZEISS headtracker + arduino set up for impressive headtracking  version 1 ( moving head 45degree to left/right while looking to screen )… setting up color of aim cross
the other option, the HMD setup would be benefit in not so fast scenarios like semi/full-simulation battles

SONY Z3 tablet + PS4 + Remote Play + Zeiss Headtracker (playing WarTHunder)

 

took a helmet,
added a wooden system to carry the
Z3 tablet compact (268grams),
fixed Zeiss headtracker at the helmet, take care of correct alignment of axes
Zeiss headtraker connected to Laptop and then via USBSerial Adapter to Arduino Leonardo via USB to PS4

starting PS4,
starting RemotePlay from Z3,
finaly it works, flying the plane, looking around you to left, right, up, down..works great
BUT disadvantages are
– added little lag from streaming, not much, but in dogfights…
– the helmet construction with great enough distance to do not need eyeglasses creates leverage.. in addition to static weight…
– streaming video quality (not 1:1 what you know from TV screen) on Z3 in remote play app, we can use the settings icon, sitting in the upper right corner, to set various stuff and there we can set streaming quality, from standard to HIGH and fps from standard to HIGH!
http://manuals.playstation.net/document/gb/pstv/ps4link/settings_l.html

 

main problem is, how do we get 1:1 quality hdmi signal from PS4 onto our Z3 tablet WITHOUT  additional lag milliseconds ,
a solution using a cable would be accepted too
but MHL seems to be by design one direction only…

if you want to go further,
– get the Z3 in smaller distance, closer to your eyes..needing lenses, cross-eye-problem?
– get the Z3 in smaller distance will give lower leverage force/weight
– getting construction of arm as low as possible
– find a tablet or full HD panel+controller with cabled HDMI..
– check out 60GHz hdmi streamers (but missing point to use Z3 as TV screen to output incoming hdmi signals)
www.pcworld.com/article/2030041/meet-60ghz-wi-fi-the-insanely-fast-future-of-wireless-networking.html
www.wirelesshd.org/
www.siliconimage.com/solutions/wireless/

www.eurogamer.net/articles/digitalfoundry-2014-hands-on-with-playstation-tv-remote-play
http://manuals.playstation.net/document/gb/pstv/ps4link/settings_l.html

android using ethernet: http://www.bobjgear.com/which-tablets-support-ethernet.html


SONY Z3 tablet + PS4 + Remote Play (playing WarTHunder)

Modem->Router(wifi 2,4+5GHz,lanports)->ethernet cable->Router2(wifi 2,4+5GHz,lanports)

Router2(wifi 2,4+5GHz,lanports)->ethernet cable->PS4
Router2(wifi 2,4+5GHz,lanports)->5GHz->Sony Z3 tablet compact

description how to set up remote play are available on internet.. it works..

BUT graphic gets streamed as video stream from PS4 to Z3 tablet and so the Video Encoding gets involved.. resulting in not the same graphic brilliance like we see on main tv screen.

UPDATE: on Z3 in remote play app, we can use the settings icon, sitting in the upper right corner, to set various stuff and there we can set streaming quality, from standard to HIGH and fps from standard to HIGH!
http://manuals.playstation.net/document/gb/pstv/ps4link/settings_l.html

 

Maybe we could get better results when using a hdmi-splitter, external hdmi streamer, a app that reads our own stream, controlling quality, codec..  we need not realy remote play, only the screen on a tablet infront of our eyes, mimik a 2D head mounted display for flight simulations..

Zeiss Headtracker with PS4 – Solved

Zeiss Cinemizer Headtracker, USB:

works not realy with PS4, you can plug it in via USB, the Zeiss Headtracker gets recognized by PS4, for 2 seconds the incoming signals are working on PS4, but then the Headtracker gets disconneced by PS4 …

Asking Zeiss for the SDK, but never got an anwser. Ok…

But from previous project we have a base for a solution.
We use the headtracker with a Laptop, using the Zeiss Tracker Tray Configuration Tool to adjust sensitivity.
Then we use our python script to read the x,y coordinates from laptop screen. From that we calculate the relative movement between each reading of x,y. When the mouse pointer reaches the max or min values for x or y we set the x,y coordinates of actual mouse to center position of the screen and reinit some values. With that we can look around 360 degree and more .. mouse on laptop screen can hit min, max borders and gets set back to center… so we get continously relative values for our Arduino Leonardo.. connected to PS4 working as mouse input …  yeahhhh works fine… y-coordinates inverted and multiplied x 2..

remember: laptop->usb->usbserial adapter->RxTx->ArduinoLeonardo->usb->PS4

here is the script

# python C:\python_scripts\win32_read_mouse\win32_read_set_mouse.py
import win32gui
import time
import sys

import win32api, win32con
##########################################
# setting up serial communication

import serial
#import time
import os
"""
C:\Users\MrRonsen>python -m serial.tools.list_ports -a
Usage: list_ports.py [options] [<regexp>]

list_ports.py: error: no such option: -a
"""
# C:\Python27\Lib\site-packages\serial\tools\list_ports.py <<< look for options.. discoverd -v !
write_to_path = "C:\\python_scripts\\py_serial\\actual_com_ports.txt"
os.system("python -m serial.tools.list_ports -v > " + write_to_path)

fr = open( write_to_path , "rb")
frc = fr.read()
fr.close()

"""
COM14
desc: Arduino Uno (COM14)
hwid: USB VID:PID=2341:0001 SNR=55330343831351D03232
COM9
desc: Arduino Leonardo (COM9)
hwid: USB VID:PID=2341:8036
2 ports found
"""

frc = str(frc).split("\n")

com_dict = {}
COM_id = ""
for line in frc:
#print line
if line[0:3] == "COM":

COM_id = line.strip()
#print "COM_id: ",COM_id
com_dict[COM_id] = ""

if line.find("desc:") != -1:
line2 = line
line2 = line2.replace("desc: ","")
line2 = line2.replace("("+COM_id+")","")
line2 = line2.replace("\t","")
line2 = line2.strip()
#print "line2: >>",line2,"<<"
com_dict[COM_id] = line2


arduino_leonardo_COMport = ""
arduino_uno_COMport = ""

for e in com_dict:
print e, ": ", com_dict[e]

if com_dict[e].lower().find("leonardo")!=-1:
arduino_leonardo_COMport = e
if com_dict[e].lower().find("uno")!=-1:
arduino_uno_COMport = e

print "arduino_uno_COMport: ",arduino_uno_COMport
print "arduino_leonardo_COMport: ",arduino_leonardo_COMport
if 1==1:

#COMport = 14
#serial_port = COMport-1
#serial_port = "COM14"
#serial_port = "COM11"
#serial_port = arduino_leonardo_COMport
serial_port = arduino_uno_COMport

baudrate = 9600

connected = False
"""
ser = serial.Serial(port=serial_port,
baudrate=baudrate,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.EIGHTBITS,
timeout=0,
xonxoff=0,
rtscts=0)
"""


ser = serial.Serial( serial_port, baudrate) # open first serial port
#ser.DtrEnable = "true";

print("initialising")
time.sleep(2) # waiting the initialization...

print ser.name # check which port was really used
# EOF setting up serial
######################################################

if 1==1:
flags, hcursor, (x,y) = win32gui.GetCursorInfo()
print "flags: ",flags
print "hcursor: ",hcursor
print "x: ",x
print "y: ",y
print

#if 1==11:
# print "..............."
# import msvcrt
# print msvcrt.getch()
# print "..............."

screen_max_width = 1280
screen_max_height = 800

screen_max_width_half = screen_max_width/2
screen_max_height_half = screen_max_height/2

screen_max_width_minusX = screen_max_width-1
screen_max_height_minusX = screen_max_height-1

win32api.SetCursorPos((screen_max_width_half,screen_max_height_half))

#current_frame_x = screen_max_width_half
#current_frame_y = screen_max_height_half

prev_frame_x = screen_max_width_half
prev_frame_y = screen_max_height_half
if 1==1:

collected = 0
attempts = 50

while collected < attempts :

try:
x,y = win32gui.GetCursorPos()

collected += 1

to_print = x,y ," , attempt: ",collected
to_print = str(to_print) + "\r"

# 1280 x 800 Laptop Bildschirm

do_reset = 0

if x == 0 or x == screen_max_width_minusX:
do_reset = 1
if y == 0 or y == screen_max_height_minusX:
do_reset = 1

if do_reset == 1:
x = screen_max_width_half # mitte
y = screen_max_height_half
win32api.SetCursorPos((x,y))
prev_frame_x = x # avoid jump
prev_frame_y = y #avoid jump

sys.stdout.write( to_print )
sys.stdout.flush()

if collected == attempts:
collected = 0

#rel_x = 0
#rel_y = 0

rel_x = x - prev_frame_x
rel_y = y - prev_frame_y

if rel_x != 0 or rel_y != 0:

#print
print "rel_x: ",rel_x
print "rel_y: ",rel_y

rel_y2 = -1 * rel_y # inertieren
rel_y2 = rel_y2*2 # doppelt umsetzen
ser.write( str(rel_x) + "," + str(rel_y2) + "\n" )

prev_frame_x = x
prev_frame_y = y
#time.sleep(0.01) # set the inveral to read next
time.sleep(0.001) # set the inveral to read next
except:
print "exception"

hardware sammlung for DIY 2D HMD

HDMI Displays:

adafruit, lcd&displays:
http://www.adafruit.com/category/63

Adafruit Qualia 9.7″ DisplayPort Monitor – 2048×1536 Resolution

LG LP097QX1 – iPad 3/4 Retina Display

LCDS & DISPLAYS / HDMI/DVI DECODERS

 

http://www.sonymobile.com/de/products/tablets/
Tablet Z1/Z2/Z3(compact)/Z4
advantag: Remote Play

 

HeadTracker

http://www.zeiss.de/cinemizer-oled/de_de/produktinformation/cinemizer-oled-erleben/headtracker.html

OSVR – Open Source Virtual Reality

http://www.razerzone.com/osvr-hacker-dev-kit
Shipping in June 2015
199.99 USD

http://www.osvr.com/
http://www.osvr.com/hardware.html

single Full-HD display

PS4 remote play + Head Tracking

Headtracker from ZEISS (USB, ready to use any system, mouse-wise) http://www.zeiss.de/cinemizer-oled/de_de/produktinformation.html
but 150,- bugs.. euros?

an own headtracker, based on Arduino + sensors would cost hardware at least 20+20+20 60 Euros an lot of work…

 

a CARL ZEISS cinemizer costs 650,- bugs, insane, crazy..
http://www.rcmodellbau-online.de/ 560,- euros
and we have no chance to test? ok, order and send back within legal time.
without testing such a device i would hang a Xperia 3 tablet infront of my eyes..
the tablet would be usefull as tablet too.. when you are not playing..
but with a tablet infront, we need exact headtracking… is a 20 bugs air mouse accurate enough?
first test with arduino and
Gyro: Triple Axis Gyro – L3G4200D (BK-L3G4200D)
Accelerometer: MMA7361L 3-Achsen Beschleunigungssensor (IM120712010)
show, that accurate headtracking isnt done with a snip..

 

for DIY  headtracker we have to leave single sensors behind us.. gyro, accelerometer, magnetometer… there are complete sensors available, doing combining all of them
http://en.wikipedia.org/wiki/Inertial_measurement_unit

HMD Head mounted display – 2D – DIY

 

HMD Head mounted display – for 2D contents – DoItYourself

quite cool,
genius idea to use a welding helmet ;o)
using an wifi air mouse(6-axis)

specs, taken from airons1972 youtube account :

1x 8″ 1024*768 LCD Display + HDMI+VGA+2AV LCD Controller Board (ebay)
1x A5 size 3x magnification fresnel lens (ebay)
1x wireless 2.4g air mouse (ebay)
1x 5 meter VGA cable (ebay)
1x 5 Meter DC power cable (ebay)
1x 9v power supply (ebay)
1x cheap plastic welding helmet (ebay)
Thick black card for screen surround
Black gaffa tape
8x large black pull ties for securing cables and air mouse to the helmet

Total cost = £100 ($154)

Features include VGA input, Wide 90+ degree Field Of Vision (FOV) and works with ANY PC game that uses mouselook. (i.e. virtually any First Person Shooter)

I recommend you mount the fresnel lens 80mm in front of your lcd screen with the rough/grooved side towards your face. This gives a nice level of magnification without loss of focus. You need the lens as close to your face as possible without it touching your nose.

 

 

what is an Air Mouse?
available for 15-25,- Euros

 

 

War Thunder – PS4 – Headtracking SELBSTGEMACHT – FINAL

2 Point Head Tracking,
1 not moving referenz point (at your nacklace)
1 moving point on a wooden bar on your helmet
60 frames per second, stable

 

benötigte Hardware:
– PS3 Eye Cam ( very high framerates )
– PC/Laptop ( DualCore 2×1,8GHz, 4GB, Win7 )
– USB Serial Light Adapter
– Arduino Leonardo
– PS4
– evtl. USB Hub
– LED infrared, 2 pieces
– Resistors 100 Ohm, 2 pieces
– Batteries/Accus, AA 1.2V , 4 pieces
– Batterie Case with switch, 2 pieces
– helmet or similar else
– wooden bar or similar else
– duct tape

Hardware Hacks:
– PS3 Eye Cam – IR blocking Filter entfernen und Tageslicht blocking filter (Diskette) einsetzen

Software:
– PC/Laptop – Windows Treiber der PS3 Eye Cam
– PC/Laptop – Python 2.7.3
– PC/Laptop – openCV
– PC/Laptop – pyserial
– PC/Laptop – Arduino IDE
– Arduino Leonardo – extra sketch

Following script holds everything together:
– reading camera stream,
– analysing, finding blobs,
– calculating distances,
– calculating movement between current versus previous frame
– sending relative movement over USBSerialLight Adapter to ArduinoLeonardo

import cv2
import time
import numpy 

# python C:\python_scripts\opencv\cam_vid_60fps_binarized_flipped_blobs_SERIAL.py

##########################################
# setting up serial communication

import serial
#import time
import os




"""
C:\Users\XXXXX>python -m serial.tools.list_ports -a
Usage: list_ports.py [options] []

list_ports.py: error: no such option: -a
"""
# C:\Python27\Lib\site-packages\serial\tools\list_ports.py  <<< look for options.. discoverd -v ! write_to_path = "C:\\python_scripts\\py_serial\\actual_com_ports.txt" os.system("python -m serial.tools.list_ports -v > " + write_to_path)

fr = open( write_to_path , "rb")
frc = fr.read()
fr.close()

"""
COM14               
    desc: Arduino Uno (COM14)
    hwid: USB VID:PID=2341:0001 SNR=55330343831351D03232
COM9                
    desc: Arduino Leonardo (COM9)
    hwid: USB VID:PID=2341:8036
2 ports found
"""

frc = str(frc).split("\n")

com_dict = {}
COM_id = ""
for line in frc:
   #print line
   if line[0:3] == "COM":
    
     COM_id = line.strip()
     #print "COM_id: ",COM_id
     com_dict[COM_id]  =  ""
     
   if line.find("desc:") != -1:
    line2 = line
    line2 = line2.replace("desc: ","")
    line2 = line2.replace("("+COM_id+")","")
    line2 = line2.replace("\t","")
    line2 = line2.strip()
    #print "line2: >>",line2,"<<"
    com_dict[COM_id] = line2
    
    
arduino_leonardo_COMport = ""
arduino_uno_COMport = ""

for e in com_dict:
    print e, ": ", com_dict[e]
    
    if com_dict[e].lower().find("leonardo")!=-1:
      arduino_leonardo_COMport = e
    if com_dict[e].lower().find("uno")!=-1:
      arduino_uno_COMport = e

print "arduino_uno_COMport: ",arduino_uno_COMport
print "arduino_leonardo_COMport: ",arduino_leonardo_COMport




if 1==1:

  #COMport = 14
  #serial_port = COMport-1
  #serial_port = "COM14"
  #serial_port = "COM11"
  #serial_port = arduino_leonardo_COMport
  serial_port = arduino_uno_COMport

  baudrate = 9600

  connected = False

  
  """
  ser = serial.Serial(port=serial_port,
baudrate=baudrate,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.EIGHTBITS,
timeout=0,
xonxoff=0,
rtscts=0)
        """
        
        
  ser = serial.Serial( serial_port, baudrate)  # open first serial port
  #ser.DtrEnable = "true";
  
  print("initialising")
  time.sleep(2) # waiting the initialization...

  print ser.name          # check which port was really used


# EOF setting up serial
######################################################
#

# python C:\python_scripts\opencv\cam_vid_60fps_binarized_flipped_blobs_SERIAL.py

# http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_video_display/py_video_display.html


#cam = cv2.VideoCapture(0) # laptop eingebaute cam
#cam = cv2.VideoCapture(1) # wenn direct am laptop
cam = cv2.VideoCapture(1)

print "cam.isOpened(): ",cam.isOpened()

# - CV_CAP_PROP_FPS Frame rate.
#print "FPS: ", cam.get( 10 ) # ? ret
#print "x: ", cam.GetCaptureProperty( CV_CAP_PROP_FPS )
print "CV_CAP_PROP_FRAME_WIDTH:  ", cam.get(3)
print "CV_CAP_PROP_FRAME_HEIGHT: ", cam.get(4)
print "CV_CAP_PROP_FPS:          ", cam.get(5)
# cam.get(propId)   
# propId integer 0 bis 18

if 1==11:
   size = (int(cv2.GetCaptureProperty(cam , cv2.CV_CAP_PROP_FRAME_WIDTH)), int(cv2.GetCaptureProperty(cam , cv2.CV_CAP_PROP_FRAME_HEIGHT)))
   print "size: ",size


"""
Property identifier. It can be one of the following:
0 CV_CAP_PROP_POS_MSEC Current position of the video file in milliseconds or video capture timestamp.
1 CV_CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/captured next.
2 CV_CAP_PROP_POS_AVI_RATIO Relative position of the video file: 0 - start of the film, 1 - end of the film.
3 CV_CAP_PROP_FRAME_WIDTH Width of the frames in the video stream.
4 CV_CAP_PROP_FRAME_HEIGHT Height of the frames in the video stream.
5 CV_CAP_PROP_FPS Frame rate.
6 CV_CAP_PROP_FOURCC 4-character code of codec.
7 CV_CAP_PROP_FRAME_COUNT Number of frames in the video file.
8 CV_CAP_PROP_FORMAT Format of the Mat objects returned by retrieve() .
9 CV_CAP_PROP_MODE Backend-specific value indicating the current capture mode.
10 CV_CAP_PROP_BRIGHTNESS Brightness of the image (only for cameras).
11 CV_CAP_PROP_CONTRAST Contrast of the image (only for cameras).
12 CV_CAP_PROP_SATURATION Saturation of the image (only for cameras).
13 CV_CAP_PROP_HUE Hue of the image (only for cameras).
14 CV_CAP_PROP_GAIN Gain of the image (only for cameras).
15 CV_CAP_PROP_EXPOSURE Exposure (only for cameras).
16 CV_CAP_PROP_CONVERT_RGB Boolean flags indicating whether images should be converted to RGB.
17 CV_CAP_PROP_WHITE_BALANCE Currently not supported
18 CV_CAP_PROP_RECTIFICATION Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently)
"""

if 1==11:

        cam.set(3,320) # CV_CAP_PROP_FRAME_WIDTH
        cam.set(4,240) # CV_CAP_PROP_FRAME_HEIGHT

cam.set(5,100) # fps
print "cam get fps: ", cam.get(5) # fps


# 'module' object has no attribute 'createBackgroundSubtractorMOG'
#fgbg = cv2.BackgroundSubtractorMOG()
#fgbg = cv2.BackgroundSubtractorMOG2()

counter_frames = 0
start_time = time.time()
fps = 0

# http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html
#kernel = numpy.ones((2,2),numpy.uint8)
#kernel = numpy.ones((5,5),numpy.uint8)
kernel = cv2.getStructuringElement(cv2.MORPH_RECT,(5,5))
#kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
#kernel = cv2.getStructuringElement(cv2.MORPH_CROSS,(5,5))
#kernel = numpy.ones((10,10),numpy.uint8)

cv2__THRESH_BINARY = cv2.THRESH_BINARY
cv2__flip          = cv2.flip
cv2__morphologyEx  = cv2.morphologyEx
cv2__MORPH_OPEN    = cv2.MORPH_OPEN
cv2__MORPH_CLOSE   = cv2.MORPH_CLOSE
cv2__imshow        = cv2.imshow
cv2__waitKey       = cv2.waitKey

if 1==11:
   flags = [i for i in dir(cv2) if i.startswith('COLOR_')]
   for flag in flags:
    if flag.find("RGB")!=-1:
       print flag
       # COLOR_RGB2GRAY


prev_frame_dist_x = 999999  #init  value
prev_frame_dist_y = 999999 # init value

while(True):     

        
        ret, frame = cam.read()
        
        #cv2.imshow('frame', frame)
        
        # Our operations on the frame come here
        frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        
        #gray = cv2.cvtColor(frame, cv2.THRESH_BINARY)
        tresh = 253
        #tresh = 200
        ret,frame = cv2.threshold(frame,tresh,255,cv2__THRESH_BINARY )
        frame = cv2__flip(frame, 1) # 
        
        #print "frame.dtype: ",frame.dtype

        # http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html

        #frame = cv2.erode(frame,kernel,iterations = 1)
        frame = cv2.dilate(frame,kernel,iterations = 2)
        #frame = cv2.erode(frame,kernel,iterations = 3)
        #frame = cv2__morphologyEx(frame, cv2__MORPH_OPEN, kernel) # erosion followed by dilation
        #frame = cv2__morphologyEx(frame,  cv2.MORPH_TOPHAT, kernel) 
        #frame = cv2.morphologyEx(frame, cv2.MORPH_GRADIENT, kernel) # does outline
        cv2__imshow('frame', frame)
        
        #print "frame.dtype: ",frame.dtype

        #fgmask = fgbg.apply(frame)
        #cv2.imshow('frame',fgmask)
        
		
        #x = cv2.cvtColor(frame, cv2.CV_SHAPE_CROSS)    
        #cv2.imshow('frame', x)



        #frame = cv2.convertTo(frame, CV_8U)
     
        # http://opencvpython.blogspot.de/2012/04/contour-features.html
        contours, _ = cv2.findContours(frame, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
        contour_number = 0
        contours_dict = {}

        for c in contours:

            rect = cv2.boundingRect(c)

            # rect[2]   width
            # rect[3]   height
            # sucht nur grosse blobs, alles kleiner 10x10 wird verworfen
            if rect[2] < 10 or rect[3] < 10: continue
            contour_number = contour_number+1
            
            print "contour_number: ",contour_number
            #print cv2.contourArea(c)
            print rect # x,y width,height
            contours_dict[contour_number] = rect
            print 

            if contour_number == 2:
               con1_x = contours_dict[1][0]
               con2_x = contours_dict[2][0]

               diff_con1_x_con2_x = con1_x - con2_x
               print "diff_con1_x_con2_x: ", diff_con1_x_con2_x


               con1_y = contours_dict[1][1]
               con2_y = contours_dict[2][1]

               diff_con1_y_con2_y = con1_y - con2_y
               print "diff_con1_y_con2_y: ", diff_con1_y_con2_y

               if diff_con1_x_con2_x != 999999: # 999999 is starting init val

                  diff_prev_frame_x = diff_con1_x_con2_x - prev_frame_dist_x
                  print "diff_prev_frame_x: ",diff_prev_frame_x
                  # x negativ value = move to the right
                  # x positiv value = move to the left
                  diff_prev_frame_y = diff_con1_y_con2_y - prev_frame_dist_y
                  # y negativ value = move to bottom
                  # y positiv value = move to top
                  print "diff_prev_frame_y: ",diff_prev_frame_y

                  # send these values to arduino
                  # diff_prev_frame_x
                  # diff_prev_frame_y
                  # or manipulate them multiple 2 or progressive
                  diff_prev_frame_x = diff_prev_frame_x * -1
                  
                  # ABSoluter wert, positiv.. d.h negativ number positiv machen
                  ABS_x = diff_con1_x_con2_x
                  if diff_con1_x_con2_x < 0:
                     ABS_x = diff_con1_x_con2_x * -1
                  ABS_y = diff_con1_y_con2_y
                  if diff_con1_y_con2_y < 0:
                     ABS_y = diff_con1_y_con2_y * -1

                  print "ABS_x: ",ABS_x
                  print "ABS_y: ",ABS_y

                  if ABS_x < 100:
                     diff_prev_frame_x = diff_prev_frame_x * 2 # 2
                  else:                     
                     diff_prev_frame_x = diff_prev_frame_x * 4

                  # 240 center point y
                  #  280
                  if ABS_y > 200 or ABS_y < 280:                      diff_prev_frame_y = diff_prev_frame_y * 4 # 4                   else:                      diff_prev_frame_y = diff_prev_frame_y * 8                   ser.write( str(diff_prev_frame_x) + "," + str(diff_prev_frame_y) + "\n" )                prev_frame_dist_x = diff_con1_x_con2_x                prev_frame_dist_y = diff_con1_y_con2_y                # now map the distances                # to mouse movements                # mouse movement                 # there is an posiblity to use absolute mouse via arduino,                 # http://forum.arduino.cc/index.php?topic=94140.0                # http://arduino.stackexchange.com/questions/3531/using-leonardo-and-getting-absolute-x-y-mouse-values                # WE NEED DATA FROM PREV FRAME                # CALC differences                # these differences map to mouse moves             #print rect.bx,rect.by #,c.bw,c.bh         #frame = cv2.drawContours(frame, contours, -1, (0,255,0), 3) 		         # to quit press key "q"         if cv2__waitKey(1) & 0xFF == ord('q'):             break 	          if 1==1:               counter_frames = counter_frames + 1                       #print "counter_frames: ",counter_frames 	                 cur_time = time.time()               #print "start_time: ",start_time               #print "cur_time: ",cur_time               diff_time = cur_time - start_time               #print "diff_time: ",diff_time               if diff_time > 5: # 5 sekunden
                 fps = counter_frames / 5 # frames pro sekunde		 
                 counter_frames = 0
                 start_time = time.time()
                 print "fps: ",fps
        print "fps: ",fps
	  
	  
	  
cam.release()
cv2.destroyAllWindows()

Sketch for Arduino Leonardo

/*
  Serial1-Mouse-Control 
 
 
 The mouse movement is always relative. 
 This sketch reads Serial1(RxTx) and uses incoming data 
 to set the movement of the mouse (over Serial, Main USB Port).
 
 WARNING:  When you use the Mouse.move() command, the Arduino takes
 over your mouse!  Make sure you have control before you use the mouse commands.
 
2015-02
Ronny Gey
  
*/


#include 


// read string
String mouse_x = "";
String mouse_y = "";
  
  
void setup() {
  
  // http://arduino.cc/en/pmwiki.php?n=Reference/Serial
  // http://arduino.cc/en/Main/ArduinoBoardLeonardo
  
  // Serial not needed, this is used by mouse control...
  // only for string tests, debugging
  //Serial.begin(9600); // first Serial Port, main USB port... OR sending to PS4
  //while (!Serial) {
  //  ; // wait for serial port to connect. Needed for Leonardo only
  //}
  
  // second Serial Port on Leonardo! pins Rx(Pin0)/Tx(Pin1) for receiving data from Laptop
  Serial1.begin(9600); 
  while (!Serial1) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  
  // initialize mouse control:
  Mouse.begin();
}

void loop() {
  // read Serial_1, data coming from Laptop

  // send data only when you receive data:
  // read RxTx
  if (Serial1.available() > 0) {
    
      // getting x,y from Laptop over Serial1
      // Kommaseparated value: x,y\n
      // -10,5
      // 5,-10
      // 10,10
      mouse_x = Serial1.readStringUntil(',');
      mouse_y = Serial1.readStringUntil('\n');
      //Serial1.print("I received X,Y: ");
      //Serial1.print(mouse_x);
      //Serial1.print(" : ");
      //Serial1.println(mouse_y); 
      
      //Syntax:  Mouse.move(xVal, yPos, wheel);
      Mouse.move(mouse_x.toInt(), mouse_y.toInt(), 0);
      // http://arduino.cc/en/Tutorial/StringToIntExample     
     
  } // EOF serial1 available
   
 
  /* only for debugging purpose
  // send data only when you receive data:
  if (Serial.available() > 0) {
      
      // getting x,y from Laptop over Serial1
      // comma separated value: x,y\n
      // -10,5
      // 5,-10
      // 10,10
      mouse_x = Serial.readStringUntil(',');
      mouse_y = Serial.readStringUntil('\n');
      Serial.print("I received X,Y: ");
      Serial.print(mouse_x);
      Serial.print(" : ");
      Serial.println(mouse_y);     

     
  } // EOF serial available
  */  
        
}

thats all

 

 

War Thunder – PS4 – HMD HeadMountedDisplay – FPV FirstPersonView – 2D

War Thunder – PS4 –
HMD HeadMountedDisplay –
FPV FirstPersonView –
2D

folgendes Video von TannerRice zeigt
WarThunder mit iPhone HMD(cardboard version)
Wie kann man das anstatt mit iPhone und PC Technik nun für PS4 umsetzen?
Tip: auf Morpheus warten

 

theoretische Möglichkeiten:

Sony PS4
Game: War Thunder (Plane Simulation with Head Movement, FPV First Person View)
Remote Play
Sony Tablet xperia z3:
– 8″ FullHD 379,- to use 2D not 3D
– 213,3 x 6,4 x 123,6 mm
– 270 g
– 1900 x 1200 pixel
– micro USB OTG!(usb-otg to LAN possible ? instead wifi)

www.sony.de/electronics/xperia-tablet-z/sgp611-sgp612-sgp621
www.sony.de/electronics/xperia-tablet-z/sgp611-sgp612-sgp621/specifications

www.google.com/get/cardboard/ << keyFeature.. is 2D viewable?
www.mrcardboard.de/
www.pcardboard.com/index.php?route=common/home
www.ebay.de/itm/like/371175741936?lpid=106&chn=ps

www.vrnerds.de/  – Das deutsche Virtual Reality Showcase und Blog – VR∙Nerds

www.gaminggadgets.de/refugio-3d-billiger-papp-bausatz-fuer-vr-brille

Problems:
– bei 6″ ist Schluss mit HeadMounted Helmen mit Phone/Table-Aufnahmen?
– Side-by-Side Darstellung wird benötigt, diese müsste bereits die Kombo „PS4+TabletApp+RemotePlay“ bereitstellen

Zur reinen Bildübertragung benötigen wir noch das HeadTracking, allerdings in weit besser Qualität als in der bisherigen ersten Version.

IR InfraRed (active or reflective)
Sony PS3 Cam (60fps)
PC/Laptop with openCV/simpleCV/Python
Arduino Serial Light (frome PC usb to serial Arduino Leonardo)
Arduino Leonardo (hardware acting as mouse input at ps4 usb)