ousterFileReader give no correct result

7 次查看(过去 30 天)
The function ousterFileReader not work correcty in 2023b with lidar's FW 2.4. As in json there is a negative shift, and intensivity value shift in row... Bug

回答(1 个)

Namnendra
Namnendra 2024-8-12,9:11
Hello Nikolay,
It sounds like you're encountering a bug with the `ousterFileReader` function in MATLAB 2023b when dealing with LiDAR data from a device running firmware version 2.4. Specifically, the issue appears to involve a negative shift and an intensity value shift in the JSON file.
Here are a few steps you can take to troubleshoot and potentially resolve this issue:
Verify JSON Format:
- Ensure that the JSON file is correctly formatted and adheres to the expected schema. A negative shift or intensity value shift might indicate a formatting issue.
It appears that the `pixel_shift_by_row` array contains both positive and negative values, which might be causing the issue with the `ousterFileReader` function in MATLAB.
To address this, you can create a custom function to handle the JSON data and correct the shifts. Below is a more detailed example of how you might implement this in MATLAB:
function data = customOusterFileReader(jsonFilePath)
% Read the JSON file
jsonData = fileread(jsonFilePath);
dataStruct = jsondecode(jsonData);
% Correct the negative shift in pixel_shift_by_row
dataStruct.lidar_data_format.pixel_shift_by_row = correctPixelShift(dataStruct.lidar_data_format.pixel_shift_by_row);
% Correct the intensity values if needed
% Assuming you have a method to read and correct intensity values
% dataStruct = correctIntensityValues(dataStruct);
% Return the corrected data structure
data = dataStruct;
end
function correctedShift = correctPixelShift(pixelShift)
% Correct the negative shift in the pixel_shift_by_row array
correctedShift = pixelShift;
for i = 1:length(pixelShift)
if pixelShift(i) < 0
correctedShift(i) = pixelShift(i) + 16; % Example correction, adjust as needed
end
end
end
% Example usage
jsonFilePath = 'path_to_your_json_file.json';
correctedData = customOusterFileReader(jsonFilePath);
disp(correctedData);
In this example:
1. Reading the JSON File: The JSON file is read and decoded into a MATLAB structure.
2. Correcting Pixel Shift: The `correctPixelShift` function iterates through the `pixel_shift_by_row` array and adjusts any negative values. The adjustment logic (`+ 16` in this case) should be tailored to your specific requirements.
3. Returning Corrected Data: The corrected data structure is returned.
Additional Considerations
1. Intensity Value Correction: If there are specific issues with intensity values, you may need to implement a similar correction function for those values. This example assumes you might have a method to read and correct intensity values.
2. Validation: Ensure that the corrected values make sense for your application. The logic used in `correctPixelShift` might require adjustments based on the specific nature of the shifts.
I hope the above steps narrow down the issue and give you clarity on how to proceed.
Thank you.

类别

Help CenterFile Exchange 中查找有关 Preprocessing 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by