ousterFileReader give no correct result
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Namnendra
el 12 de Ag. de 2024
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.
0 comentarios
Ver también
Categorías
Más información sobre Labeling, Segmentation, and Detection en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!