microsoft / HoloLensForCV

Sample code and documentation for using the Microsoft HoloLens for Computer Vision research
MIT License
472 stars 156 forks source link

sensor_receiver.py error in python3 #84

Open hankhhub opened 5 years ago

hankhhub commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@cgsaxner i have the same problem

cyrineee commented 5 years ago

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

cyrineee commented 5 years ago

@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 commented 5 years ago

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

jonah27798 commented 5 years ago

@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 commented 5 years ago

Thanks a lot.so i add this code after cv2.imshow at line 87? And does recorder_console.py save data ? Thanks in advance.


From: jonah27798 notifications@github.com Sent: Sunday, April 28, 2019 8:29:34 PM To: Microsoft/HoloLensForCV Cc: Cyrine NABLI; Mention Subject: Re: [Microsoft/HoloLensForCV] sensor_receiver.py error in python3 (#84)

@cyrineeehttps://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/HoloLensForCV/issues/84#issuecomment-487404025, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKDCODWXZEIETT32ROIHQO3PSXUI5ANCNFSM4G3TNMCQ.

cyrineee commented 5 years ago

Thanks a lot. so ihttp://a lot.so i add this code after cv2.imshowhttp://cv2.imshow at line 87?

And does recorder_console.pyhttp://console.py save data ?

Thanks in advance.

Télécharger Outlook pour Androidhttps://aka.ms/ghei36


From: jonah27798 notifications@github.com Sent: Sunday, April 28, 2019 8:29:34 PM To: Microsoft/HoloLensForCV Cc: Cyrine NABLI; Mention Subject: Re: [Microsoft/HoloLensForCV] sensor_receiver.py error in python3 (#84)

@cyrineeehttps://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/HoloLensForCV/issues/84#issuecomment-487404025, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKDCODWXZEIETT32ROIHQO3PSXUI5ANCNFSM4G3TNMCQ.

jonah27798 commented 5 years ago

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

cgsaxner commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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

spongebobbe commented 2 years ago

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/)