Issue loading file in LiDAR labeler using custom point cloud reader

I am trying to use MATLAB's lidar labeler app to manually label some ground truth data. The lidar data I have is stored in a custom format, and I would like to use my own ground removal algorithm. So I chose to use the 'Custom Point Cloud' option as detailed here.
regardless of the sourcename I try to give it, the function call shown below,
lidarLabeler(sourceName,@FunctionHandle,timestamps);
results in the following error: "filename" must be a string scalar or character vector. Error in lidar.internal.lidarLabeler.lidarLabelerInternal
To ensure sourceName is of the proper data type, I tried doing the following:
fileFilter = '*.pcap';
[File_name,Directory]= uigetfile(fileFilter,'Open a .pcap file');
fileName = [Directory File_name];
and I tried passing fileName to the lidar labeLabeler and still have the same issue. Please advise on how to properly pass the file name to lidar labeler?

 채택된 답변

Vijeta
Vijeta 2023년 6월 14일
편집: Vijeta 2023년 6월 14일
Hi,
Based on the error you are receiving, it appears that the sourceName input argument in “lidarLabeler(sourceName, @FunctionHandle, timestamps)” must be a string scalar or character vector. This means that you must pass a file name as a string or character vector, rather than a variable containing a file name.
In the code snippet you provided, you are correctly using “uigetfile” to open a file and obtain its name as a string. However, it looks like you are combining the directory and file name using square brackets (fileName = [Directory File_name];) which results in a character array, not a string scalar. Instead, you should use “fullfile” to concatenate directory and file name as a string:
[fileName, directory] = uigetfile(fileFilter, 'Open a .pcap file');
sourceName = fullfile(directory, fileName);
This will create a string scalar with the full path to the file, which you can then pass to the “lidarLabeler” function.
Note that the “fullfile” function takes care of the appropriate separator character for the platform you are working on (e.g., '' on Windows, '/' on Linux/Mac), so you don't need to manually add it or worry about platform-specific issues.
You can refer to these resources

댓글 수: 1

@Vijeta, Thank you for the reply. The solution you provided works for any file in the local drive of a windows computer. When i tried to point to a file that is stored on a network drive, i receive the same error : "sourceName" must be a string scalar or character vector.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Lidar Toolbox에 대해 자세히 알아보기

제품

릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by