ScanNet / ScanNet

http://www.scan-net.org/
Other
1.77k stars 346 forks source link

can not export color images and depth images using the reader.py #46

Open niatdlut opened 4 years ago

niatdlut commented 4 years ago

I want to export color images and depth images. I use reader.py at 'ScanNet/SensReader/python/' with: python reader.py --filename raw_data_ScanNet/scene0000_01/scene0000_01.sens --output_path datasets_ScanNet/scene0000_01 --export_depth_images --export_color_images But I receive the error when use the SensorData.py " line 57, in load self.sensor_name = ''.join(struct.unpack('c'*strlen, f.read(strlen))) TypeError: sequence item 0: expected str instance, bytes found " my python version is python3.7. could you tell me how to fix this problem?

dedoogong commented 4 years ago

I met the same problem. and also, next lines shows "ValueError: could not convert string to float: '(1169.62109375, 0.0, 646.2950439453125, 0.0, 0.0, 1167.1051025390625, 489.9270324707031, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)'

jmfacil commented 4 years ago

@niatdlut I think you are using python 3 and this script was done for python 2. The module struct which is the one giving you problems has changed the interface, thus it does not return the values that it was supposed to. If you want to run it in python3 you will have to update the calls to struct or the processing of the returned data.

ajithvcoder commented 3 years ago

@jmfacil could you pose the python3 version code ?

lijing1996 commented 3 years ago

The reason is that the "join" function can only work with str type, not byte type, in python3. The byte type is treated as str type in python2, therefore it works in python2. In python 3, we can use "+" to reduce the tuple of bytes instead of "join".

qzane commented 3 years ago

@ajithvallabai to run with py3, you can simply replace ''.join with b''.join

shaoxiang777 commented 1 year ago

This works for me! Thank you very much!

everythoughthelps commented 12 months ago

@ajithvallabai to run with py3, you can simply replace ''.join with b''.join

I can not understand the solution: simply replay ''.join with b''.join, can you show me the py3 version of 'self.sensor_name = ''.join(struct.unpack('c'*strlen, f.read(strlen)))'

cvrookieytd commented 11 months ago

self.color_data = b''.join(struct.unpack('c'*self.color_size_bytes, file_handle.read(self.color_size_bytes))) MemoryError

PhucNDA commented 9 months ago

Replace SensorData with this: https://github.com/pengsongyou/openscene/blob/main/scripts/preprocess/scannet_sensordata.py