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

Unable to read binary format pcds #30

Open
venkataksv opened this issue Apr 28, 2020 · 8 comments
Open

Unable to read binary format pcds #30

venkataksv opened this issue Apr 28, 2020 · 8 comments

Comments

@venkataksv
Copy link

@dimatura , Thanks for putting together an amazing support for reading point cloud data in python. PCD is a widely used extension in the CV community. I was trying to leverage pypcd support to read a binary pcd but was unsuccessful in all my attempts. Can you please guide me on how to fix this issue to be able to read the pcd info ( binary/ascii ) successfully.

Attaching for reference of the error i had been receiving:

ValueError: field '__0000' occurs more than once

FYI: I was just using

 pc = pypcd.PointCloud.from_path("abc.pcd")

where abc.pcd was a binary format pcd.

@TheLaas
Copy link

TheLaas commented Jan 20, 2021

I have the same problem. If the .pcd file have DATA ascii there is no problem but in the case DATA binary I get the same error.

@TheLaas
Copy link

TheLaas commented Jan 20, 2021

So, my problem was that I had used the bag_to_pcd from the ros node pcl_ros . That script added two _ in FIELDS line in the header. Changing these two _ to something else made it work.

@layssi
Copy link

layssi commented Mar 12, 2021

@TheLaas
adding the two highlighted lines below fixes the issue

def parse_header(lines):
""" Parse header of PCD files.
"""
metadata = {}
for ln in lines:
if ln.startswith('#') or len(ln) < 2:
continue
ln = ln.replace('','s',1)
ln = ln.replace('
','m',1)

print(ln)
match = re.match('(\w+)\s+([\w\s.]+)', str(ln))

@bobusfil
Copy link

@TheLaas Could oyu please tell me how and where did you edit the code? I do No t know how to do this ..

@CoolLoveBoy
Copy link

So, my problem was that I had used the bag_to_pcd from the ros node pcl_ros . That script added two _ in FIELDS line in the header. Changing these two _ to something else made it work.

I have the same question. Could you have the answer to this question?

@TheLaas
Copy link

TheLaas commented Dec 11, 2021

If I remember correctly I didn't change the code, I made a script that changed the output-files from bag_to_pcl. And replaced the _ from FIELDS there.

@h-wata
Copy link

h-wata commented Feb 3, 2022

@TheLaas adding the two highlighted lines below fixes the issue

def parse_header(lines): 
    """ Parse header of PCD files. """ 
    metadata = {} 
    for ln in lines: 
        if ln.startswith('#') or len(ln) < 2: continue 
        ln = ln.replace('_','s',1)
        ln = ln.replace('_','m',1)
        print(ln) 
    match = re.match('(\w+)\s+([\w\s.]+)', str(ln))

I think this is an addition to the above section, although it may have been resolved.

pypcd/pypcd/pypcd.py

Lines 77 to 84 in 20b032b

def parse_header(lines):
""" Parse header of PCD files.
"""
metadata = {}
for ln in lines:
if ln.startswith('#') or len(ln) < 2:
continue
match = re.match('(\w+)\s+([\w\s\.]+)', ln)

@udnqv
Copy link

udnqv commented May 19, 2022

Hi, if I change pypcd.py as you suggested above, I get the following error:
image
Has someone an idea how I can fix this issue?
Thanks in advance!

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

7 participants