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

sensor_receiver.py error in python3 #84

Open
hankhhub opened this issue Mar 4, 2019 · 15 comments
Open

sensor_receiver.py error in python3 #84

hankhhub opened this issue Mar 4, 2019 · 15 comments

Comments

@hankhhub
Copy link

hankhhub commented Mar 4, 2019

I am trying pair StreamerPV project on HoloLens with sensor_receiver.py on desktop. I am using Python 3.5.6 in order to use tensorflow, and the code gives error at this line "image_data += image_data_chunk" which results from python3 not able to implicitly convert bytes to strings. So I changed the line to "image_data += image_data_chunk.decode('utf-8')" but it still gives me error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 1: invalid start byte
I tried codecs: utf-16, ascii, unicode-escape, etc.. and none of them work. If I used any error handling like "ignore, replace, backslashreplace", my image data gets corrupted.
Has anyone tried to implement this code in Python3, or should I just do it in Python2? Any suggestions would be appreciated.

@jonah27798
Copy link

May be a bit late, but I fixed the issue by changing line 155 from image_data = '' to image_data = bytes(). I hope this helps.

@cgsaxner
Copy link

Hi, does the pairing between StreamerPV and sensor_receiver.py work for you now? I always get a
"ConnectionRefusedError: No connection could be made because the target machine actively refused it".
The same happens when I try the ComputeOnDesktop sample...

@cyrineee
Copy link

@cgsaxner i have the same problem

@cyrineee
Copy link

@hankhhub how did u install and launch the streamer on your hololens ?

@cyrineee
Copy link

@cgsaxner it works for me .
you should go to properties debugging remote machine after in the machine name put the ipv4 address of hololens .first launch the streamer PV on hololens after thatin your PC in the cmd type sensor_receiver.py -a "address of hololens"

@cyrineee
Copy link

@jonah27798 Thanks for your solution it helped so much . One question is sensor_receiver.py saving data ?

@jonah27798
Copy link

@cyrineee I'm glad I could help. No, unfortunately it does not save data, but for example you can save the current frame by using openCV:
cv2.imwrite('current.jpg', image_array)
Please note that this overwrites the file after each frame.

@cyrineee
Copy link

cyrineee commented Apr 28, 2019 via email

@cyrineee
Copy link

cyrineee commented Apr 28, 2019 via email

@jonah27798
Copy link

@cyrineee Yes after cv2.inshow, but I believe its located in line 100 if you didn't edit the file.

@cgsaxner
Copy link

@cyrineee Thank you, I finally can connect to the streamer now. My problem was that I always attempted to connect to the HoloLens via USB, but for some reason it only works via WiFi.

Concerning your question about recorder_console.py, it is essentially a tool for managing recordings you made with the Recorder tool. The Recorder stores recordings on your HoloLens, and the recorder_console.py provides a tool for downloading and extracting them to your computer, but you could also manually do that using the device portal.

@cyrineee
Copy link

@cgsaxner i want to have the sensor data on my desktop but the recoder_console.py doesn't work for me .there is a problem of certificate security . it did work for you ?

@cgsaxner
Copy link

@cyrineee yes, for me it worked.
I installed the Recorder on my HoloLens, then made recordings with it, then use the recorder_console to download them.
For this, I connected the HoloLens using USB, then the command is
python recorder_console.py --dev_portal_username DEV_PORTAL_USERNAME --dev_portal_password DEV_PORTAL_PASSWORD --workspace_path WORKSPACE_PATH
You have to insert your corresponding device portal username and password, and the workspace path is where the recorder will store the files. If you connect via WiFi, i think you also need to specify the IP of your HoloLens using --dev_portal_address DEV_PORTAL_ADDRESS.

@cyrineee
Copy link

the recorder is running but i get this error for the recorder_console.py (via wifi)
error

@spongebobbe
Copy link

for future visitors:
when connecting the HoloLens via WiFii, recorder_console.py will fail with the above error. If you connect via USB, everything works just fine.
To solve the issue with WiFii:
"If you want to connect via WiFi you will need to disable SSL on the HoloLens device when not using a certificate. In case of production make sure SSL is enabled and you have downloaded and implemented the certificate which you can retrieve from the HoloLens Device. The settings for both SSL and the certificate can be found through the Device Portal -> Security Tab at the top" from (https://www.appzinside.com/2017/08/18/how-to-use-the-device-portal-api-of-hololens-take-a-picture/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants